-
Notifications
You must be signed in to change notification settings - Fork 10
/
Copy path.eslintrc.cjs
72 lines (70 loc) · 2.27 KB
/
.eslintrc.cjs
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
const baseEslintConfig = {
// eslint-disable-next-line unicorn/prevent-abbreviations
env: {
node: true,
es2021: true,
},
extends: [
'./configs/eslint/general.cjs',
'./configs/eslint/typescript.cjs',
'./configs/eslint/style.cjs',
'./configs/eslint/deprecation.cjs',
'./configs/eslint/sort-imports.cjs',
'./configs/eslint/eslint-comments.cjs',
'./configs/eslint/sonarjs.cjs',
'./configs/eslint/unicorn.cjs',
'./configs/eslint/arrays.cjs',
'./configs/eslint/promise.cjs',
'./configs/eslint/no-constructor-bind.cjs',
'./configs/eslint/no-use-extend-native.cjs',
'plugin:no-unsanitized/DOM',
],
parserOptions: {
ecmaVersion: 12,
sourceType: 'module',
project: 'configs/tsconfig.glue-eslint.json',
},
};
const JAVASCRIPT_EXTENSIONS = ['ts', 'js', 'cjs', 'mjs', 'tsx', 'jsx'];
const JAVASCRIPT_EXTENSIONS_PATTERN = `{${JAVASCRIPT_EXTENSIONS.join(',')}}`;
module.exports = {
overrides: [{
files: [`**/*.${JAVASCRIPT_EXTENSIONS_PATTERN}`],
...baseEslintConfig,
}, {
// Specialised configuration for userscript source files.
files: [`src/**/*.${JAVASCRIPT_EXTENSIONS_PATTERN}`],
...baseEslintConfig,
// eslint-disable-next-line unicorn/prevent-abbreviations
env: {
browser: true,
es2021: true,
},
extends: [
...baseEslintConfig.extends,
'./configs/eslint/browser.cjs',
],
}, {
// Override per eslint-plugin-jest documentation.
files: [`tests/**/*.${JAVASCRIPT_EXTENSIONS_PATTERN}`],
...baseEslintConfig,
extends: [
...baseEslintConfig.extends,
'./configs/eslint/jest.cjs',
],
}, {
files: ['**/*.d.ts'],
...baseEslintConfig,
rules: {
// Disable some rules for TypeScript declaration files.
'@typescript-eslint/init-declarations': 'off',
'unicorn/no-static-only-class': 'off',
},
}, {
files: ['**/*.json'],
extends: ['plugin:json/recommended'],
}, {
files: ['**/tsconfig*.json'],
extends: ['plugin:json/recommended-with-comments'],
}],
};