@xaliksss/eslint-config 3.0.1 → 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/LICENSE +21 -21
- package/dist/index.d.ts +2 -0
- package/dist/index.js +63 -0
- package/dist/rules/eslint.d.ts +2 -0
- package/dist/rules/eslint.js +207 -0
- package/dist/rules/import.d.ts +2 -0
- package/dist/rules/import.js +57 -0
- package/dist/rules/stylistic.d.ts +2 -0
- package/dist/rules/stylistic.js +130 -0
- package/dist/rules/typescript.d.ts +3 -0
- package/dist/rules/typescript.js +219 -0
- package/package.json +34 -30
- package/eslint.config.js +0 -349
- package/index.js +0 -3
package/LICENSE
CHANGED
|
@@ -1,21 +1,21 @@
|
|
|
1
|
-
MIT License
|
|
2
|
-
|
|
3
|
-
Copyright (c) 2024 Xaliks
|
|
4
|
-
|
|
5
|
-
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
-
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
-
in the Software without restriction, including without limitation the rights
|
|
8
|
-
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
-
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
-
furnished to do so, subject to the following conditions:
|
|
11
|
-
|
|
12
|
-
The above copyright notice and this permission notice shall be included in all
|
|
13
|
-
copies or substantial portions of the Software.
|
|
14
|
-
|
|
15
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
-
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
-
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
-
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
-
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
-
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
-
SOFTWARE.
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2024 Xaliks
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/dist/index.d.ts
ADDED
package/dist/index.js
ADDED
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
import { defineConfig } from 'eslint/config';
|
|
2
|
+
import globals from "globals";
|
|
3
|
+
import tseslint from "typescript-eslint";
|
|
4
|
+
import stylisticPlugin from "@stylistic/eslint-plugin";
|
|
5
|
+
import importPlugin from "eslint-plugin-import";
|
|
6
|
+
import { eslintRules } from "./rules/eslint.js";
|
|
7
|
+
import { stylisticRules } from "./rules/stylistic.js";
|
|
8
|
+
import { importRules } from "./rules/import.js";
|
|
9
|
+
import { typescriptRules, typescriptTypeAwareRules } from "./rules/typescript.js";
|
|
10
|
+
const IGNORES = [
|
|
11
|
+
"**/dist/**",
|
|
12
|
+
"**/node_modules/**",
|
|
13
|
+
];
|
|
14
|
+
const JS_FILES = ["**/*.js", "**/*.mjs", "**/*.cjs", "**/*.jsx"];
|
|
15
|
+
const TS_FILES = ["**/*.ts", "**/*.mts", "**/*.cts", "**/*.tsx"];
|
|
16
|
+
export default defineConfig({
|
|
17
|
+
ignores: IGNORES,
|
|
18
|
+
},
|
|
19
|
+
// Общие правила для JS и TS
|
|
20
|
+
{
|
|
21
|
+
files: [...JS_FILES, ...TS_FILES],
|
|
22
|
+
languageOptions: {
|
|
23
|
+
ecmaVersion: "latest",
|
|
24
|
+
sourceType: "module",
|
|
25
|
+
globals: {
|
|
26
|
+
...globals.node,
|
|
27
|
+
NodeJS: "off",
|
|
28
|
+
},
|
|
29
|
+
},
|
|
30
|
+
plugins: {
|
|
31
|
+
"@stylistic": stylisticPlugin,
|
|
32
|
+
import: importPlugin,
|
|
33
|
+
},
|
|
34
|
+
rules: {
|
|
35
|
+
...eslintRules,
|
|
36
|
+
...stylisticRules,
|
|
37
|
+
...importRules,
|
|
38
|
+
},
|
|
39
|
+
},
|
|
40
|
+
// overrides для TS
|
|
41
|
+
{
|
|
42
|
+
files: TS_FILES,
|
|
43
|
+
languageOptions: {
|
|
44
|
+
parser: tseslint.parser,
|
|
45
|
+
parserOptions: { project: false },
|
|
46
|
+
},
|
|
47
|
+
plugins: {
|
|
48
|
+
"@typescript-eslint": tseslint.plugin,
|
|
49
|
+
},
|
|
50
|
+
rules: typescriptRules,
|
|
51
|
+
},
|
|
52
|
+
// type-aware правила
|
|
53
|
+
{
|
|
54
|
+
files: TS_FILES,
|
|
55
|
+
languageOptions: {
|
|
56
|
+
parser: tseslint.parser,
|
|
57
|
+
parserOptions: { project: true },
|
|
58
|
+
},
|
|
59
|
+
plugins: {
|
|
60
|
+
"@typescript-eslint": tseslint.plugin,
|
|
61
|
+
},
|
|
62
|
+
rules: typescriptTypeAwareRules,
|
|
63
|
+
});
|
|
@@ -0,0 +1,207 @@
|
|
|
1
|
+
export const eslintRules = {
|
|
2
|
+
"array-callback-return": "error",
|
|
3
|
+
"constructor-super": "error", // [TS]
|
|
4
|
+
"for-direction": "off", // стандартизированное направление for
|
|
5
|
+
"getter-return": "error", // [TS]
|
|
6
|
+
"no-async-promise-executor": "error",
|
|
7
|
+
"no-await-in-loop": "off", // await внутри циклов
|
|
8
|
+
"no-class-assign": "error", // [TS]
|
|
9
|
+
"no-compare-neg-zero": "error",
|
|
10
|
+
"no-cond-assign": "error",
|
|
11
|
+
"no-const-assign": "error", // [TS]
|
|
12
|
+
"no-constant-binary-expression": "error",
|
|
13
|
+
"no-constant-condition": "error",
|
|
14
|
+
"no-constructor-return": "error",
|
|
15
|
+
"no-control-regex": "off", // запрещает делать regex с контрол-символами,
|
|
16
|
+
"no-debugger": "error",
|
|
17
|
+
"no-dupe-args": "error", // [TS]
|
|
18
|
+
"no-dupe-class-members": "error", // [TS]
|
|
19
|
+
"no-dupe-else-if": "error",
|
|
20
|
+
"no-dupe-keys": "error", // [TS]
|
|
21
|
+
"no-duplicate-case": "error",
|
|
22
|
+
"no-duplicate-imports": "error",
|
|
23
|
+
"no-empty-character-class": "error",
|
|
24
|
+
"no-empty-pattern": "error",
|
|
25
|
+
"no-ex-assign": "error",
|
|
26
|
+
"no-fallthrough": "error",
|
|
27
|
+
"no-func-assign": "error", // [TS]
|
|
28
|
+
"no-import-assign": "error", // [TS]
|
|
29
|
+
"no-inner-declarations": "error", // спорно но можно. Объявление функций внутри { ... }
|
|
30
|
+
"no-invalid-regexp": "error",
|
|
31
|
+
"no-irregular-whitespace": "error",
|
|
32
|
+
"no-loss-of-precision": "error",
|
|
33
|
+
"no-misleading-character-class": "error",
|
|
34
|
+
"no-new-native-nonconstructor": "error", // [TS]
|
|
35
|
+
"no-obj-calls": "error", // [TS]
|
|
36
|
+
"no-promise-executor-return": "error",
|
|
37
|
+
"no-prototype-builtins": "error",
|
|
38
|
+
"no-self-assign": "error",
|
|
39
|
+
"no-self-compare": "error",
|
|
40
|
+
"no-setter-return": "error", // [TS]
|
|
41
|
+
"no-sparse-arrays": "error",
|
|
42
|
+
"no-template-curly-in-string": "error",
|
|
43
|
+
"no-this-before-super": "error", // [TS]
|
|
44
|
+
"no-unassigned-vars": "error",
|
|
45
|
+
"no-undef": "error", // [TS]
|
|
46
|
+
"no-unexpected-multiline": "error",
|
|
47
|
+
"no-unmodified-loop-condition": "error",
|
|
48
|
+
"no-unreachable": "error", // [TS]
|
|
49
|
+
"no-unreachable-loop": "error",
|
|
50
|
+
"no-unsafe-finally": "error",
|
|
51
|
+
"no-unsafe-negation": "error", // [TS]
|
|
52
|
+
"no-unsafe-optional-chaining": "error",
|
|
53
|
+
"no-unused-private-class-members": "error",
|
|
54
|
+
"no-unused-vars": "error",
|
|
55
|
+
"no-use-before-define": ["error", {
|
|
56
|
+
functions: false,
|
|
57
|
+
classes: false,
|
|
58
|
+
variables: true,
|
|
59
|
+
enums: false,
|
|
60
|
+
typedefs: false,
|
|
61
|
+
ignoreTypeReferences: true,
|
|
62
|
+
}],
|
|
63
|
+
"no-useless-assignment": "error",
|
|
64
|
+
"no-useless-backreference": "error",
|
|
65
|
+
"require-atomic-updates": "error",
|
|
66
|
+
"use-isnan": "error",
|
|
67
|
+
"valid-typeof": "error",
|
|
68
|
+
"no-ternary": "off", // Отключает тернарные операторы
|
|
69
|
+
"no-throw-literal": "error",
|
|
70
|
+
"no-undef-init": "error",
|
|
71
|
+
"no-undefined": "off", // Отключает использование undefined
|
|
72
|
+
"no-underscore-dangle": "off", // Отключает _ в переменных
|
|
73
|
+
"no-unneeded-ternary": "error",
|
|
74
|
+
"no-unused-expressions": "error",
|
|
75
|
+
"no-unused-labels": "error",
|
|
76
|
+
"no-useless-call": "error",
|
|
77
|
+
"no-useless-catch": "error",
|
|
78
|
+
"no-useless-computed-key": "error",
|
|
79
|
+
"no-useless-concat": "error",
|
|
80
|
+
"no-useless-constructor": "error",
|
|
81
|
+
"no-useless-escape": "error",
|
|
82
|
+
"no-useless-rename": "error",
|
|
83
|
+
"no-useless-return": "error",
|
|
84
|
+
"no-var": "error",
|
|
85
|
+
"no-void": ["error", { allowAsStatement: true }],
|
|
86
|
+
"no-warning-comments": "off", // Запрещает писать TODO в комментариях
|
|
87
|
+
"no-with": "error",
|
|
88
|
+
"object-shorthand": "error",
|
|
89
|
+
"one-var": ["error", "never"],
|
|
90
|
+
"operator-assignment": "error",
|
|
91
|
+
"prefer-arrow-callback": "error",
|
|
92
|
+
"prefer-const": "error",
|
|
93
|
+
"prefer-destructuring": ["error", { array: true, object: false }],
|
|
94
|
+
"prefer-exponentiation-operator": "off", // Вместо Math.pow() использовать **. Без разницы
|
|
95
|
+
"prefer-named-capture-group": "warn", // Использовать названия групп в regex. желательно, но не обязательно
|
|
96
|
+
"prefer-numeric-literals": "error",
|
|
97
|
+
"prefer-object-has-own": "error",
|
|
98
|
+
"prefer-object-spread": "error",
|
|
99
|
+
"prefer-promise-reject-errors": "error",
|
|
100
|
+
"prefer-regex-literals": "error",
|
|
101
|
+
"prefer-rest-params": "error",
|
|
102
|
+
"prefer-spread": "error",
|
|
103
|
+
"prefer-template": "error",
|
|
104
|
+
"preserve-caught-error": "off", // Нужно указывать cause в new Error
|
|
105
|
+
"radix": "off",
|
|
106
|
+
"require-await": "error",
|
|
107
|
+
"require-unicode-regexp": "off", // Обязательно указывать /u или /v в regex
|
|
108
|
+
"require-yield": "error",
|
|
109
|
+
"sort-imports": "off", // установлен другой плагин import
|
|
110
|
+
"sort-keys": "off",
|
|
111
|
+
"sort-vars": "error",
|
|
112
|
+
"strict": "off",
|
|
113
|
+
"symbol-description": "error",
|
|
114
|
+
"vars-on-top": "error",
|
|
115
|
+
"yoda": "error",
|
|
116
|
+
"unicode-bom": "error",
|
|
117
|
+
"accessor-pairs": "error", // Спорно, возможно удалится
|
|
118
|
+
"arrow-body-style": ["error", "as-needed", { requireReturnForObjectLiteral: true }],
|
|
119
|
+
"block-scoped-var": "error",
|
|
120
|
+
"camelcase": "off", // есть naming-convention с более детальной настройкой
|
|
121
|
+
"capitalized-comments": "warn",
|
|
122
|
+
"class-methods-use-this": "off",
|
|
123
|
+
"complexity": "off",
|
|
124
|
+
"consistent-return": "off",
|
|
125
|
+
"consistent-this": "off",
|
|
126
|
+
"curly": ["error", "multi-line"],
|
|
127
|
+
"default-case": "off",
|
|
128
|
+
"default-case-last": "error",
|
|
129
|
+
"default-param-last": "error",
|
|
130
|
+
"dot-notation": "error",
|
|
131
|
+
"eqeqeq": "error",
|
|
132
|
+
"func-name-matching": "error",
|
|
133
|
+
"func-names": "off",
|
|
134
|
+
"func-style": ["error", "declaration", { allowArrowFunctions: true }],
|
|
135
|
+
"grouped-accessor-pairs": "error",
|
|
136
|
+
"guard-for-in": "off",
|
|
137
|
+
"id-denylist": "off",
|
|
138
|
+
"id-length": "off",
|
|
139
|
+
"id-match": "off",
|
|
140
|
+
"init-declarations": "off",
|
|
141
|
+
"logical-assignment-operators": ["error", "always", { enforceForIfStatements: true }],
|
|
142
|
+
"max-classes-per-file": "off",
|
|
143
|
+
"max-depth": ["error", { max: 4 }],
|
|
144
|
+
"max-lines": "off",
|
|
145
|
+
"max-lines-per-function": "off",
|
|
146
|
+
"max-nested-callbacks": ["error", { max: 3 }],
|
|
147
|
+
"max-params": ["error", { max: 6 }],
|
|
148
|
+
"max-statements": "off",
|
|
149
|
+
"new-cap": "off",
|
|
150
|
+
"no-alert": "error",
|
|
151
|
+
"no-array-constructor": "error",
|
|
152
|
+
"no-bitwise": "off",
|
|
153
|
+
"no-caller": "error",
|
|
154
|
+
"no-case-declarations": "error",
|
|
155
|
+
"no-console": "off",
|
|
156
|
+
"no-continue": "off",
|
|
157
|
+
"no-delete-var": "error",
|
|
158
|
+
"no-div-regex": "off",
|
|
159
|
+
"no-else-return": "error",
|
|
160
|
+
"no-empty": ["error", { allowEmptyCatch: true }],
|
|
161
|
+
"no-empty-function": ["error", { allow: ["arrowFunctions"] }],
|
|
162
|
+
"no-empty-static-block": "error",
|
|
163
|
+
"no-eq-null": "error",
|
|
164
|
+
"no-eval": "error",
|
|
165
|
+
"no-extend-native": "error",
|
|
166
|
+
"no-extra-bind": "error",
|
|
167
|
+
"no-extra-boolean-cast": "error",
|
|
168
|
+
"no-extra-label": "error",
|
|
169
|
+
"no-global-assign": "error",
|
|
170
|
+
"no-implicit-coercion": "error",
|
|
171
|
+
"no-implicit-globals": "off",
|
|
172
|
+
"no-implied-eval": "error",
|
|
173
|
+
"no-inline-comments": "off",
|
|
174
|
+
"no-invalid-this": "error", // [TS]
|
|
175
|
+
"no-iterator": "error",
|
|
176
|
+
"no-label-var": "error",
|
|
177
|
+
"no-labels": "error",
|
|
178
|
+
"no-lone-blocks": "error",
|
|
179
|
+
"no-lonely-if": "error",
|
|
180
|
+
"no-loop-func": "off",
|
|
181
|
+
"no-magic-numbers": "off",
|
|
182
|
+
"no-multi-assign": "error",
|
|
183
|
+
"no-multi-str": "error",
|
|
184
|
+
"no-negated-condition": "error",
|
|
185
|
+
"no-nested-ternary": "error",
|
|
186
|
+
"no-new": "off", // new без обозначения. const a = new A(); да, но просто new A() нет
|
|
187
|
+
"no-new-func": "error",
|
|
188
|
+
"no-new-wrappers": "error",
|
|
189
|
+
"no-nonoctal-decimal-escape": "error",
|
|
190
|
+
"no-object-constructor": "error",
|
|
191
|
+
"no-octal": "error",
|
|
192
|
+
"no-octal-escape": "error",
|
|
193
|
+
"no-param-reassign": "error",
|
|
194
|
+
"no-plusplus": "off",
|
|
195
|
+
"no-proto": "error",
|
|
196
|
+
"no-redeclare": "error", // [TS]
|
|
197
|
+
"no-regex-spaces": "error",
|
|
198
|
+
"no-restricted-exports": "off",
|
|
199
|
+
"no-restricted-globals": "off",
|
|
200
|
+
"no-restricted-imports": "off",
|
|
201
|
+
"no-restricted-properties": "off",
|
|
202
|
+
"no-return-assign": "error",
|
|
203
|
+
"no-script-url": "error",
|
|
204
|
+
"no-sequences": "error",
|
|
205
|
+
"no-shadow": "error",
|
|
206
|
+
"no-shadow-restricted-names": "error",
|
|
207
|
+
};
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import { Linter } from "eslint";
|
|
2
|
+
export const importRules = {
|
|
3
|
+
"import/export": "error",
|
|
4
|
+
"import/no-deprecated": "error",
|
|
5
|
+
"import/no-empty-named-blocks": "error",
|
|
6
|
+
"import/no-extraneous-dependencies": "error",
|
|
7
|
+
"import/no-mutable-exports": "error",
|
|
8
|
+
"import/no-named-as-default-member": "error",
|
|
9
|
+
"import/no-unused-modules": "error",
|
|
10
|
+
"import/no-amd": "error",
|
|
11
|
+
"import/no-commonjs": "error",
|
|
12
|
+
"import/no-import-module-exports": "error",
|
|
13
|
+
"import/no-nodejs-modules": "off",
|
|
14
|
+
"import/unambiguous": "error",
|
|
15
|
+
"import/default": "error", // Под вопросом
|
|
16
|
+
"import/enforce-node-protocol-usage": ["error", "always"],
|
|
17
|
+
"import/named": "error", // Под вопросом
|
|
18
|
+
"import/namespace": "error",
|
|
19
|
+
"import/no-absolute-path": "error",
|
|
20
|
+
"import/no-cycle": ["error", {
|
|
21
|
+
maxDepth: 2, // Возможно придется обновить на 1
|
|
22
|
+
ignoreExternal: true,
|
|
23
|
+
allowUnsafeDynamicCyclicDependency: false
|
|
24
|
+
}],
|
|
25
|
+
"import/no-dynamic-require": "error",
|
|
26
|
+
"import/no-internal-modules": "off",
|
|
27
|
+
"import/no-relative-packages": "off",
|
|
28
|
+
"import/no-relative-parent-imports": "off",
|
|
29
|
+
"import/no-self-import": "error",
|
|
30
|
+
"import/no-unresolved": "off",
|
|
31
|
+
"import/no-useless-path-segments": "error",
|
|
32
|
+
"import/no-webpack-loader-syntax": "error",
|
|
33
|
+
"import/consistent-type-specifier-style": ["error", "prefer-top-level"],
|
|
34
|
+
"import/dynamic-import-chunkname": "off",
|
|
35
|
+
"import/exports-last": "off",
|
|
36
|
+
"import/extensions": "off",
|
|
37
|
+
"import/first": "error",
|
|
38
|
+
"import/group-exports": "off",
|
|
39
|
+
"import/max-dependencies": "off",
|
|
40
|
+
"import/newline-after-import": ["error", { count: 1, considerComments: false }],
|
|
41
|
+
"import/no-anonymous-default-export": "error",
|
|
42
|
+
"import/no-default-export": "off",
|
|
43
|
+
"import/no-duplicates": "error",
|
|
44
|
+
"import/no-named-default": "error",
|
|
45
|
+
"import/no-named-export": "off",
|
|
46
|
+
"import/no-namespace": "off",
|
|
47
|
+
"import/no-unassigned-import": "off",
|
|
48
|
+
"import/order": ["error",
|
|
49
|
+
{
|
|
50
|
+
groups: ["builtin", "external", "type", "internal", "parent", "sibling", "index", "object"],
|
|
51
|
+
"newlines-between": "always",
|
|
52
|
+
named: true,
|
|
53
|
+
alphabetize: { order: "asc" },
|
|
54
|
+
},
|
|
55
|
+
],
|
|
56
|
+
"import/prefer-default-export": "off",
|
|
57
|
+
};
|
|
@@ -0,0 +1,130 @@
|
|
|
1
|
+
export const stylisticRules = {
|
|
2
|
+
"@stylistic/array-bracket-newline": ["error", "consistent"],
|
|
3
|
+
"@stylistic/array-bracket-spacing": "error",
|
|
4
|
+
"@stylistic/array-element-newline": ["error", "consistent"],
|
|
5
|
+
"@stylistic/arrow-parens": "error",
|
|
6
|
+
"@stylistic/arrow-spacing": "error",
|
|
7
|
+
"@stylistic/block-spacing": "error",
|
|
8
|
+
"@stylistic/brace-style": "error",
|
|
9
|
+
"@stylistic/comma-dangle": ["error", "always-multiline"],
|
|
10
|
+
"@stylistic/comma-spacing": "error",
|
|
11
|
+
"@stylistic/comma-style": "error",
|
|
12
|
+
"@stylistic/computed-property-spacing": "error",
|
|
13
|
+
"@stylistic/curly-newline": ["error", { consistent: true }],
|
|
14
|
+
"@stylistic/dot-location": ["error", "property"],
|
|
15
|
+
"@stylistic/eol-last": "error",
|
|
16
|
+
"@stylistic/function-call-argument-newline": ["error", "consistent"],
|
|
17
|
+
"@stylistic/function-call-spacing": "error",
|
|
18
|
+
"@stylistic/function-paren-newline": ["error", "consistent"],
|
|
19
|
+
"@stylistic/generator-star-spacing": "error",
|
|
20
|
+
"@stylistic/implicit-arrow-linebreak": "error",
|
|
21
|
+
"@stylistic/indent": ["error", "tab"],
|
|
22
|
+
"@stylistic/indent-binary-ops": ["error", 1],
|
|
23
|
+
// JSX пока игнорирую. потом сделаю
|
|
24
|
+
"@stylistic/jsx-child-element-spacing": "off",
|
|
25
|
+
"@stylistic/jsx-closing-bracket-location": "off",
|
|
26
|
+
"@stylistic/jsx-closing-tag-location": "off",
|
|
27
|
+
"@stylistic/jsx-curly-brace-presence": "off",
|
|
28
|
+
"@stylistic/jsx-curly-newline": "off",
|
|
29
|
+
"@stylistic/jsx-curly-spacing": "off",
|
|
30
|
+
"@stylistic/jsx-equals-spacing": "off",
|
|
31
|
+
"@stylistic/jsx-first-prop-new-line": "off",
|
|
32
|
+
"@stylistic/jsx-function-call-newline": "off",
|
|
33
|
+
"@stylistic/jsx-indent-props": "off",
|
|
34
|
+
"@stylistic/jsx-max-props-per-line": "off",
|
|
35
|
+
"@stylistic/jsx-newline": "off",
|
|
36
|
+
"@stylistic/jsx-one-expression-per-line": "off",
|
|
37
|
+
"@stylistic/jsx-pascal-case": "off",
|
|
38
|
+
"@stylistic/jsx-props-style": "off",
|
|
39
|
+
"@stylistic/jsx-quotes": "off",
|
|
40
|
+
"@stylistic/jsx-self-closing-comp": "off",
|
|
41
|
+
"@stylistic/jsx-shorthand-boolean": "off",
|
|
42
|
+
"@stylistic/jsx-shorthand-fragment": "off",
|
|
43
|
+
"@stylistic/jsx-tag-spacing": "off",
|
|
44
|
+
"@stylistic/jsx-wrap-multilines": "off",
|
|
45
|
+
"@stylistic/key-spacing": "error",
|
|
46
|
+
"@stylistic/keyword-spacing": "error",
|
|
47
|
+
"@stylistic/line-comment-position": "off", // Без разницы где ставить комментарий
|
|
48
|
+
"@stylistic/linebreak-style": ["error", "unix"],
|
|
49
|
+
"@stylistic/lines-around-comment": "off", // Без разницы где ставить комментарий
|
|
50
|
+
"@stylistic/lines-between-class-members": "error",
|
|
51
|
+
"@stylistic/max-len": ["error", { code: 120, tabWidth: 1 }],
|
|
52
|
+
"@stylistic/max-statements-per-line": ["error", { max: 1 }],
|
|
53
|
+
"@stylistic/member-delimiter-style": ["error", {
|
|
54
|
+
multiline: {
|
|
55
|
+
delimiter: "semi",
|
|
56
|
+
requireLast: true,
|
|
57
|
+
},
|
|
58
|
+
singleline: {
|
|
59
|
+
delimiter: "semi",
|
|
60
|
+
requireLast: false,
|
|
61
|
+
},
|
|
62
|
+
}],
|
|
63
|
+
"@stylistic/multiline-comment-style": "off",
|
|
64
|
+
"@stylistic/multiline-ternary": "off",
|
|
65
|
+
"@stylistic/new-parens": "error",
|
|
66
|
+
"@stylistic/newline-per-chained-call": "off",
|
|
67
|
+
"@stylistic/no-confusing-arrow": "off",
|
|
68
|
+
"@stylistic/no-extra-parens": ["error", "all", {
|
|
69
|
+
returnAssign: false, // return (a = b)
|
|
70
|
+
nestedBinaryExpressions: false, // (a || b) && c
|
|
71
|
+
ternaryOperandBinaryExpressions: false, // (a && b) ? foo : bar;
|
|
72
|
+
nestedConditionalExpressions: false, // (a ? b : c) ? d : e
|
|
73
|
+
ignoredNodes: [
|
|
74
|
+
"ArrowFunctionExpression[body.type=ConditionalExpression]", // x => (a ? b : c)
|
|
75
|
+
"SpreadElement[argument.type=ConditionalExpression]", // ...(a ? [1, 2, 3] : []),
|
|
76
|
+
"SpreadElement[argument.type=LogicalExpression]", // ...(isSummer && { watermelon: 30 }),
|
|
77
|
+
"SpreadElement[argument.type=AwaitExpression]", // ...(await promiseArray)
|
|
78
|
+
],
|
|
79
|
+
}],
|
|
80
|
+
"@stylistic/no-extra-semi": "error",
|
|
81
|
+
"@stylistic/no-floating-decimal": "error",
|
|
82
|
+
"@stylistic/no-mixed-operators": ["error", {
|
|
83
|
+
groups: [["&&", "||", "?:"]],
|
|
84
|
+
allowSamePrecedence: true,
|
|
85
|
+
}],
|
|
86
|
+
"@stylistic/no-mixed-spaces-and-tabs": "error",
|
|
87
|
+
"@stylistic/no-multi-spaces": "error",
|
|
88
|
+
"@stylistic/no-multiple-empty-lines": ["error", { max: 1, maxBOF: 0, maxEOF: 1 }],
|
|
89
|
+
"@stylistic/no-tabs": "off",
|
|
90
|
+
"@stylistic/no-trailing-spaces": ["error", { ignoreComments: true }],
|
|
91
|
+
"@stylistic/no-whitespace-before-property": "error",
|
|
92
|
+
"@stylistic/nonblock-statement-body-position": "error",
|
|
93
|
+
"@stylistic/object-curly-newline": "error",
|
|
94
|
+
"@stylistic/object-curly-spacing": "error",
|
|
95
|
+
"@stylistic/object-property-newline": ["error", { allowAllPropertiesOnSameLine: true }],
|
|
96
|
+
"@stylistic/one-var-declaration-per-line": "off",
|
|
97
|
+
"@stylistic/operator-linebreak": ["error", "after", {
|
|
98
|
+
overrides: {
|
|
99
|
+
"?": "before",
|
|
100
|
+
":": "before",
|
|
101
|
+
},
|
|
102
|
+
}],
|
|
103
|
+
"@stylistic/padded-blocks": ["error", "never"],
|
|
104
|
+
"@stylistic/padding-line-between-statements": "off", // Вообще шикарное правило, нужно долго настраивать, но мне лень
|
|
105
|
+
"@stylistic/quote-props": ["error", "as-needed"],
|
|
106
|
+
"@stylistic/quotes": ["error", "double"],
|
|
107
|
+
"@stylistic/rest-spread-spacing": ["error", "never"],
|
|
108
|
+
"@stylistic/semi": "error",
|
|
109
|
+
"@stylistic/semi-spacing": "error",
|
|
110
|
+
"@stylistic/semi-style": "error",
|
|
111
|
+
"@stylistic/space-before-blocks": "error",
|
|
112
|
+
"@stylistic/space-before-function-paren": ["error", {
|
|
113
|
+
anonymous: "always", // function () {}
|
|
114
|
+
named: "never", // function foo() {}
|
|
115
|
+
asyncArrow: "always", // async () => {}
|
|
116
|
+
}],
|
|
117
|
+
"@stylistic/space-in-parens": ["error", "never"],
|
|
118
|
+
"@stylistic/space-infix-ops": "error",
|
|
119
|
+
"@stylistic/space-unary-ops": "error",
|
|
120
|
+
"@stylistic/spaced-comment": "error",
|
|
121
|
+
"@stylistic/switch-colon-spacing": "error",
|
|
122
|
+
"@stylistic/template-curly-spacing": "error",
|
|
123
|
+
"@stylistic/template-tag-spacing": ["error", "never"],
|
|
124
|
+
"@stylistic/type-annotation-spacing": "error",
|
|
125
|
+
"@stylistic/type-generic-spacing": "error",
|
|
126
|
+
"@stylistic/type-named-tuple-spacing": "error",
|
|
127
|
+
"@stylistic/wrap-iife": ["error", "inside"],
|
|
128
|
+
"@stylistic/wrap-regex": "off",
|
|
129
|
+
"@stylistic/yield-star-spacing": "error",
|
|
130
|
+
};
|
|
@@ -0,0 +1,219 @@
|
|
|
1
|
+
import { Linter } from "eslint";
|
|
2
|
+
export const typescriptRules = {
|
|
3
|
+
// TypeScript знает лучше
|
|
4
|
+
"constructor-super": "off",
|
|
5
|
+
"getter-return": "off",
|
|
6
|
+
"no-class-assign": "off",
|
|
7
|
+
"no-const-assign": "off",
|
|
8
|
+
"no-dupe-args": "off",
|
|
9
|
+
"no-dupe-class-members": "off",
|
|
10
|
+
"no-dupe-keys": "off",
|
|
11
|
+
"no-func-assign": "off",
|
|
12
|
+
"no-import-assign": "off",
|
|
13
|
+
"no-new-native-nonconstructor": "off",
|
|
14
|
+
"no-obj-calls": "off",
|
|
15
|
+
"no-setter-return": "off",
|
|
16
|
+
"no-this-before-super": "off",
|
|
17
|
+
"no-undef": "off",
|
|
18
|
+
"no-unreachable": "off", // allowUnreachableCode: false
|
|
19
|
+
"no-unsafe-negation": "off",
|
|
20
|
+
"no-invalid-this": "off",
|
|
21
|
+
"no-redeclare": "off",
|
|
22
|
+
"@typescript-eslint/adjacent-overload-signatures": "error",
|
|
23
|
+
"@typescript-eslint/array-type": ["error", { default: "array-simple" }],
|
|
24
|
+
"@typescript-eslint/ban-ts-comment": ["error", { "ts-expect-error": "allow-with-description" }],
|
|
25
|
+
"@typescript-eslint/ban-tslint-comment": "error",
|
|
26
|
+
"@typescript-eslint/class-literal-property-style": "error",
|
|
27
|
+
"@typescript-eslint/class-methods-use-this": "off", // есть class-methods-use-this
|
|
28
|
+
"@typescript-eslint/consistent-generic-constructors": ["error", "constructor"],
|
|
29
|
+
"@typescript-eslint/consistent-indexed-object-style": "off", // пока не пофиксят баги
|
|
30
|
+
"@typescript-eslint/consistent-type-assertions": "error",
|
|
31
|
+
"@typescript-eslint/consistent-type-definitions": "error",
|
|
32
|
+
"@typescript-eslint/consistent-type-imports": "error",
|
|
33
|
+
"@typescript-eslint/default-param-last": "off", // есть default-param-last
|
|
34
|
+
"@typescript-eslint/explicit-function-return-type": "off",
|
|
35
|
+
"@typescript-eslint/explicit-member-accessibility": "off",
|
|
36
|
+
"@typescript-eslint/explicit-module-boundary-types": "off",
|
|
37
|
+
"@typescript-eslint/init-declarations": "off", // есть init-declarations
|
|
38
|
+
"@typescript-eslint/max-params": "off", // есть max-params
|
|
39
|
+
"@typescript-eslint/member-ordering": "error", // Лень настраивать
|
|
40
|
+
"@typescript-eslint/method-signature-style": ["error", "method"],
|
|
41
|
+
"@typescript-eslint/no-array-constructor": "off", // есть no-array-constructor
|
|
42
|
+
"@typescript-eslint/no-confusing-non-null-assertion": "error",
|
|
43
|
+
"@typescript-eslint/no-dupe-class-members": "off", // оно в TS вообще не нужно
|
|
44
|
+
"@typescript-eslint/no-duplicate-enum-values": "error",
|
|
45
|
+
"@typescript-eslint/no-dynamic-delete": "error",
|
|
46
|
+
"@typescript-eslint/no-empty-function": "off", // есть no-empty-function
|
|
47
|
+
"@typescript-eslint/no-empty-object-type": "error",
|
|
48
|
+
"@typescript-eslint/no-explicit-any": "error",
|
|
49
|
+
"@typescript-eslint/no-extra-non-null-assertion": "error",
|
|
50
|
+
"@typescript-eslint/no-extraneous-class": "off",
|
|
51
|
+
"@typescript-eslint/no-import-type-side-effects": "off", // есть import/consistent-type-specifier-style
|
|
52
|
+
"@typescript-eslint/no-inferrable-types": "error",
|
|
53
|
+
"@typescript-eslint/no-invalid-this": "off", // есть no-invalid-this
|
|
54
|
+
"@typescript-eslint/no-invalid-void-type": ["error", { allowAsThisParameter: true }],
|
|
55
|
+
"@typescript-eslint/no-loop-func": "off", // есть no-loop-func
|
|
56
|
+
"@typescript-eslint/no-magic-numbers": "off", // есть no-magic-numbers
|
|
57
|
+
"@typescript-eslint/no-misused-new": "error",
|
|
58
|
+
"@typescript-eslint/no-namespace": "error",
|
|
59
|
+
"@typescript-eslint/no-non-null-asserted-nullish-coalescing": "error",
|
|
60
|
+
"@typescript-eslint/no-non-null-asserted-optional-chain": "error",
|
|
61
|
+
"@typescript-eslint/no-non-null-assertion": "off",
|
|
62
|
+
"@typescript-eslint/no-redeclare": "off", // TS сам справится
|
|
63
|
+
"@typescript-eslint/no-require-imports": "error",
|
|
64
|
+
"@typescript-eslint/no-restricted-imports": "off", // есть no-restricted-imports
|
|
65
|
+
"@typescript-eslint/no-restricted-types": "off",
|
|
66
|
+
"@typescript-eslint/no-shadow": "off", // есть no-shadow
|
|
67
|
+
"@typescript-eslint/no-this-alias": "error",
|
|
68
|
+
"@typescript-eslint/no-unnecessary-parameter-property-assignment": "error",
|
|
69
|
+
"@typescript-eslint/no-unnecessary-type-constraint": "error",
|
|
70
|
+
"@typescript-eslint/no-unsafe-declaration-merging": "error",
|
|
71
|
+
"@typescript-eslint/no-unsafe-function-type": "error",
|
|
72
|
+
"@typescript-eslint/no-unused-expressions": "off", // есть no-unused-expressions
|
|
73
|
+
"no-unused-private-class-members": "off",
|
|
74
|
+
"@typescript-eslint/no-unused-private-class-members": "error", // core еще не до конца нагнал
|
|
75
|
+
"no-unused-vars": "off",
|
|
76
|
+
"@typescript-eslint/no-unused-vars": "off", // core еще не до конца нагнал
|
|
77
|
+
"@typescript-eslint/no-use-before-define": "off", // есть no-use-before-define
|
|
78
|
+
"@typescript-eslint/no-useless-constructor": "off", // есть no-useless-constructor
|
|
79
|
+
"@typescript-eslint/no-useless-empty-export": "error",
|
|
80
|
+
"@typescript-eslint/no-wrapper-object-types": "error",
|
|
81
|
+
"@typescript-eslint/parameter-properties": ["error", { prefer: "parameter-property" }], // хз
|
|
82
|
+
"@typescript-eslint/prefer-as-const": "error",
|
|
83
|
+
"@typescript-eslint/prefer-enum-initializers": "off",
|
|
84
|
+
"@typescript-eslint/prefer-for-of": "error",
|
|
85
|
+
"@typescript-eslint/prefer-function-type": "error",
|
|
86
|
+
"@typescript-eslint/prefer-literal-enum-member": ["error", { allowBitwiseExpressions: true }],
|
|
87
|
+
"@typescript-eslint/prefer-namespace-keyword": "error",
|
|
88
|
+
"@typescript-eslint/triple-slash-reference": "error",
|
|
89
|
+
"@typescript-eslint/unified-signatures": "error",
|
|
90
|
+
};
|
|
91
|
+
export const typescriptTypeAwareRules = {
|
|
92
|
+
"@typescript-eslint/await-thenable": "error",
|
|
93
|
+
"@typescript-eslint/consistent-return": "off", // tsconfig.noImplicitReturns делает это лучше
|
|
94
|
+
"@typescript-eslint/consistent-type-exports": ["error", { fixMixedExportsWithInlineTypeSpecifier: false }], // import/consistent-type-specifier-style
|
|
95
|
+
"dot-notation": "off",
|
|
96
|
+
"@typescript-eslint/dot-notation": ["error", {
|
|
97
|
+
allowPrivateClassPropertyAccess: true,
|
|
98
|
+
allowProtectedClassPropertyAccess: true,
|
|
99
|
+
allowIndexSignaturePropertyAccess: true,
|
|
100
|
+
}],
|
|
101
|
+
"id-match": "off",
|
|
102
|
+
"id-denylist": "off",
|
|
103
|
+
"id-length": "off",
|
|
104
|
+
"no-underscore-dangle": "off",
|
|
105
|
+
camelcase: "off",
|
|
106
|
+
"@typescript-eslint/naming-convention": ["error",
|
|
107
|
+
{
|
|
108
|
+
selector: "default",
|
|
109
|
+
format: null,
|
|
110
|
+
leadingUnderscore: "allowSingleOrDouble",
|
|
111
|
+
},
|
|
112
|
+
{
|
|
113
|
+
selector: ["variableLike", "import"],
|
|
114
|
+
format: ["camelCase", "PascalCase"],
|
|
115
|
+
leadingUnderscore: "allowSingleOrDouble",
|
|
116
|
+
},
|
|
117
|
+
{
|
|
118
|
+
selector: ["method", "classProperty", "typeProperty"],
|
|
119
|
+
format: ["camelCase"],
|
|
120
|
+
leadingUnderscore: "allowSingleOrDouble",
|
|
121
|
+
},
|
|
122
|
+
{
|
|
123
|
+
selector: ["typeLike", "enumMember"],
|
|
124
|
+
format: ["PascalCase"],
|
|
125
|
+
leadingUnderscore: "forbid",
|
|
126
|
+
},
|
|
127
|
+
{
|
|
128
|
+
selector: "variable",
|
|
129
|
+
modifiers: ["const", "global"],
|
|
130
|
+
format: ["UPPER_CASE", "camelCase", "PascalCase"],
|
|
131
|
+
},
|
|
132
|
+
{
|
|
133
|
+
selector: "variable",
|
|
134
|
+
modifiers: ["destructured"],
|
|
135
|
+
format: null, // const { user_id, created_at } = await response.json();
|
|
136
|
+
},
|
|
137
|
+
],
|
|
138
|
+
"@typescript-eslint/no-array-delete": "error",
|
|
139
|
+
"@typescript-eslint/no-base-to-string": "error",
|
|
140
|
+
"@typescript-eslint/no-confusing-void-expression": ["error",
|
|
141
|
+
{
|
|
142
|
+
ignoreVoidReturningFunctions: true,
|
|
143
|
+
}
|
|
144
|
+
],
|
|
145
|
+
"@typescript-eslint/no-floating-promises": ["error", {
|
|
146
|
+
ignoreIIFE: true,
|
|
147
|
+
}],
|
|
148
|
+
"@typescript-eslint/no-for-in-array": "error",
|
|
149
|
+
"@typescript-eslint/no-implied-eval": "off", // есть no-implied-eval
|
|
150
|
+
"@typescript-eslint/no-meaningless-void-operator": "error",
|
|
151
|
+
"@typescript-eslint/no-misused-promises": ["error", {
|
|
152
|
+
checksVoidReturn: {
|
|
153
|
+
attributes: false, // JSX onClick={async () => ...}
|
|
154
|
+
},
|
|
155
|
+
}],
|
|
156
|
+
"@typescript-eslint/no-misused-spread": "error",
|
|
157
|
+
"@typescript-eslint/no-mixed-enums": "error",
|
|
158
|
+
"@typescript-eslint/no-redundant-type-constituents": "error",
|
|
159
|
+
"@typescript-eslint/no-unnecessary-boolean-literal-compare": "error",
|
|
160
|
+
"@typescript-eslint/no-unnecessary-condition": "error",
|
|
161
|
+
"@typescript-eslint/no-unnecessary-qualifier": "error",
|
|
162
|
+
"@typescript-eslint/no-unnecessary-template-expression": "error",
|
|
163
|
+
"@typescript-eslint/no-unnecessary-type-arguments": "error",
|
|
164
|
+
"@typescript-eslint/no-unnecessary-type-assertion": "error",
|
|
165
|
+
"@typescript-eslint/no-unnecessary-type-conversion": "error",
|
|
166
|
+
"@typescript-eslint/no-unnecessary-type-parameters": "error",
|
|
167
|
+
"@typescript-eslint/no-unsafe-argument": "error",
|
|
168
|
+
"@typescript-eslint/no-unsafe-assignment": "error",
|
|
169
|
+
"@typescript-eslint/no-unsafe-call": "error",
|
|
170
|
+
"@typescript-eslint/no-unsafe-enum-comparison": "error",
|
|
171
|
+
"@typescript-eslint/no-unsafe-member-access": "error",
|
|
172
|
+
"@typescript-eslint/no-unsafe-return": "error",
|
|
173
|
+
"@typescript-eslint/no-unsafe-type-assertion": "off", // as и нужен для сужения типов
|
|
174
|
+
"@typescript-eslint/no-unsafe-unary-minus": "error",
|
|
175
|
+
"@typescript-eslint/no-useless-default-assignment": "error",
|
|
176
|
+
"@typescript-eslint/non-nullable-type-assertion-style": "error",
|
|
177
|
+
"no-throw-literal": "off",
|
|
178
|
+
"@typescript-eslint/only-throw-error": ["error", {
|
|
179
|
+
allowRethrowing: true
|
|
180
|
+
}],
|
|
181
|
+
"prefer-destructuring": "off",
|
|
182
|
+
"@typescript-eslint/prefer-destructuring": ["error", { array: true, object: false }],
|
|
183
|
+
"@typescript-eslint/prefer-find": "error",
|
|
184
|
+
"@typescript-eslint/prefer-includes": "error",
|
|
185
|
+
"@typescript-eslint/prefer-nullish-coalescing": "error",
|
|
186
|
+
"@typescript-eslint/prefer-optional-chain": "error",
|
|
187
|
+
"prefer-promise-reject-errors": "off",
|
|
188
|
+
"@typescript-eslint/prefer-promise-reject-errors": ["error", {
|
|
189
|
+
allowThrowingUnknown: true, // нужен для re-throw error: unknown из catch
|
|
190
|
+
}],
|
|
191
|
+
"@typescript-eslint/prefer-readonly": "error",
|
|
192
|
+
"@typescript-eslint/prefer-readonly-parameter-types": "off",
|
|
193
|
+
"@typescript-eslint/prefer-reduce-type-parameter": "error",
|
|
194
|
+
"@typescript-eslint/prefer-regexp-exec": "error",
|
|
195
|
+
"@typescript-eslint/prefer-return-this-type": "error",
|
|
196
|
+
"@typescript-eslint/prefer-string-starts-ends-with": "error",
|
|
197
|
+
"@typescript-eslint/promise-function-async": "error",
|
|
198
|
+
"@typescript-eslint/related-getter-setter-pairs": "error",
|
|
199
|
+
"@typescript-eslint/require-array-sort-compare": "error",
|
|
200
|
+
"require-await": "off",
|
|
201
|
+
"@typescript-eslint/require-await": "error",
|
|
202
|
+
"@typescript-eslint/restrict-plus-operands": "error",
|
|
203
|
+
"@typescript-eslint/restrict-template-expressions": ["error", {
|
|
204
|
+
allowNumber: true,
|
|
205
|
+
allowBoolean: true,
|
|
206
|
+
allowRegExp: true,
|
|
207
|
+
allowNullish: false,
|
|
208
|
+
allowAny: false,
|
|
209
|
+
allowNever: false,
|
|
210
|
+
allowArray: false,
|
|
211
|
+
allow: [{ from: "lib", name: ["Error", "URL", "URLSearchParams"] }],
|
|
212
|
+
}],
|
|
213
|
+
"@typescript-eslint/return-await": ["error", "in-try-catch"],
|
|
214
|
+
"@typescript-eslint/strict-boolean-expressions": "off",
|
|
215
|
+
"@typescript-eslint/strict-void-return": "error", // Возможно выключить
|
|
216
|
+
"@typescript-eslint/switch-exhaustiveness-check": ["error", { requireDefaultForNonUnion: true }],
|
|
217
|
+
"@typescript-eslint/unbound-method": "error",
|
|
218
|
+
"@typescript-eslint/use-unknown-in-catch-callback-variable": "error",
|
|
219
|
+
};
|
package/package.json
CHANGED
|
@@ -1,30 +1,34 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "@xaliksss/eslint-config",
|
|
3
|
-
"version": "
|
|
4
|
-
"main": "index.js",
|
|
5
|
-
"type": "module",
|
|
6
|
-
"
|
|
7
|
-
"
|
|
8
|
-
"
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
"
|
|
19
|
-
},
|
|
20
|
-
"
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
"eslint": "
|
|
28
|
-
"
|
|
29
|
-
|
|
30
|
-
}
|
|
1
|
+
{
|
|
2
|
+
"name": "@xaliksss/eslint-config",
|
|
3
|
+
"version": "4.0.0",
|
|
4
|
+
"main": "dist/index.js",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"author": {
|
|
7
|
+
"name": "Xaliks",
|
|
8
|
+
"url": "https://github.com/Xaliks"
|
|
9
|
+
},
|
|
10
|
+
"repository": {
|
|
11
|
+
"type": "git",
|
|
12
|
+
"url": "git+https://github.com/Xaliks/eslint-config.git"
|
|
13
|
+
},
|
|
14
|
+
"files": [
|
|
15
|
+
"dist"
|
|
16
|
+
],
|
|
17
|
+
"exports": {
|
|
18
|
+
".": "./dist/index.js"
|
|
19
|
+
},
|
|
20
|
+
"scripts": {
|
|
21
|
+
"build": "tsc"
|
|
22
|
+
},
|
|
23
|
+
"license": "MIT",
|
|
24
|
+
"dependencies": {
|
|
25
|
+
"@stylistic/eslint-plugin": "^5.10.0",
|
|
26
|
+
"eslint": "^10.5.0",
|
|
27
|
+
"eslint-plugin-import": "git+https://github.com/Xaliks/eslint-plugin-import.git#pr-3230",
|
|
28
|
+
"globals": "^17.7.0",
|
|
29
|
+
"typescript-eslint": "^8.62.0"
|
|
30
|
+
},
|
|
31
|
+
"devDependencies": {
|
|
32
|
+
"typescript": "^6.0.3"
|
|
33
|
+
}
|
|
34
|
+
}
|
package/eslint.config.js
DELETED
|
@@ -1,349 +0,0 @@
|
|
|
1
|
-
import tseslint from "typescript-eslint";
|
|
2
|
-
import prettier from "eslint-plugin-prettier";
|
|
3
|
-
// Ждем https://github.com/import-js/eslint-plugin-import/pull/2996
|
|
4
|
-
// import importPlugin from "eslint-plugin-import";
|
|
5
|
-
import globals from "globals";
|
|
6
|
-
|
|
7
|
-
const jsRules = {
|
|
8
|
-
"prettier/prettier": [
|
|
9
|
-
"error",
|
|
10
|
-
{
|
|
11
|
-
useTabs: true,
|
|
12
|
-
endOfLine: "auto",
|
|
13
|
-
printWidth: 115,
|
|
14
|
-
},
|
|
15
|
-
],
|
|
16
|
-
|
|
17
|
-
"constructor-super": "error",
|
|
18
|
-
"for-direction": "error",
|
|
19
|
-
"getter-return": "error",
|
|
20
|
-
"no-class-assign": "error",
|
|
21
|
-
"no-compare-neg-zero": "error",
|
|
22
|
-
"no-cond-assign": "error",
|
|
23
|
-
"no-const-assign": "error",
|
|
24
|
-
"no-constant-binary-expression": "error",
|
|
25
|
-
"no-constant-condition": "error",
|
|
26
|
-
"no-control-regex": "error",
|
|
27
|
-
"no-debugger": "error",
|
|
28
|
-
"no-delete-var": "error",
|
|
29
|
-
"no-dupe-args": "error",
|
|
30
|
-
"no-dupe-class-members": "error",
|
|
31
|
-
"no-dupe-else-if": "error",
|
|
32
|
-
"no-dupe-keys": "error",
|
|
33
|
-
"no-duplicate-case": "error",
|
|
34
|
-
"no-empty": "error",
|
|
35
|
-
"no-empty-character-class": "error",
|
|
36
|
-
"no-empty-pattern": "error",
|
|
37
|
-
"no-empty-static-block": "error",
|
|
38
|
-
"no-ex-assign": "error",
|
|
39
|
-
"no-extra-boolean-cast": "error",
|
|
40
|
-
"no-fallthrough": "error",
|
|
41
|
-
"no-func-assign": "error",
|
|
42
|
-
"no-global-assign": "error",
|
|
43
|
-
"no-import-assign": "error",
|
|
44
|
-
"no-invalid-regexp": "error",
|
|
45
|
-
"no-irregular-whitespace": "error",
|
|
46
|
-
"no-loss-of-precision": "error",
|
|
47
|
-
"no-misleading-character-class": "error",
|
|
48
|
-
"no-new-native-nonconstructor": "error",
|
|
49
|
-
"no-nonoctal-decimal-escape": "error",
|
|
50
|
-
"no-obj-calls": "error",
|
|
51
|
-
"no-octal": "error",
|
|
52
|
-
"no-prototype-builtins": "error",
|
|
53
|
-
"no-redeclare": "error",
|
|
54
|
-
"no-regex-spaces": "error",
|
|
55
|
-
"no-self-assign": "error",
|
|
56
|
-
"no-setter-return": "error",
|
|
57
|
-
"no-shadow-restricted-names": "error",
|
|
58
|
-
"no-sparse-arrays": "error",
|
|
59
|
-
"no-this-before-super": "error",
|
|
60
|
-
"no-undef": "error",
|
|
61
|
-
"no-unexpected-multiline": "error",
|
|
62
|
-
"no-unreachable": "error",
|
|
63
|
-
"no-unsafe-finally": "error",
|
|
64
|
-
"no-unsafe-negation": "error",
|
|
65
|
-
"no-unsafe-optional-chaining": "error",
|
|
66
|
-
"no-unused-labels": "error",
|
|
67
|
-
"no-unused-private-class-members": "error",
|
|
68
|
-
"no-unused-vars": "error",
|
|
69
|
-
"no-useless-backreference": "error",
|
|
70
|
-
"no-useless-catch": "error",
|
|
71
|
-
"no-useless-escape": "error",
|
|
72
|
-
"no-with": "error",
|
|
73
|
-
"require-yield": "error",
|
|
74
|
-
"use-isnan": "error",
|
|
75
|
-
"valid-typeof": "error",
|
|
76
|
-
|
|
77
|
-
// My rules
|
|
78
|
-
"no-constructor-return": "error",
|
|
79
|
-
"no-self-compare": "error",
|
|
80
|
-
"no-unmodified-loop-condition": "error",
|
|
81
|
-
"no-unreachable-loop": "error",
|
|
82
|
-
"no-useless-assignment": "error",
|
|
83
|
-
"no-useless-return": "error",
|
|
84
|
-
"no-useless-rename": "error",
|
|
85
|
-
"no-useless-constructor": "error",
|
|
86
|
-
"no-useless-concat": "error",
|
|
87
|
-
"no-useless-computed-key": "error",
|
|
88
|
-
"no-unused-expressions": "error",
|
|
89
|
-
"no-object-constructor": "error",
|
|
90
|
-
"no-new-wrappers": "error",
|
|
91
|
-
"no-new-func": "error",
|
|
92
|
-
"no-new": "error",
|
|
93
|
-
"no-negated-condition": "error",
|
|
94
|
-
"no-multi-str": "error",
|
|
95
|
-
"no-multi-assign": "error",
|
|
96
|
-
"no-lonely-if": "error",
|
|
97
|
-
"no-var": "error",
|
|
98
|
-
yoda: "error",
|
|
99
|
-
"prefer-template": "error",
|
|
100
|
-
"prefer-rest-params": "error",
|
|
101
|
-
"prefer-regex-literals": "error",
|
|
102
|
-
"no-lone-blocks": "error",
|
|
103
|
-
"no-labels": "error",
|
|
104
|
-
"no-label-var": "error",
|
|
105
|
-
"no-implied-eval": "error",
|
|
106
|
-
"no-eval": "error",
|
|
107
|
-
"no-eq-null": "error",
|
|
108
|
-
"no-else-return": "error",
|
|
109
|
-
"no-array-constructor": "error",
|
|
110
|
-
"logical-assignment-operators": "error",
|
|
111
|
-
eqeqeq: "error",
|
|
112
|
-
"dot-notation": "error",
|
|
113
|
-
"default-param-last": "error",
|
|
114
|
-
"default-case-last": "error",
|
|
115
|
-
"no-empty-function": "error",
|
|
116
|
-
"no-loop-func": "error",
|
|
117
|
-
"no-shadow": "error",
|
|
118
|
-
"no-throw-literal": "error",
|
|
119
|
-
"prefer-promise-reject-errors": "error",
|
|
120
|
-
"require-await": "error",
|
|
121
|
-
"no-return-await": "error",
|
|
122
|
-
|
|
123
|
-
"no-template-curly-in-string": "warn",
|
|
124
|
-
"prefer-arrow-callback": ["error", { allowNamedFunctions: true }],
|
|
125
|
-
"prefer-const": ["error", { destructuring: "all" }],
|
|
126
|
-
curly: ["error", "multi-line"],
|
|
127
|
-
quotes: ["error", "double", { avoidEscape: true }],
|
|
128
|
-
"no-use-before-define": ["error", { functions: false, classes: false }],
|
|
129
|
-
"object-shorthand": ["error", "always", { avoidQuotes: true }],
|
|
130
|
-
"prefer-destructuring": ["error", { array: true, object: false }],
|
|
131
|
-
"no-unneeded-ternary": ["error", { defaultAssignment: false }],
|
|
132
|
-
"operator-assignment": ["error", "always"],
|
|
133
|
-
"max-params": ["error", { max: 5 }],
|
|
134
|
-
|
|
135
|
-
// "import/export": "error",
|
|
136
|
-
// "import/no-deprecated": "error",
|
|
137
|
-
// "import/no-empty-named-blocks": "error",
|
|
138
|
-
// "import/no-extraneous-dependencies": "error",
|
|
139
|
-
// "import/no-mutable-exports": "error",
|
|
140
|
-
// "import/no-named-as-default-member": "error",
|
|
141
|
-
// "import/no-amd": "error",
|
|
142
|
-
// "import/no-import-module-exports": "error",
|
|
143
|
-
// "import/unambiguous": "error",
|
|
144
|
-
// "import/default": "error", // Под вопросом
|
|
145
|
-
// "import/named": "error", // Под вопросом
|
|
146
|
-
// "import/no-duplicates": "error",
|
|
147
|
-
};
|
|
148
|
-
|
|
149
|
-
// https://typescript-eslint.io/rules/?=xdeprecated
|
|
150
|
-
const tsRules = {
|
|
151
|
-
...jsRules,
|
|
152
|
-
"no-dupe-class-members": "off",
|
|
153
|
-
|
|
154
|
-
"tseslint/adjacent-overload-signatures": "error",
|
|
155
|
-
"tseslint/array-type": ["error", { default: "array-simple" }],
|
|
156
|
-
"tseslint/ban-ts-comment": ["error", { "ts-expect-error": "allow-with-description" }],
|
|
157
|
-
"tseslint/ban-tslint-comment": "error",
|
|
158
|
-
"tseslint/class-literal-property-style": "error",
|
|
159
|
-
"tseslint/consistent-generic-constructors": "error",
|
|
160
|
-
"tseslint/consistent-indexed-object-style": "error",
|
|
161
|
-
"tseslint/consistent-type-assertions": "error",
|
|
162
|
-
"tseslint/consistent-type-definitions": "error",
|
|
163
|
-
"tseslint/consistent-type-exports": "error",
|
|
164
|
-
"tseslint/consistent-type-imports": "error",
|
|
165
|
-
"tseslint/member-ordering": "error",
|
|
166
|
-
"tseslint/method-signature-style": ["error", "method"],
|
|
167
|
-
"tseslint/no-array-constructor": "error",
|
|
168
|
-
"tseslint/no-array-delete": "error",
|
|
169
|
-
"tseslint/no-base-to-string": "error",
|
|
170
|
-
"tseslint/no-confusing-non-null-assertion": "error",
|
|
171
|
-
"tseslint/no-confusing-void-expression": ["error", { ignoreArrowShorthand: true }],
|
|
172
|
-
"tseslint/no-duplicate-enum-values": "error",
|
|
173
|
-
"tseslint/no-duplicate-type-constituents": "error",
|
|
174
|
-
"tseslint/no-empty-interface": "error",
|
|
175
|
-
"tseslint/no-empty-object-type": "error",
|
|
176
|
-
"tseslint/no-extra-non-null-assertion": "error",
|
|
177
|
-
"tseslint/no-for-in-array": "error",
|
|
178
|
-
"tseslint/no-import-type-side-effects": "error",
|
|
179
|
-
"tseslint/no-inferrable-types": "error",
|
|
180
|
-
"tseslint/no-invalid-void-type": "error",
|
|
181
|
-
"tseslint/no-meaningless-void-operator": "error",
|
|
182
|
-
"tseslint/no-misused-new": "error",
|
|
183
|
-
"tseslint/no-misused-promises": ["error", { checksVoidReturn: false }],
|
|
184
|
-
"tseslint/no-mixed-enums": "error",
|
|
185
|
-
"tseslint/no-namespace": "error",
|
|
186
|
-
"tseslint/no-non-null-asserted-nullish-coalescing": "error",
|
|
187
|
-
"tseslint/no-non-null-asserted-optional-chain": "error",
|
|
188
|
-
"tseslint/no-require-imports": "error",
|
|
189
|
-
"tseslint/no-this-alias": "error",
|
|
190
|
-
"tseslint/no-unnecessary-boolean-literal-compare": "error",
|
|
191
|
-
"tseslint/no-unnecessary-condition": "error",
|
|
192
|
-
"tseslint/no-unnecessary-parameter-property-assignment": "error",
|
|
193
|
-
"tseslint/no-unnecessary-qualifier": "error",
|
|
194
|
-
"tseslint/no-unnecessary-template-expression": "error",
|
|
195
|
-
"tseslint/no-unnecessary-type-arguments": "error",
|
|
196
|
-
"tseslint/no-unnecessary-type-assertion": "error",
|
|
197
|
-
"tseslint/no-unnecessary-type-constraint": "error",
|
|
198
|
-
"tseslint/no-unnecessary-type-parameters": "error", // Спорно
|
|
199
|
-
"tseslint/no-unsafe-argument": "error",
|
|
200
|
-
"tseslint/no-unsafe-assignment": "error",
|
|
201
|
-
"tseslint/no-unsafe-call": "error",
|
|
202
|
-
"tseslint/no-unsafe-declaration-merging": "error",
|
|
203
|
-
"tseslint/no-unsafe-enum-comparison": "error",
|
|
204
|
-
"tseslint/no-unsafe-function-type": "error",
|
|
205
|
-
"tseslint/no-unsafe-member-access": "error",
|
|
206
|
-
"tseslint/no-unsafe-return": "error",
|
|
207
|
-
"tseslint/no-unsafe-unary-minus": "error",
|
|
208
|
-
"tseslint/no-useless-empty-export": "error",
|
|
209
|
-
"tseslint/no-var-requires": "error",
|
|
210
|
-
"tseslint/no-wrapper-object-types": "error",
|
|
211
|
-
"tseslint/non-nullable-type-assertion-style": "error",
|
|
212
|
-
"tseslint/prefer-as-const": "error",
|
|
213
|
-
"tseslint/prefer-find": "error",
|
|
214
|
-
"tseslint/prefer-for-of": "error",
|
|
215
|
-
"tseslint/prefer-function-type": "error",
|
|
216
|
-
"tseslint/prefer-includes": "error",
|
|
217
|
-
"tseslint/prefer-literal-enum-member": "error",
|
|
218
|
-
"tseslint/prefer-namespace-keyword": "error",
|
|
219
|
-
"tseslint/prefer-nullish-coalescing": "error",
|
|
220
|
-
"tseslint/prefer-optional-chain": "error",
|
|
221
|
-
"tseslint/prefer-readonly": "error",
|
|
222
|
-
"tseslint/prefer-reduce-type-parameter": "error",
|
|
223
|
-
"tseslint/prefer-regexp-exec": "warn",
|
|
224
|
-
"tseslint/prefer-return-this-type": "error",
|
|
225
|
-
"tseslint/prefer-string-starts-ends-with": ["error", { allowSingleElementEquality: "always" }],
|
|
226
|
-
"tseslint/require-array-sort-compare": "error",
|
|
227
|
-
"tseslint/restrict-plus-operands": "error",
|
|
228
|
-
"tseslint/switch-exhaustiveness-check": ["error", { requireDefaultForNonUnion: true }],
|
|
229
|
-
"tseslint/triple-slash-reference": "error",
|
|
230
|
-
"tseslint/unbound-method": "error",
|
|
231
|
-
"tseslint/unified-signatures": "error",
|
|
232
|
-
"tseslint/use-unknown-in-catch-callback-variable": "error",
|
|
233
|
-
|
|
234
|
-
"default-param-last": "off",
|
|
235
|
-
"tseslint/default-param-last": jsRules["default-param-last"],
|
|
236
|
-
|
|
237
|
-
"dot-notation": "off",
|
|
238
|
-
"tseslint/dot-notation": jsRules["dot-notation"],
|
|
239
|
-
|
|
240
|
-
"max-params": "off",
|
|
241
|
-
"tseslint/max-params": jsRules["max-params"],
|
|
242
|
-
|
|
243
|
-
camelcase: "off",
|
|
244
|
-
"tseslint/naming-convention": [
|
|
245
|
-
"error",
|
|
246
|
-
{
|
|
247
|
-
selector: "default",
|
|
248
|
-
format: null,
|
|
249
|
-
leadingUnderscore: "allowSingleOrDouble",
|
|
250
|
-
},
|
|
251
|
-
{
|
|
252
|
-
selector: ["variableLike", "import"],
|
|
253
|
-
format: ["camelCase", "PascalCase"],
|
|
254
|
-
leadingUnderscore: "allowSingleOrDouble",
|
|
255
|
-
},
|
|
256
|
-
{
|
|
257
|
-
selector: ["method", "classProperty", "typeProperty"],
|
|
258
|
-
format: ["camelCase"],
|
|
259
|
-
leadingUnderscore: "allowSingleOrDouble",
|
|
260
|
-
},
|
|
261
|
-
{
|
|
262
|
-
selector: ["typeLike", "enumMember"],
|
|
263
|
-
format: ["PascalCase"],
|
|
264
|
-
leadingUnderscore: "forbid",
|
|
265
|
-
},
|
|
266
|
-
],
|
|
267
|
-
|
|
268
|
-
"no-empty-function": "off",
|
|
269
|
-
"tseslint/no-empty-function": jsRules["no-empty-function"],
|
|
270
|
-
|
|
271
|
-
"no-implied-eval": "off",
|
|
272
|
-
"tseslint/no-implied-eval": jsRules["no-implied-eval"],
|
|
273
|
-
|
|
274
|
-
"no-loop-func": "off",
|
|
275
|
-
"tseslint/no-loop-func": jsRules["no-loop-func"],
|
|
276
|
-
|
|
277
|
-
"no-shadow": "off",
|
|
278
|
-
"tseslint/no-shadow": jsRules["no-shadow"],
|
|
279
|
-
|
|
280
|
-
"no-unused-expressions": "off",
|
|
281
|
-
"tseslint/no-unused-expressions": jsRules["no-unused-expressions"],
|
|
282
|
-
|
|
283
|
-
"no-unused-vars": "off",
|
|
284
|
-
"tseslint/no-unused-vars": jsRules["no-unused-vars"],
|
|
285
|
-
|
|
286
|
-
"no-use-before-define": "off",
|
|
287
|
-
"tseslint/no-use-before-define": jsRules["no-use-before-define"],
|
|
288
|
-
|
|
289
|
-
"no-useless-constructor": "off",
|
|
290
|
-
"tseslint/no-useless-constructor": jsRules["no-useless-constructor"],
|
|
291
|
-
|
|
292
|
-
"no-throw-literal": "off",
|
|
293
|
-
"tseslint/only-throw-error": jsRules["no-throw-literal"],
|
|
294
|
-
|
|
295
|
-
"prefer-destructuring": "off",
|
|
296
|
-
"tseslint/prefer-destructuring": jsRules["prefer-destructuring"],
|
|
297
|
-
|
|
298
|
-
"prefer-promise-reject-errors": "off",
|
|
299
|
-
"tseslint/prefer-promise-reject-errors": "error",
|
|
300
|
-
|
|
301
|
-
"require-await": "off",
|
|
302
|
-
"tseslint/require-await": "error",
|
|
303
|
-
|
|
304
|
-
"no-return-await": "off",
|
|
305
|
-
"tseslint/return-await": ["error", "never"],
|
|
306
|
-
};
|
|
307
|
-
|
|
308
|
-
globals.node.NodeJS = false;
|
|
309
|
-
|
|
310
|
-
export default tseslint.config(
|
|
311
|
-
// TypeScript
|
|
312
|
-
{
|
|
313
|
-
files: ["**/*.ts", "**/*.mts", "**/*.cts", "**/*.tsx"],
|
|
314
|
-
ignores: ["dist/**/*"],
|
|
315
|
-
|
|
316
|
-
languageOptions: {
|
|
317
|
-
parserOptions: { project: true },
|
|
318
|
-
parser: tseslint.parser,
|
|
319
|
-
sourceType: "module",
|
|
320
|
-
globals: globals.node,
|
|
321
|
-
},
|
|
322
|
-
|
|
323
|
-
plugins: {
|
|
324
|
-
tseslint: tseslint.plugin,
|
|
325
|
-
prettier,
|
|
326
|
-
// import: importPlugin,
|
|
327
|
-
},
|
|
328
|
-
|
|
329
|
-
rules: tsRules,
|
|
330
|
-
},
|
|
331
|
-
// JavaScript
|
|
332
|
-
{
|
|
333
|
-
files: ["**/*.js", "**/*.mjs", "**/*.cjs", "**/*.jsx"],
|
|
334
|
-
ignores: ["dist/**/*"],
|
|
335
|
-
|
|
336
|
-
languageOptions: {
|
|
337
|
-
ecmaVersion: "latest",
|
|
338
|
-
sourceType: "module",
|
|
339
|
-
globals: globals.node,
|
|
340
|
-
},
|
|
341
|
-
|
|
342
|
-
plugins: {
|
|
343
|
-
prettier,
|
|
344
|
-
// import: importPlugin,
|
|
345
|
-
},
|
|
346
|
-
|
|
347
|
-
rules: jsRules,
|
|
348
|
-
},
|
|
349
|
-
);
|
package/index.js
DELETED