Skip to content

Commit d1ca7c4

Browse files
committed
Eslint config
1 parent 27ccb6d commit d1ca7c4

File tree

2 files changed

+186
-180
lines changed

2 files changed

+186
-180
lines changed

eslint.config.mjs

Lines changed: 185 additions & 179 deletions
Original file line numberDiff line numberDiff line change
@@ -1,184 +1,190 @@
11
import {defineConfig} from 'eslint/config'
22
import globals from 'globals'
33

4-
export default defineConfig([{
5-
languageOptions: {
6-
globals: {
7-
...globals.node,
8-
...globals.mocha,
9-
},
4+
export default defineConfig([
5+
{
6+
ignores: ['test/.tmp/**', 'dist/**'],
107
},
11-
12-
rules: {
13-
strict: [2, 'global'],
14-
15-
'no-constant-condition': [2, {
16-
checkLoops: false,
17-
}],
18-
19-
'no-undef': 2,
20-
'no-use-before-define': 2,
21-
'new-cap': 0,
22-
'no-const-assign': 2,
23-
'key-spacing': 0,
24-
'block-spacing': [2, 'never'],
25-
'array-bracket-spacing': [2, 'never'],
26-
27-
'brace-style': [2, '1tbs', {
28-
allowSingleLine: true,
29-
}],
30-
31-
camelcase: [2, {
32-
properties: 'always',
33-
}],
34-
35-
'comma-spacing': [2, {
36-
before: false,
37-
after: true,
38-
}],
39-
40-
'max-statements-per-line': [2, {
41-
max: 1,
42-
}],
43-
44-
'no-debugger': 1,
45-
'no-trailing-spaces': 1,
46-
'eol-last': 0,
47-
'no-dupe-keys': 2,
48-
'no-dupe-args': 2,
49-
'no-dupe-class-members': 2,
50-
51-
'max-len': [1, {
52-
code: 110,
53-
ignoreUrls: true,
54-
}],
55-
56-
'newline-before-return': 1,
57-
'newline-after-var': 1,
58-
59-
'newline-per-chained-call': ['error', {
60-
ignoreChainWithDepth: 2,
61-
}],
62-
63-
'prefer-rest-params': 2,
64-
'func-style': [2, 'expression'],
65-
'no-useless-rename': 1,
66-
'prefer-spread': 2,
67-
'template-curly-spacing': [2, 'never'],
68-
'no-useless-constructor': 1,
69-
'no-useless-computed-key': 2,
70-
'no-this-before-super': 2,
71-
'no-class-assign': 2,
72-
'no-duplicate-imports': 2,
73-
'no-duplicate-case': 2,
74-
'no-empty-character-class': 2,
75-
'no-ex-assign': 2,
76-
'no-empty': 2,
77-
'no-extra-boolean-cast': 1,
78-
'quote-props': [2, 'as-needed'],
79-
'no-return-assign': 0,
80-
'one-var-declaration-per-line': [2, 'always'],
81-
'no-whitespace-before-property': 1,
82-
'no-underscore-dangle': 0,
83-
'max-nested-callbacks': [2, 4],
84-
85-
'space-unary-ops': [1, {
86-
words: true,
87-
nonwords: false,
88-
}],
89-
90-
'space-infix-ops': 2,
91-
92-
'keyword-spacing': [2, {
93-
before: true,
94-
after: true,
95-
}],
96-
97-
'space-in-parens': [2, 'never'],
98-
'space-before-function-paren': [1, 'never'],
99-
'max-depth': [2, 6],
100-
'linebreak-style': [2, 'unix'],
101-
'space-before-blocks': [1, 'always'],
102-
103-
'arrow-spacing': [2, {
104-
before: true,
105-
after: true,
106-
}],
107-
108-
'generator-star-spacing': [2, {
109-
before: true,
110-
after: false,
111-
}],
112-
113-
'constructor-super': 2,
114-
'object-shorthand': [2, 'always'],
115-
'no-unused-vars': 2,
116-
'no-multi-spaces': 0,
117-
'no-multi-str': 2,
118-
'no-native-reassign': 2,
119-
'no-redeclare': 2,
120-
'no-self-compare': 2,
121-
'no-throw-literal': 2,
122-
'wrap-iife': [2, 'inside'],
123-
'operator-linebreak': [2, 'after'],
124-
'operator-assignment': [2, 'always'],
125-
'object-curly-spacing': [2, 'never'],
126-
'no-spaced-func': 2,
127-
'no-unneeded-ternary': 1,
128-
'padded-blocks': [2, 'never'],
129-
'prefer-template': 2,
130-
'no-func-assign': 2,
131-
'no-inner-declarations': 2,
132-
'no-invalid-regexp': 2,
133-
'no-regex-spaces': 1,
134-
'no-unreachable': 1,
135-
'no-proto': 2,
136-
'no-sparse-arrays': 2,
137-
'valid-typeof': 2,
138-
'block-scoped-var': 2,
139-
'dot-location': [2, 'property'],
140-
'dot-notation': 2,
141-
eqeqeq: 2,
142-
'no-alert': 2,
143-
'no-case-declarations': 2,
144-
'no-empty-pattern': 2,
145-
'no-eval': 2,
146-
'no-extra-bind': 1,
147-
'no-labels': 2,
148-
'no-lone-blocks': 2,
149-
'no-lonely-if': 2,
150-
'no-multiple-empty-lines': 1,
151-
'no-nested-ternary': 2,
152-
'no-restricted-syntax': ['error', 'WithStatement'],
153-
'no-mixed-spaces-and-tabs': 1,
154-
'no-loop-func': 2,
155-
'use-isnan': 2,
156-
'no-irregular-whitespace': 1,
157-
'no-negated-in-lhs': 2,
158-
'no-obj-calls': 2,
159-
'prefer-const': 0,
160-
161-
'one-var': [2, {
162-
uninitialized: 'always',
163-
}],
164-
165-
curly: 0,
166-
'computed-property-spacing': [2, 'never'],
167-
'comma-style': [2, 'last'],
168-
'no-console': 1,
169-
170-
indent: [2, 2, {
171-
SwitchCase: 1,
172-
173-
VariableDeclarator: {
174-
var: 2,
175-
let: 2,
176-
const: 3,
177-
},
178-
}],
179-
180-
quotes: [2, 'single'],
181-
semi: [2, 'never'],
182-
'no-extra-semi': 0,
8+
{
9+
files: ['src/**', 'test/**', 'esbuild.js', 'eslint.config.mjs'],
18310
},
184-
}])
11+
{
12+
languageOptions: {
13+
globals: {
14+
...globals.node,
15+
...globals.mocha,
16+
},
17+
},
18+
rules: {
19+
strict: [2, 'global'],
20+
21+
'no-constant-condition': [2, {
22+
checkLoops: false,
23+
}],
24+
25+
'no-undef': 2,
26+
'no-use-before-define': 2,
27+
'new-cap': 0,
28+
'no-const-assign': 2,
29+
'key-spacing': 0,
30+
'block-spacing': [2, 'never'],
31+
'array-bracket-spacing': [2, 'never'],
32+
33+
'brace-style': [2, '1tbs', {
34+
allowSingleLine: true,
35+
}],
36+
37+
camelcase: [2, {
38+
properties: 'always',
39+
}],
40+
41+
'comma-spacing': [2, {
42+
before: false,
43+
after: true,
44+
}],
45+
46+
'max-statements-per-line': [2, {
47+
max: 1,
48+
}],
49+
50+
'no-debugger': 1,
51+
'no-trailing-spaces': 1,
52+
'eol-last': 0,
53+
'no-dupe-keys': 2,
54+
'no-dupe-args': 2,
55+
'no-dupe-class-members': 2,
56+
57+
'max-len': [1, {
58+
code: 110,
59+
ignoreUrls: true,
60+
}],
61+
62+
'newline-before-return': 1,
63+
'newline-after-var': 1,
64+
65+
'newline-per-chained-call': ['error', {
66+
ignoreChainWithDepth: 2,
67+
}],
68+
69+
'prefer-rest-params': 2,
70+
'func-style': [2, 'expression'],
71+
'no-useless-rename': 1,
72+
'prefer-spread': 2,
73+
'template-curly-spacing': [2, 'never'],
74+
'no-useless-constructor': 1,
75+
'no-useless-computed-key': 2,
76+
'no-this-before-super': 2,
77+
'no-class-assign': 2,
78+
'no-duplicate-imports': 2,
79+
'no-duplicate-case': 2,
80+
'no-empty-character-class': 2,
81+
'no-ex-assign': 2,
82+
'no-empty': 2,
83+
'no-extra-boolean-cast': 1,
84+
'quote-props': [2, 'as-needed'],
85+
'no-return-assign': 0,
86+
'one-var-declaration-per-line': [2, 'always'],
87+
'no-whitespace-before-property': 1,
88+
'no-underscore-dangle': 0,
89+
'max-nested-callbacks': [2, 4],
90+
91+
'space-unary-ops': [1, {
92+
words: true,
93+
nonwords: false,
94+
}],
95+
96+
'space-infix-ops': 2,
97+
98+
'keyword-spacing': [2, {
99+
before: true,
100+
after: true,
101+
}],
102+
103+
'space-in-parens': [2, 'never'],
104+
'space-before-function-paren': [1, 'never'],
105+
'max-depth': [2, 6],
106+
'linebreak-style': [2, 'unix'],
107+
'space-before-blocks': [1, 'always'],
108+
109+
'arrow-spacing': [2, {
110+
before: true,
111+
after: true,
112+
}],
113+
114+
'generator-star-spacing': [2, {
115+
before: true,
116+
after: false,
117+
}],
118+
119+
'constructor-super': 2,
120+
'object-shorthand': [2, 'always'],
121+
'no-unused-vars': 2,
122+
'no-multi-spaces': 0,
123+
'no-multi-str': 2,
124+
'no-native-reassign': 2,
125+
'no-redeclare': 2,
126+
'no-self-compare': 2,
127+
'no-throw-literal': 2,
128+
'wrap-iife': [2, 'inside'],
129+
'operator-linebreak': [2, 'after'],
130+
'operator-assignment': [2, 'always'],
131+
'object-curly-spacing': [2, 'never'],
132+
'no-spaced-func': 2,
133+
'no-unneeded-ternary': 1,
134+
'padded-blocks': [2, 'never'],
135+
'prefer-template': 2,
136+
'no-func-assign': 2,
137+
'no-inner-declarations': 2,
138+
'no-invalid-regexp': 2,
139+
'no-regex-spaces': 1,
140+
'no-unreachable': 1,
141+
'no-proto': 2,
142+
'no-sparse-arrays': 2,
143+
'valid-typeof': 2,
144+
'block-scoped-var': 2,
145+
'dot-location': [2, 'property'],
146+
'dot-notation': 2,
147+
eqeqeq: 2,
148+
'no-alert': 2,
149+
'no-case-declarations': 2,
150+
'no-empty-pattern': 2,
151+
'no-eval': 2,
152+
'no-extra-bind': 1,
153+
'no-labels': 2,
154+
'no-lone-blocks': 2,
155+
'no-lonely-if': 2,
156+
'no-multiple-empty-lines': 1,
157+
'no-nested-ternary': 2,
158+
'no-restricted-syntax': ['error', 'WithStatement'],
159+
'no-mixed-spaces-and-tabs': 1,
160+
'no-loop-func': 2,
161+
'use-isnan': 2,
162+
'no-irregular-whitespace': 1,
163+
'no-negated-in-lhs': 2,
164+
'no-obj-calls': 2,
165+
'prefer-const': 0,
166+
167+
'one-var': [2, {
168+
uninitialized: 'always',
169+
}],
170+
171+
curly: 0,
172+
'computed-property-spacing': [2, 'never'],
173+
'comma-style': [2, 'last'],
174+
'no-console': 1,
175+
176+
indent: [2, 2, {
177+
SwitchCase: 1,
178+
179+
VariableDeclarator: {
180+
var: 2,
181+
let: 2,
182+
const: 3,
183+
},
184+
}],
185+
186+
quotes: [2, 'single'],
187+
semi: [2, 'never'],
188+
'no-extra-semi': 0,
189+
},
190+
}])

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
"build": "node esbuild.js",
1010
"prepublishOnly": "npm run lint && npm run build",
1111
"test": "NODE_ENV='test' mocha -t 10000",
12-
"lint": "eslint ./src ./test ./esbuild.js ./eslint.config.mjs",
12+
"lint": "eslint",
1313
"lint-fix": "npm run lint -- --fix",
1414
"watch": "webpack --watch --mode development"
1515
},

0 commit comments

Comments
 (0)