-
Notifications
You must be signed in to change notification settings - Fork 310
/
eslint.config.mjs
119 lines (113 loc) · 3.36 KB
/
eslint.config.mjs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
import mocha from 'eslint-plugin-mocha'
import n from 'eslint-plugin-n'
import stylistic from '@stylistic/eslint-plugin-js'
import globals from 'globals'
import path from 'node:path'
import { fileURLToPath } from 'node:url'
import js from '@eslint/js'
import { FlatCompat } from '@eslint/eslintrc'
const __filename = fileURLToPath(import.meta.url)
const __dirname = path.dirname(__filename)
const compat = new FlatCompat({
baseDirectory: __dirname,
recommendedConfig: js.configs.recommended,
allConfig: js.configs.all
})
export default [
{
ignores: [
'**/coverage', // Just coverage reports.
'**/dist', // Generated
'**/docs', // Any JS here is for presentation only.
'**/out', // Generated
'**/node_modules', // We don't own these.
'**/versions', // This is effectively a node_modules tree.
'**/acmeair-nodejs', // We don't own this.
'**/vendor', // Generally, we didn't author this code.
'integration-tests/esbuild/out.js', // Generated
'integration-tests/esbuild/aws-sdk-out.js', // Generated
'packages/dd-trace/src/appsec/blocked_templates.js', // TODO Why is this ignored?
'packages/dd-trace/src/payload-tagging/jsonpath-plus.js' // Vendored
]
}, ...compat.extends('eslint:recommended', 'standard', 'plugin:mocha/recommended'), {
plugins: {
mocha,
n,
'@stylistic/js': stylistic
},
languageOptions: {
globals: {
...globals.node
},
ecmaVersion: 2022
},
settings: {
node: {
version: '>=16.0.0'
}
},
rules: {
'@stylistic/js/max-len': ['error', { code: 120, tabWidth: 2 }],
'@stylistic/js/object-curly-newline': ['error', {
multiline: true,
consistent: true
}],
'@stylistic/js/object-curly-spacing': ['error', 'always'],
'import/no-absolute-path': 'off',
'import/no-extraneous-dependencies': 'error',
'n/no-callback-literal': 'off',
'n/no-restricted-require': ['error', ['diagnostics_channel']],
'no-console': 'error',
'no-prototype-builtins': 'off',
'no-unused-expressions': 'off',
'no-var': 'error',
'prefer-const': 'error',
'standard/no-callback-literal': 'off'
}
},
{
files: [
'packages/*/test/**/*.js',
'packages/*/test/**/*.mjs',
'integration-tests/**/*.js',
'integration-tests/**/*.mjs',
'**/*.spec.js'
],
languageOptions: {
globals: {
...globals.mocha,
sinon: false,
expect: false,
proxyquire: false,
withVersions: false,
withPeerService: false,
withNamingSchema: false,
withExports: false
}
},
rules: {
'mocha/max-top-level-suites': 'off',
'mocha/no-exports': 'off',
'mocha/no-global-tests': 'off',
'mocha/no-identical-title': 'off',
'mocha/no-mocha-arrows': 'off',
'mocha/no-setup-in-describe': 'off',
'mocha/no-sibling-hooks': 'off',
'mocha/no-skipped-tests': 'off',
'mocha/no-top-level-hooks': 'off',
'n/handle-callback-err': 'off',
'no-loss-of-precision': 'off'
}
},
{
files: [
'integration-tests/**/*.js',
'integration-tests/**/*.mjs',
'packages/*/test/integration-test/**/*.js',
'packages/*/test/integration-test/**/*.mjs'
],
rules: {
'import/no-extraneous-dependencies': 'off'
}
}
]