8000 Add eslint 9.x config · HowProgrammingWorks/API@3a86221 · GitHub
[go: up one dir, main page]

Skip to content

Commit 3a86221

Browse files
committed
Add eslint 9.x config
1 parent 72dc195 commit 3a86221

File tree

1 file changed

+341
-0
lines changed

1 file changed

+341
-0
lines changed

eslint.config.js

Lines changed: 341 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,341 @@
1+
'use strict';
2+
3+
module.exports = {
4+
'languageOptions': {
5+
'ecmaVersion': 'latest',
6+
'sourceType': 'commonjs',
7+
'globals': {
8+
'BigInt': true,
9+
'AbortController': true,
10+
'AbortSignal': true,
11+
'DOMException': true,
12+
'fetch': true,
13+
'console': true,
14+
'process': true,
15+
'Buffer': true,
16+
'Blob': true,
17+
'TextDecoder': true,
18+
'TextEncoder': true,
19+
'TextDecoderStream': true,
20+
'TextEncoderStream': true,
21+
'WebSocket': true,
22+
'window': true,
23+
'setTimeout': true,
24+
'setImmediate': true,
25+
'setInterval': true,
26+
'clearTimeout': true,
27+
'clearImmediate': true,
28+
'clearInterval': true,
29+
'__dirname': true,
30+
'__filename': true,
31+
'Event': true,
32+
'EventTarget': true,
33+
'MessageChannel': true,
34+
'MessageEvent': true,
35+
'MessagePort': true,
36+
'FormData': true,
37+
'Headers': true,
38+
'Response': true,
39+
'Request': true,
40+
'ByteLengthQueuingStrategy': true,
41+
'URL': true,
42+
'URLSearchParams': true,
43+
'WebAssembly': true,
44+
'queueMicrotask': true,
45+
'BroadcastChannel': true,
46+
'CompressionStream': true,
47+
'DecompressionStream': true,
48+
'CountQueuingStrategy': true,
49+
'DomainError': true,
50+
'document': true,
51+
'location': true,
52+
'self': true,
53+
'caches': true,
54+
'navigator': true,
55+
'File': true,
56+
'localStorage': true,
57+
},
58+
},
59+
'ignores': ['node_modules/*'],
60+
rules: {
61+
indent: ['error', 2],
62+
'linebreak-style': ['error', 'unix'],
63+
quotes: [
64+
'error',
65+
'single',
66+
{
67+
allowTemplateLiterals: true,
68+
},
69+
],
70+
semi: ['error', 'always'],
71+
'no-loop-func': ['error'],
72+
'block-spacing': ['error', 'always'],
73+
camelcase: ['error'],
74+
eqeqeq: ['error', 'always'],
75+
strict: ['error', 'global'],
76+
'brace-style': [
77+
'error',
78+
'1tbs',
79+
{
80+
allowSingleLine: true,
81+
},
82+
],
83+
'comma-style': ['error', 'last'],
84+
'comma-spacing': [
85+
'error',
86+
{
87+
before: false,
88+
after: true,
89+
},
90+
],
91+
'eol-last': ['error'],
92+
'func-call-spacing': ['error', 'never'],
93+
'key-spacing': [
94+
'error',
95+
{
96+
beforeColon: false,
97+
afterColon: true,
98+
mode: 'minimum',
99+
},
100+
],
101+
'keyword-spacing': [
102+
'error',
103+
{
104+
before: true,
105+
after: true,
106+
overrides: {
107+
function: {
108+
after: false,
109+
},
110+
},
111+
},
112+
],
113+
'max-len': [
114+
'error',
115+
{
116+
code: 80,
117+
ignoreUrls: true,
118+
},
119+
],
120+
'max-nested-callbacks': [
121+
'error',
122+
{
123+
max: 7,
124+
},
125+
],
126+
'new-cap': [
127+
'error',
128+
{
129+
newIsCap: true,
130+
capIsNew: true,
131+
properties: true,
132+
},
133+
],
134+
'new-parens': ['error'],
135+
'no-lonely-if': ['error'],
136+
'no-trailing-spaces': ['error'],
137+
'no-unneeded-ternary': ['error'],
138+
'no-whitespace-before-property': ['error'],
139+
'object-curly-spacing': ['error', 'always'],
140+
'operator-assignment': ['error', 'always'],
141+
'operator-linebreak': [
142+
'error',
143+
'after',
144+
{
145+
overrides: {
146+
'?': 'before',
147+
':': 'before',
148+
},
149+
},
150+
],
151+
'semi-spacing': [
152+
'error',
153+
{
154+
before: false,
155+
after: true,
156+
},
157+
],
158+
'space-before-blocks': ['error', 'always'],
159+
'space-before-function-paren': [
160+
'error',
161+
{
162+
anonymous: 'never',
163+
named: 'never',
164+
asyncArrow: 'always',
165+
},
166+
],
167+
'space-in-parens': ['error', 'never'],
168+
'space-infix-ops': ['error'],
169+
'space-unary-ops': [
170+
'error',
171+
{
172+
words: true,
173+
nonwords: false,
174+
overrides: {
175+
typeof: false,
176+
},
177+
},
178+
],
179+
'no-unreachable': ['error'],
180+
'no-global-assign': ['error'],
181+
'no-self-compare': ['error'],
182+
'no-unmodified-loop-condition': ['error'],
183+
'no-constant-condition': [
184+
'error',
185+
{
186+
checkLoops: false,
187+
},
188+
],
189+
'no-console': ['off'],
190+
'no-useless-concat': ['error'],
191+
'no-useless-escape': ['error'],
192+
'no-shadow-restricted-names': ['error'],
193+
'no-use-before-define': [
194+
'error',
195+
{
196+
functions: false,
197+
},
198+
],
199+
'arrow-parens': ['error', 'always'],
200+
'arrow-body-style': ['error', 'as-needed'],
201+
'arrow-spacing': ['error'],
202+
'no-confusing-arrow': 0,
203+
'no-useless-computed-key': ['error'],
204+
'no-useless-rename': ['error'],
205+
'no-var': ['error'],
206+
'object-shorthand': ['error', 'always'],
207+
'prefer-arrow-callback': ['error'],
208+
'prefer-const': ['error'],
209+
'prefer-numeric-literals': ['error'],
210+
'prefer-rest-params': ['error'],
211+
'prefer-spread': ['error'],
212+
'rest-spread-spacing': ['error', 'never'],
213+
'template-curly-spacing': ['error', 'never'],
214+
'consistent-return': [
215+
'error',
216+
{
217+
treatUndefinedAsUnspecified: true,
218+
},
219+
],
220+
'constructor-super': ['error'],
221+
'for-direction': ['error'],
222+
'getter-return': ['error'],
223+
'no-async-promise-executor': ['error'],
224+
'no-case-declarations': ['error'],
225+
'no-class-assign': ['error'],
226+
'no-compare-neg-zero': ['error'],
227+< 9E7A div class="diff-text-inner"> 'no-cond-assign': ['error'],
228+
'no-const-assign': ['error'],
229+
'no-constant-binary-expression': ['error'],
230+
'no-control-regex': ['error'],
231+
'no-debugger': ['error'],
232+
'no-delete-var': ['error'],
233+
'no-dupe-args': ['error'],
234+
'no-dupe-class-members': ['error'],
235+
'no-dupe-else-if': ['error'],
236+
'no-dupe-keys': ['error'],
237+
'no-duplicate-case': ['error'],
238+
'no-empty': ['error'],
239+
'no-empty-character-class': ['error'],
240+
'no-empty-pattern': ['error'],
241+
'no-empty-static-block': ['error'],
242+
'no-ex-assign': ['error'],
243+
'no-extra-boolean-cast': ['error'],
244+
'no-fallthrough': ['error'],
245+
'no-func-assign': ['error'],
246+
'no-import-assign': ['error'],
247+
'no-invalid-regexp': ['error'],
248+
'no-irregular-whitespace': ['error'],
249+
'no-loss-of-precision': ['error'],
250+
'no-misleading-character-class': ['error'],
251+
'no-new-native-nonconstructor': ['error'],
252+
'no-nonoctal-decimal-escape': ['error'],
253+
'no-obj-calls': ['error'],
254+
'no-octal': ['error'],
255+
'no-prototype-builtins': ['error'],
256+
'no-redeclare': ['error'],
257+
'no-regex-spaces': ['error'],
258+
'no-self-assign': ['error'],
259+
'no-setter-return': ['error'],
260+
'no-sparse-arrays': ['error'],
261+
'no-this-before-super': ['error'],
262+
'no-undef': ['error'],
263+
'no-unexpected-multiline': 0,
264+
'no-unsafe-finally': ['error'],
265+
'no-unsafe-negation': ['error'],
266+
'no-unsafe-optional-chaining': ['error'],
267+
'no-unused-labels': ['error'],
268+
'no-unused-private-class-members': ['error'],
269+
'no-unused-vars': ['error'],
270+
'no-useless-backreference': ['error'],
271+
'no-useless-catch': ['error'],
272+
'no-with': ['error'],
273+
'require-yield': ['error'],
274+
'use-isnan': ['error'],
275+
'valid-typeof': ['error'],
276+
curly: ['error', 'multi-line', 'consistent'],
277+
'space-unary-word-ops': 'off',
278+
'generator-star': 'off',
279+
'no-comma-dangle': 'off',
280+
'no-reserved-keys': 'off',
281+
'no-space-before-semi': 'off',
282+
'no-wrap-func': 'off',
283+
'space-after-function-name': 'off',
284+
'space-before-function-parentheses': 'off',
285+
'space-in-brackets': 'off',
286+
'no-arrow-condition': 'off',
287+
'space-after-keywords': 'off',
288+
'space-before-keywords': 'off',
289+
'space-return-throw-case': 'off',
290+
'no-spaced-func': 'off',
291+
'indent-legacy': 'off',
292+
'array-bracket-newline': 'off',
293+
'array-bracket-spacing': 'off',
294+
'array-element-newline': 'off',
295+
'comma-dangle': ['error', 'always-multiline'],
296+
'computed-property-spacing': 'off',
297+
'dot-location': 'off',
298+
'function-call-argument-newline': 'off',
299+
'function-paren-newline': 'off',
300+
'generator-star-spacing': 'off',
301+
'implicit-arrow-linebreak': 'off',
302+
'jsx-quotes': 'off',
303+
'lines-around-comment': 0,
304+
'max-statements-per-line': 'off',
305+
'multiline-ternary': 'off',
306+
'newline-per-chained-call': 'off',
307+
'no-extra-parens': [
308+
'error',
309+
'all',
310+
{
311+
returnAssign: false,
312+
nestedBinaryExpressions: false,
313+
enforceForArrowConditionals: false,
314+
},
315+
],
316+
'no-extra-semi': 'off',
317+
'no-floating-decimal': 'off',
318+
'no-mixed-operators': 0,
319+
'no-mixed-spaces-and-tabs': 'off',
320+
'no-multi-spaces': 'off',
321+
'no-multiple-empty-lines': 'off',
322+
'no-tabs': 0,
323+
'nonblock-statement-body-position': 'off',
324+
'object-curly-newline': 'off',
325+
'object-property-newline': 'off',
326+
'one-var-declaration-per-line': 'off',
327+
'padded-blocks': 'off',
328+
'quote-props': 'off',
329+
'semi-style': 'off',
330+
'switch-colon-spacing': 'off',
331+
'template-tag-spacing': 'off',
332+
'wrap-iife': 'off',
333+
'wrap-regex': 'off',
334+
'yield-star-spacing': 'off',
335+
'no-return-assign': ['error'],
336+
'handle-callback-err': ['error', '^err'],
337+
'no-nested-ternary': ['error'],
338+
'no-invalid-this': ['error'],
339+
'class-methods-use-this': ['warn'],
340+
},
341+
};

0 commit comments

Comments
 (0)
0