@egs33/eslint-config 3.0.2 → 4.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/airbnb/best-practices.js +7 -283
- package/airbnb/errors.js +4 -170
- package/airbnb/es6.js +0 -112
- package/airbnb/style.js +3 -521
- package/airbnb/variables.js +1 -32
- package/base.js +8 -6
- package/package.json +19 -19
- package/plugin-rules/imports.js +1 -9
- package/plugin-rules/stylistic.js +186 -0
- package/typescript-base.js +54 -8
- package/typescript-svelte.js +1 -2
package/package.json
CHANGED
|
@@ -1,26 +1,26 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@egs33/eslint-config",
|
|
3
3
|
"description": "eslint config for me",
|
|
4
|
-
"version": "
|
|
4
|
+
"version": "4.0.0",
|
|
5
5
|
"author": "egs33",
|
|
6
6
|
"type": "module",
|
|
7
7
|
"dependencies": {
|
|
8
|
-
"@eslint/
|
|
9
|
-
"@
|
|
10
|
-
"@typescript-eslint/
|
|
11
|
-
"eslint
|
|
12
|
-
"eslint-plugin-array-func": "^5.0.
|
|
13
|
-
"eslint-plugin-import": "^2.
|
|
14
|
-
"eslint-plugin-n": "^
|
|
15
|
-
"eslint-plugin-promise": "^
|
|
16
|
-
"eslint-plugin-regexp": "^2.
|
|
17
|
-
"globals": "^
|
|
8
|
+
"@eslint/js": "^9.14.0",
|
|
9
|
+
"@stylistic/eslint-plugin": "^2.10.0",
|
|
10
|
+
"@typescript-eslint/eslint-plugin": "^8.12.2",
|
|
11
|
+
"@typescript-eslint/parser": "^8.12.2",
|
|
12
|
+
"eslint-plugin-array-func": "^5.0.2",
|
|
13
|
+
"eslint-plugin-import": "^2.31.0",
|
|
14
|
+
"eslint-plugin-n": "^17.12.0",
|
|
15
|
+
"eslint-plugin-promise": "^7.1.0",
|
|
16
|
+
"eslint-plugin-regexp": "^2.6.0",
|
|
17
|
+
"globals": "^15.11.0"
|
|
18
18
|
},
|
|
19
19
|
"devDependencies": {
|
|
20
|
-
"eslint": "^
|
|
21
|
-
"svelte-eslint-parser": "^0.
|
|
22
|
-
"typescript": "^5.
|
|
23
|
-
"typescript-eslint": "^
|
|
20
|
+
"eslint": "^9.13.0",
|
|
21
|
+
"svelte-eslint-parser": "^0.43.0",
|
|
22
|
+
"typescript": "^5.6.3",
|
|
23
|
+
"typescript-eslint": "^8.12.2"
|
|
24
24
|
},
|
|
25
25
|
"engines": {
|
|
26
26
|
"node": ">=20"
|
|
@@ -45,10 +45,10 @@
|
|
|
45
45
|
"license": "MIT",
|
|
46
46
|
"main": "nodejs.js",
|
|
47
47
|
"peerDependencies": {
|
|
48
|
-
"eslint": "^
|
|
49
|
-
"svelte-eslint-parser": ">=0.
|
|
50
|
-
"typescript": "^5.
|
|
51
|
-
"typescript-eslint": "^
|
|
48
|
+
"eslint": "^9.13.0",
|
|
49
|
+
"svelte-eslint-parser": ">=0.43.0",
|
|
50
|
+
"typescript": "^5.6.3",
|
|
51
|
+
"typescript-eslint": "^8.12.2"
|
|
52
52
|
},
|
|
53
53
|
"peerDependenciesMeta": {
|
|
54
54
|
"typescript-eslint": {
|
package/plugin-rules/imports.js
CHANGED
|
@@ -124,10 +124,6 @@ export const imports = {
|
|
|
124
124
|
// https://github.com/import-js/eslint-plugin-import/blob/master/docs/rules/newline-after-import.md
|
|
125
125
|
'import/newline-after-import': 'error',
|
|
126
126
|
|
|
127
|
-
// Require modules with a single export to use a default export
|
|
128
|
-
// https://github.com/import-js/eslint-plugin-import/blob/master/docs/rules/prefer-default-export.md
|
|
129
|
-
'import/prefer-default-export': 'error',
|
|
130
|
-
|
|
131
127
|
// Restrict which files can be imported in a given folder
|
|
132
128
|
// https://github.com/import-js/eslint-plugin-import/blob/master/docs/rules/no-restricted-paths.md
|
|
133
129
|
'import/no-restricted-paths': 'off',
|
|
@@ -196,10 +192,6 @@ export const imports = {
|
|
|
196
192
|
// https://github.com/import-js/eslint-plugin-import/blob/44a038c06487964394b1e15b64f3bd34e5d40cde/docs/rules/group-exports.md
|
|
197
193
|
'import/group-exports': 'off',
|
|
198
194
|
|
|
199
|
-
// forbid default exports. this is a terrible rule, do not use it.
|
|
200
|
-
// https://github.com/import-js/eslint-plugin-import/blob/44a038c06487964394b1e15b64f3bd34e5d40cde/docs/rules/no-default-export.md
|
|
201
|
-
'import/no-default-export': 'off',
|
|
202
|
-
|
|
203
195
|
// Prohibit named exports. this is a terrible rule, do not use it.
|
|
204
196
|
// https://github.com/import-js/eslint-plugin-import/blob/1ec80fa35fa1819e2d35a70e68fb6a149fb57c5e/docs/rules/no-named-export.md
|
|
205
197
|
'import/no-named-export': 'off',
|
|
@@ -210,7 +202,7 @@ export const imports = {
|
|
|
210
202
|
|
|
211
203
|
// Forbid cyclical dependencies between modules
|
|
212
204
|
// https://github.com/import-js/eslint-plugin-import/blob/d81f48a2506182738409805f5272eff4d77c9348/docs/rules/no-cycle.md
|
|
213
|
-
'import/no-cycle': ['error', { maxDepth:
|
|
205
|
+
'import/no-cycle': ['error', { maxDepth: 20 }],
|
|
214
206
|
|
|
215
207
|
// Ensures that there are no useless path segments
|
|
216
208
|
// https://github.com/import-js/eslint-plugin-import/blob/ebafcbf59ec9f653b2ac2a0156ca3bcba0a7cf57/docs/rules/no-useless-path-segments.md
|
|
@@ -0,0 +1,186 @@
|
|
|
1
|
+
export const rules = {
|
|
2
|
+
'@stylistic/dot-location': ['error', 'property'],
|
|
3
|
+
|
|
4
|
+
'@stylistic/no-floating-decimal': 'error',
|
|
5
|
+
'@stylistic/no-multi-spaces': [
|
|
6
|
+
'error', {
|
|
7
|
+
ignoreEOLComments: false,
|
|
8
|
+
},
|
|
9
|
+
],
|
|
10
|
+
'@stylistic/wrap-iife': ['error', 'outside', { functionPrototypeMethods: false }],
|
|
11
|
+
'@stylistic/arrow-parens': ['error', 'always'],
|
|
12
|
+
'@stylistic/array-bracket-spacing': ['error', 'never'],
|
|
13
|
+
'@stylistic/block-spacing': ['error', 'always'],
|
|
14
|
+
'@stylistic/brace-style': ['error', '1tbs', { allowSingleLine: true }],
|
|
15
|
+
'@stylistic/comma-dangle': [
|
|
16
|
+
'error', {
|
|
17
|
+
arrays: 'always-multiline',
|
|
18
|
+
objects: 'always-multiline',
|
|
19
|
+
imports: 'always-multiline',
|
|
20
|
+
exports: 'always-multiline',
|
|
21
|
+
functions: 'always-multiline',
|
|
22
|
+
},
|
|
23
|
+
],
|
|
24
|
+
'@stylistic/comma-spacing': ['error', { before: false, after: true }],
|
|
25
|
+
'@stylistic/comma-style': [
|
|
26
|
+
'error', 'last', {
|
|
27
|
+
exceptions: {
|
|
28
|
+
ArrayExpression: false,
|
|
29
|
+
ArrayPattern: false,
|
|
30
|
+
ArrowFunctionExpression: false,
|
|
31
|
+
CallExpression: false,
|
|
32
|
+
FunctionDeclaration: false,
|
|
33
|
+
FunctionExpression: false,
|
|
34
|
+
ImportDeclaration: false,
|
|
35
|
+
ObjectExpression: false,
|
|
36
|
+
ObjectPattern: false,
|
|
37
|
+
VariableDeclaration: false,
|
|
38
|
+
NewExpression: false,
|
|
39
|
+
},
|
|
40
|
+
},
|
|
41
|
+
],
|
|
42
|
+
'@stylistic/computed-property-spacing': ['error', 'never'],
|
|
43
|
+
'@stylistic/eol-last': ['error', 'always'],
|
|
44
|
+
'@stylistic/function-call-argument-newline': ['error', 'consistent'],
|
|
45
|
+
'@stylistic/func-call-spacing': ['error', 'never'],
|
|
46
|
+
'@stylistic/function-paren-newline': ['error', 'multiline-arguments'],
|
|
47
|
+
'@stylistic/implicit-arrow-linebreak': ['error', 'beside'],
|
|
48
|
+
'@stylistic/indent': [
|
|
49
|
+
'error', 2, {
|
|
50
|
+
SwitchCase: 1,
|
|
51
|
+
VariableDeclarator: 1,
|
|
52
|
+
outerIIFEBody: 1,
|
|
53
|
+
// MemberExpression: null,
|
|
54
|
+
FunctionDeclaration: {
|
|
55
|
+
parameters: 1,
|
|
56
|
+
body: 1,
|
|
57
|
+
},
|
|
58
|
+
FunctionExpression: {
|
|
59
|
+
parameters: 1,
|
|
60
|
+
body: 1,
|
|
61
|
+
},
|
|
62
|
+
CallExpression: {
|
|
63
|
+
arguments: 1,
|
|
64
|
+
},
|
|
65
|
+
ArrayExpression: 1,
|
|
66
|
+
ObjectExpression: 1,
|
|
67
|
+
ImportDeclaration: 1,
|
|
68
|
+
flatTernaryExpressions: false,
|
|
69
|
+
// list derived from https://github.com/benjamn/ast-types/blob/HEAD/def/jsx.js
|
|
70
|
+
ignoredNodes: ['JSXElement', 'JSXElement > *', 'JSXAttribute', 'JSXIdentifier', 'JSXNamespacedName', 'JSXMemberExpression', 'JSXSpreadAttribute', 'JSXExpressionContainer', 'JSXOpeningElement', 'JSXClosingElement', 'JSXFragment', 'JSXOpeningFragment', 'JSXClosingFragment', 'JSXText', 'JSXEmptyExpression', 'JSXSpreadChild'],
|
|
71
|
+
ignoreComments: false,
|
|
72
|
+
},
|
|
73
|
+
],
|
|
74
|
+
'@stylistic/jsx-quotes': ['off', 'prefer-double'],
|
|
75
|
+
'@stylistic/key-spacing': ['error', { beforeColon: false, afterColon: true }],
|
|
76
|
+
'@stylistic/keyword-spacing': [
|
|
77
|
+
'error', {
|
|
78
|
+
before: true,
|
|
79
|
+
after: true,
|
|
80
|
+
overrides: {
|
|
81
|
+
return: { after: true },
|
|
82
|
+
throw: { after: true },
|
|
83
|
+
case: { after: true },
|
|
84
|
+
},
|
|
85
|
+
},
|
|
86
|
+
],
|
|
87
|
+
'@stylistic/linebreak-style': ['error', 'unix'],
|
|
88
|
+
'@stylistic/lines-between-class-members': ['error', 'always', { exceptAfterSingleLine: false }],
|
|
89
|
+
'@stylistic/lines-around-comment': 'off',
|
|
90
|
+
'@stylistic/max-len': [
|
|
91
|
+
'error', 120, 2, {
|
|
92
|
+
ignoreUrls: true,
|
|
93
|
+
ignoreComments: true,
|
|
94
|
+
ignoreRegExpLiterals: true,
|
|
95
|
+
ignoreStrings: true,
|
|
96
|
+
ignoreTemplateLiterals: true,
|
|
97
|
+
},
|
|
98
|
+
],
|
|
99
|
+
'@stylistic/max-statements-per-line': ['off', { max: 1 }],
|
|
100
|
+
'@stylistic/multiline-comment-style': ['off', 'starred-block'],
|
|
101
|
+
'@stylistic/new-parens': 'error',
|
|
102
|
+
'@stylistic/newline-per-chained-call': ['error', { ignoreChainWithDepth: 4 }],
|
|
103
|
+
'@stylistic/no-mixed-operators': [
|
|
104
|
+
'error', {
|
|
105
|
+
// the list of arithmetic groups disallows mixing `%` and `**`
|
|
106
|
+
// with other arithmetic operators.
|
|
107
|
+
groups: [
|
|
108
|
+
['%', '**'],
|
|
109
|
+
['%', '+'],
|
|
110
|
+
['%', '-'],
|
|
111
|
+
['%', '*'],
|
|
112
|
+
['%', '/'],
|
|
113
|
+
['/', '*'],
|
|
114
|
+
['&', '|', '<<', '>>', '>>>'],
|
|
115
|
+
['==', '!=', '===', '!=='],
|
|
116
|
+
['&&', '||'],
|
|
117
|
+
],
|
|
118
|
+
allowSamePrecedence: false,
|
|
119
|
+
},
|
|
120
|
+
],
|
|
121
|
+
'@stylistic/no-mixed-spaces-and-tabs': 'error',
|
|
122
|
+
'@stylistic/no-multiple-empty-lines': ['error', { max: 1, maxBOF: 0, maxEOF: 0 }],
|
|
123
|
+
'@stylistic/no-tabs': 'error',
|
|
124
|
+
'@stylistic/no-trailing-spaces': [
|
|
125
|
+
'error', {
|
|
126
|
+
skipBlankLines: false,
|
|
127
|
+
ignoreComments: false,
|
|
128
|
+
},
|
|
129
|
+
],
|
|
130
|
+
'@stylistic/no-whitespace-before-property': 'error',
|
|
131
|
+
'@stylistic/nonblock-statement-body-position': ['error', 'beside', { overrides: {} }],
|
|
132
|
+
'@stylistic/object-curly-spacing': ['error', 'always'],
|
|
133
|
+
'@stylistic/object-curly-newline': [
|
|
134
|
+
'error', {
|
|
135
|
+
ObjectExpression: { minProperties: 4, multiline: true, consistent: true },
|
|
136
|
+
ObjectPattern: { minProperties: 4, multiline: true, consistent: true },
|
|
137
|
+
ImportDeclaration: { minProperties: 4, multiline: true, consistent: true },
|
|
138
|
+
ExportDeclaration: { minProperties: 4, multiline: true, consistent: true },
|
|
139
|
+
},
|
|
140
|
+
],
|
|
141
|
+
'@stylistic/object-property-newline': [
|
|
142
|
+
'error', {
|
|
143
|
+
allowAllPropertiesOnSameLine: true,
|
|
144
|
+
},
|
|
145
|
+
],
|
|
146
|
+
'@stylistic/quote-props': ['error', 'as-needed', { keywords: false, unnecessary: true, numbers: false }],
|
|
147
|
+
'@stylistic/quotes': ['error', 'single', { avoidEscape: true }],
|
|
148
|
+
'@stylistic/semi': ['error', 'always'],
|
|
149
|
+
'@stylistic/semi-spacing': ['error', { before: false, after: true }],
|
|
150
|
+
'@stylistic/semi-style': ['error', 'last'],
|
|
151
|
+
'@stylistic/space-before-blocks': 'error',
|
|
152
|
+
'@stylistic/space-before-function-paren': [
|
|
153
|
+
'error', {
|
|
154
|
+
anonymous: 'always',
|
|
155
|
+
named: 'never',
|
|
156
|
+
asyncArrow: 'always',
|
|
157
|
+
},
|
|
158
|
+
],
|
|
159
|
+
'@stylistic/space-in-parens': ['error', 'never'],
|
|
160
|
+
'@stylistic/space-infix-ops': 'error',
|
|
161
|
+
'@stylistic/space-unary-ops': [
|
|
162
|
+
'error', {
|
|
163
|
+
words: true,
|
|
164
|
+
nonwords: false,
|
|
165
|
+
overrides: {
|
|
166
|
+
},
|
|
167
|
+
},
|
|
168
|
+
],
|
|
169
|
+
'@stylistic/spaced-comment': [
|
|
170
|
+
'error', 'always', {
|
|
171
|
+
line: {
|
|
172
|
+
exceptions: ['-', '+'],
|
|
173
|
+
markers: ['=', '!', '/'], // space here to support sprockets directives, slash for TS /// comments
|
|
174
|
+
},
|
|
175
|
+
block: {
|
|
176
|
+
exceptions: ['-', '+'],
|
|
177
|
+
markers: ['=', '!', ':', '::'], // space here to support sprockets directives and flow comment types
|
|
178
|
+
balanced: true,
|
|
179
|
+
},
|
|
180
|
+
},
|
|
181
|
+
],
|
|
182
|
+
'@stylistic/switch-colon-spacing': ['error', { after: true, before: false }],
|
|
183
|
+
'@stylistic/template-tag-spacing': ['error', 'never'],
|
|
184
|
+
'@stylistic/wrap-regex': 'off',
|
|
185
|
+
'@stylistic/array-bracket-newline': 'error',
|
|
186
|
+
};
|
package/typescript-base.js
CHANGED
|
@@ -1,16 +1,11 @@
|
|
|
1
|
-
import { FlatCompat } from '@eslint/eslintrc';
|
|
2
1
|
// eslint-disable-next-line import/no-unresolved
|
|
3
2
|
import tseslint from 'typescript-eslint';
|
|
4
3
|
import base from './base.js';
|
|
5
4
|
|
|
6
|
-
const compat = new FlatCompat();
|
|
7
|
-
|
|
8
5
|
const config = [
|
|
9
6
|
...base,
|
|
10
|
-
|
|
11
|
-
...tseslint.configs.
|
|
12
|
-
...tseslint.configs.stylisticTypeChecked.map((c) => ({ ...c, plugins: {} })),
|
|
13
|
-
...compat.extends('airbnb-typescript/base'),
|
|
7
|
+
...tseslint.configs.strictTypeChecked,
|
|
8
|
+
...tseslint.configs.stylisticTypeChecked,
|
|
14
9
|
{
|
|
15
10
|
languageOptions: {
|
|
16
11
|
parserOptions: {
|
|
@@ -18,6 +13,57 @@ const config = [
|
|
|
18
13
|
},
|
|
19
14
|
},
|
|
20
15
|
rules: {
|
|
16
|
+
// disable eslint rules for use typescript-eslint rules
|
|
17
|
+
'default-param-last': 'off',
|
|
18
|
+
'no-array-constructor': 'off',
|
|
19
|
+
'no-dupe-class-members': 'off',
|
|
20
|
+
'no-empty-function': 'off',
|
|
21
|
+
'no-implied-eval': 'off',
|
|
22
|
+
'no-new-func': 'off',
|
|
23
|
+
'no-loss-of-precision': 'off',
|
|
24
|
+
'no-loop-func': 'off',
|
|
25
|
+
'no-magic-numbers': 'off',
|
|
26
|
+
'no-redeclare': 'off',
|
|
27
|
+
'no-shadow': 'off',
|
|
28
|
+
'no-throw-literal': 'off',
|
|
29
|
+
'no-use-before-define': 'off',
|
|
30
|
+
'no-useless-constructor': 'off',
|
|
31
|
+
|
|
32
|
+
camelcase: 'off',
|
|
33
|
+
'@typescript-eslint/naming-convention': [
|
|
34
|
+
'error',
|
|
35
|
+
{
|
|
36
|
+
selector: 'variable',
|
|
37
|
+
format: ['camelCase', 'PascalCase', 'UPPER_CASE'],
|
|
38
|
+
},
|
|
39
|
+
// Allow camelCase functions (23.2), and PascalCase functions (23.8)
|
|
40
|
+
{
|
|
41
|
+
selector: 'function',
|
|
42
|
+
format: ['camelCase', 'PascalCase'],
|
|
43
|
+
},
|
|
44
|
+
{
|
|
45
|
+
selector: 'typeLike',
|
|
46
|
+
format: ['PascalCase'],
|
|
47
|
+
},
|
|
48
|
+
],
|
|
49
|
+
|
|
50
|
+
'dot-notation': 'off',
|
|
51
|
+
'@typescript-eslint/dot-notation': ['error', { allowKeywords: true }],
|
|
52
|
+
'no-unused-expressions': 'off',
|
|
53
|
+
'@typescript-eslint/no-unused-expressions': [
|
|
54
|
+
'error', {
|
|
55
|
+
allowShortCircuit: false,
|
|
56
|
+
allowTernary: false,
|
|
57
|
+
allowTaggedTemplates: false,
|
|
58
|
+
},
|
|
59
|
+
],
|
|
60
|
+
'no-unused-vars': 'off',
|
|
61
|
+
'@typescript-eslint/no-unused-vars': ['error', { vars: 'all', args: 'after-used', ignoreRestSiblings: true }],
|
|
62
|
+
'require-await': 'off',
|
|
63
|
+
'@typescript-eslint/require-await': 'off',
|
|
64
|
+
'no-return-await': 'off',
|
|
65
|
+
'@typescript-eslint/return-await': ['error', 'in-try-catch'],
|
|
66
|
+
|
|
21
67
|
'@typescript-eslint/method-signature-style': ['error', 'property'],
|
|
22
68
|
'@typescript-eslint/restrict-template-expressions': 'off',
|
|
23
69
|
'@typescript-eslint/consistent-type-imports': 'error',
|
|
@@ -30,7 +76,7 @@ const config = [
|
|
|
30
76
|
'@typescript-eslint/prefer-optional-chain': 'error',
|
|
31
77
|
'@typescript-eslint/prefer-nullish-coalescing': 'error',
|
|
32
78
|
'@typescript-eslint/prefer-string-starts-ends-with': 'error',
|
|
33
|
-
'@
|
|
79
|
+
'@stylistic/type-annotation-spacing': 'error',
|
|
34
80
|
'@typescript-eslint/consistent-type-definitions': ['error', 'type'],
|
|
35
81
|
},
|
|
36
82
|
},
|
package/typescript-svelte.js
CHANGED
|
@@ -72,8 +72,7 @@ export default [
|
|
|
72
72
|
'svelte/html-closing-bracket-spacing': 'error',
|
|
73
73
|
'svelte/html-quotes': 'error',
|
|
74
74
|
'svelte/indent': 'error',
|
|
75
|
-
indent: 'off',
|
|
76
|
-
'@typescript-eslint/indent': 'off',
|
|
75
|
+
'@stylistic/indent': 'off',
|
|
77
76
|
'svelte/max-attributes-per-line': ['error', { singleline: 4 }],
|
|
78
77
|
'svelte/mustache-spacing': 'error',
|
|
79
78
|
'svelte/no-extra-reactive-curlies': 'error',
|