-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy patheslint.config.mjs
131 lines (130 loc) · 4.02 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
120
121
122
123
124
125
126
127
128
129
130
131
import js from '@eslint/js';
import stylisticJs from '@stylistic/eslint-plugin-js';
import jFactoryESLintPlugIn from './scripts/lint/eslint-plugin.mjs';
import globals from 'globals';
export default [
js.configs.recommended,
{
plugins: {
'@stylistic/js': stylisticJs,
jFactoryESLintPlugIn
},
languageOptions: {
ecmaVersion: 'latest'
},
rules: {
'require-atomic-updates': 'warn',
'no-empty': ['error', { allowEmptyCatch: true }],
'no-unused-vars': ['error', { caughtErrors: 'none' }],
'no-useless-catch': 'error',
'no-catch-shadow': 'error',
'no-unsafe-finally': 'error',
'no-await-in-loop': 'error',
'no-return-await': 'error',
'no-promise-executor-return': 'error',
'no-misleading-character-class': 'error',
'consistent-return': 'warn',
'no-duplicate-imports': 'error',
'no-self-assign': 'error',
'no-constructor-return': 'error',
'eqeqeq': ['error', 'always'],
'no-implicit-globals': 'error',
'@stylistic/js/max-len': ['error', { code: 120 }],
'@stylistic/js/indent': ['error', 2, { SwitchCase: 1 }],
'@stylistic/js/no-multiple-empty-lines': ['error', { max: 2 }],
'@stylistic/js/eol-last': ['error', 'never'],
'@stylistic/js/quotes': ['error', 'single', { avoidEscape: true }],
'@stylistic/js/quote-props': ['error', 'consistent-as-needed'],
'@stylistic/js/arrow-parens': ['error', 'as-needed'],
'@stylistic/js/no-extra-parens': ['error', 'all', { conditionalAssign: false }],
'@stylistic/js/comma-dangle': ['error', 'never'],
'@stylistic/js/key-spacing': ['error', { afterColon: true }],
'@stylistic/js/comma-spacing': ['error', { before: false, after: true }],
'@stylistic/js/object-curly-spacing': ['error', 'always', { objectsInObjects: false, arraysInObjects: false }],
'@stylistic/js/array-bracket-spacing': ['error', 'never', { objectsInArrays: false, arraysInArrays: false }],
'@stylistic/js/arrow-spacing': 'error',
'@stylistic/js/function-call-spacing': ['error', 'never'],
'@stylistic/js/keyword-spacing': ['error', {
overrides: {
// while: { after: false },
}
}],
'@stylistic/js/space-infix-ops': 'error',
'@stylistic/js/space-unary-ops': [
2, {
words: true,
nonwords: false,
overrides: {
// 'new': false,
// '++': true
}
}
],
'@stylistic/js/space-before-function-paren': ['error', {
anonymous: 'never',
named: 'never',
asyncArrow: 'always'
}],
// '@stylistic/js/semi': ['warn', 'always', {
// omitLastInOneLineBlock: true,
// omitLastInOneLineClassBody: true
// }],
'jFactoryESLintPlugIn/semi-FORK:optional-semi-before-parens-braces': ['error', 'always', {
omitLastInOneLineBlock: true,
omitLastInOneLineClassBody: true
}],
'@stylistic/js/semi-style': ['error', 'last'],
'@stylistic/js/semi-spacing': 'error',
'@stylistic/js/no-extra-semi': 'error'
}
},
{
files: ['**/*.cjs'],
languageOptions: {
sourceType: 'commonjs',
globals: {
...globals.node
}
},
rules: {
}
},
{
files: ['scripts/**/*.mjs'],
languageOptions: {
sourceType: 'module',
globals: {
...globals.node
}
},
rules: {
}
},
{
files: ['src/**/*.mjs'],
languageOptions: {
sourceType: 'module',
globals: {
...globals.browser,
process: 'readonly'
}
},
rules: {
'@stylistic/js/indent': ['error', 4, { SwitchCase: 1 }],
'@stylistic/js/quotes': ['error', 'double', { avoidEscape: true }]
}
},
{
files: ['test/**/*.*js'],
languageOptions: {
sourceType: 'module',
globals: {
...globals.node
}
},
rules: {
'@stylistic/js/indent': ['error', 4, { SwitchCase: 1 }],
'@stylistic/js/quotes': ['error', 'double', { avoidEscape: true }]
}
}
];