@xaliksss/eslint-config 3.1.0 → 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 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.
@@ -0,0 +1,2 @@
1
+ declare const _default: import("eslint/config").Config[];
2
+ export default _default;
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,2 @@
1
+ import type { Linter } from "eslint";
2
+ export declare const eslintRules: Linter.RulesRecord;
@@ -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,2 @@
1
+ import { Linter } from "eslint";
2
+ export declare const importRules: Linter.RulesRecord;
@@ -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,2 @@
1
+ import type { Linter } from "eslint";
2
+ export declare const stylisticRules: Linter.RulesRecord;
@@ -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,3 @@
1
+ import { Linter } from "eslint";
2
+ export declare const typescriptRules: Linter.RulesRecord;
3
+ export declare const typescriptTypeAwareRules: Linter.RulesRecord;
@@ -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,31 +1,34 @@
1
- {
2
- "name": "@xaliksss/eslint-config",
3
- "version": "3.1.0",
4
- "main": "index.js",
5
- "type": "module",
6
- "keywords": [
7
- "eslint",
8
- "config",
9
- "eslint-config",
10
- "eslintconfig"
11
- ],
12
- "author": {
13
- "name": "Xaliks",
14
- "url": "https://github.com/Xaliks"
15
- },
16
- "repository": {
17
- "type": "git",
18
- "url": "git+https://github.com/Xaliks/eslint-config.git"
19
- },
20
- "license": "MIT",
21
- "dependencies": {
22
- "eslint-plugin-import": "^2.31.0",
23
- "eslint-plugin-prettier": "^5.2.1",
24
- "globals": "^15.11.0",
25
- "typescript-eslint": "^8.11.0"
26
- },
27
- "peerDependencies": {
28
- "eslint": "^9.13.0",
29
- "prettier": "^3.3.3"
30
- }
31
- }
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,369 +0,0 @@
1
- import importPlugin from "eslint-plugin-import";
2
- import prettier from "eslint-plugin-prettier";
3
- import globals from "globals";
4
- import tseslint from "typescript-eslint";
5
-
6
- const jsRules = {
7
- "prettier/prettier": [
8
- "error",
9
- {
10
- useTabs: true,
11
- endOfLine: "auto",
12
- printWidth: 115,
13
- },
14
- ],
15
-
16
- "constructor-super": "error",
17
- "for-direction": "error",
18
- "getter-return": "error",
19
- "no-class-assign": "error",
20
- "no-compare-neg-zero": "error",
21
- "no-cond-assign": "error",
22
- "no-const-assign": "error",
23
- "no-constant-binary-expression": "error",
24
- "no-constant-condition": "error",
25
- "no-control-regex": "error",
26
- "no-debugger": "error",
27
- "no-delete-var": "error",
28
- "no-dupe-args": "error",
29
- "no-dupe-class-members": "error",
30
- "no-dupe-else-if": "error",
31
- "no-dupe-keys": "error",
32
- "no-duplicate-case": "error",
33
- "no-empty": "error",
34
- "no-empty-character-class": "error",
35
- "no-empty-pattern": "error",
36
- "no-empty-static-block": "error",
37
- "no-ex-assign": "error",
38
- "no-extra-boolean-cast": "error",
39
- "no-fallthrough": "error",
40
- "no-func-assign": "error",
41
- "no-global-assign": "error",
42
- "no-import-assign": "error",
43
- "no-invalid-regexp": "error",
44
- "no-irregular-whitespace": "error",
45
- "no-loss-of-precision": "error",
46
- "no-misleading-character-class": "error",
47
- "no-new-native-nonconstructor": "error",
48
- "no-nonoctal-decimal-escape": "error",
49
- "no-obj-calls": "error",
50
- "no-octal": "error",
51
- "no-prototype-builtins": "error",
52
- "no-redeclare": "error",
53
- "no-regex-spaces": "error",
54
- "no-self-assign": "error",
55
- "no-setter-return": "error",
56
- "no-shadow-restricted-names": "error",
57
- "no-sparse-arrays": "error",
58
- "no-this-before-super": "error",
59
- "no-undef": "error",
60
- "no-unexpected-multiline": "error",
61
- "no-unreachable": "error",
62
- "no-unsafe-finally": "error",
63
- "no-unsafe-negation": "error",
64
- "no-unsafe-optional-chaining": "error",
65
- "no-unused-labels": "error",
66
- "no-unused-private-class-members": "error",
67
- "no-unused-vars": "error",
68
- "no-useless-backreference": "error",
69
- "no-useless-catch": "error",
70
- "no-useless-escape": "error",
71
- "no-with": "error",
72
- "require-yield": "error",
73
- "use-isnan": "error",
74
- "valid-typeof": "error",
75
-
76
- // My rules
77
- "no-constructor-return": "error",
78
- "no-self-compare": "error",
79
- "no-unmodified-loop-condition": "error",
80
- "no-unreachable-loop": "error",
81
- "no-useless-assignment": "error",
82
- "no-useless-return": "error",
83
- "no-useless-rename": "error",
84
- "no-useless-constructor": "error",
85
- "no-useless-concat": "error",
86
- "no-useless-computed-key": "error",
87
- "no-unused-expressions": "error",
88
- "no-object-constructor": "error",
89
- "no-new-wrappers": "error",
90
- "no-new-func": "error",
91
- "no-new": "error",
92
- "no-negated-condition": "error",
93
- "no-multi-str": "error",
94
- "no-multi-assign": "error",
95
- "no-lonely-if": "error",
96
- "no-var": "error",
97
- yoda: "error",
98
- "prefer-template": "error",
99
- "prefer-rest-params": "error",
100
- "prefer-regex-literals": "error",
101
- "no-lone-blocks": "error",
102
- "no-labels": "error",
103
- "no-label-var": "error",
104
- "no-implied-eval": "error",
105
- "no-eval": "error",
106
- "no-eq-null": "error",
107
- "no-else-return": "error",
108
- "no-array-constructor": "error",
109
- "logical-assignment-operators": "error",
110
- eqeqeq: "error",
111
- "dot-notation": "error",
112
- "default-param-last": "error",
113
- "default-case-last": "error",
114
- "no-empty-function": "error",
115
- "no-loop-func": "error",
116
- "no-shadow": "error",
117
- "no-throw-literal": "error",
118
- "prefer-promise-reject-errors": "error",
119
- "require-await": "error",
120
- "no-return-await": "error",
121
-
122
- "no-template-curly-in-string": "warn",
123
- "prefer-arrow-callback": ["error", { allowNamedFunctions: true }],
124
- "prefer-const": ["error", { destructuring: "all" }],
125
- curly: ["error", "multi-line"],
126
- quotes: ["error", "double", { avoidEscape: true }],
127
- "no-use-before-define": ["error", { functions: false, classes: false }],
128
- "object-shorthand": ["error", "always", { avoidQuotes: true }],
129
- "prefer-destructuring": ["error", { array: true, object: false }],
130
- "no-unneeded-ternary": ["error", { defaultAssignment: false }],
131
- "operator-assignment": ["error", "always"],
132
- "max-params": ["error", { max: 5 }],
133
-
134
- "import/export": "error",
135
- "import/no-deprecated": "error",
136
- "import/no-empty-named-blocks": "error",
137
- "import/no-extraneous-dependencies": "error",
138
- "import/no-mutable-exports": "error",
139
- "import/no-named-as-default-member": "error",
140
- "import/no-unused-modules": "error", // ПОЧЕМУ ТО ПРИ { "unusedExports": true } ESLint couldn't find a configuration file. To set up a configuration file for this project, please run:
141
- "import/no-amd": "error",
142
- "import/no-commonjs": "error",
143
- "import/no-import-module-exports": "error",
144
- "import/unambiguous": "error",
145
- "import/default": "error", // Под вопросом
146
- "import/named": "error", // Под вопросом
147
- "import/namespace": "error",
148
- "import/no-absolute-path": "error",
149
- "import/no-dynamic-require": "error",
150
- "import/no-self-import": "error",
151
- "import/no-useless-path-segments": "error",
152
- "import/no-webpack-loader-syntax": "error",
153
- "import/consistent-type-specifier-style": ["error", "prefer-top-level"],
154
- "import/first": "error",
155
- "import/newline-after-import": ["error", { count: 1, considerComments: false }],
156
- "import/no-anonymous-default-export": "error",
157
- "import/no-duplicates": "error",
158
- "import/no-named-default": "error",
159
- "import/order": [
160
- "error",
161
- {
162
- groups: ["builtin", "external", "type", "internal", "parent", "sibling", "index", "object"],
163
- "newlines-between": "always",
164
- named: true,
165
- alphabetize: { order: "asc" },
166
- },
167
- ],
168
- };
169
-
170
- // https://typescript-eslint.io/rules/?=xdeprecated
171
- const tsRules = {
172
- ...jsRules,
173
- "no-dupe-class-members": "off",
174
-
175
- "tseslint/adjacent-overload-signatures": "error",
176
- "tseslint/array-type": ["error", { default: "array-simple" }],
177
- "tseslint/ban-ts-comment": ["error", { "ts-expect-error": "allow-with-description" }],
178
- "tseslint/ban-tslint-comment": "error",
179
- "tseslint/class-literal-property-style": "error",
180
- "tseslint/consistent-generic-constructors": "error",
181
- "tseslint/consistent-indexed-object-style": "error",
182
- "tseslint/consistent-type-assertions": "error",
183
- "tseslint/consistent-type-definitions": "error",
184
- "tseslint/consistent-type-exports": "error",
185
- "tseslint/consistent-type-imports": "error",
186
- "tseslint/member-ordering": "error",
187
- "tseslint/method-signature-style": ["error", "method"],
188
- "tseslint/no-array-constructor": "error",
189
- "tseslint/no-array-delete": "error",
190
- "tseslint/no-base-to-string": "error",
191
- "tseslint/no-confusing-non-null-assertion": "error",
192
- "tseslint/no-duplicate-enum-values": "error",
193
- "tseslint/no-duplicate-type-constituents": "error",
194
- "tseslint/no-empty-interface": "error",
195
- "tseslint/no-empty-object-type": "error",
196
- "tseslint/no-extra-non-null-assertion": "error",
197
- "tseslint/no-for-in-array": "error",
198
- // "tseslint/no-import-type-side-effects": "error", // import/consistent-type-specifier-style
199
- "tseslint/no-inferrable-types": "error",
200
- "tseslint/no-invalid-void-type": "error",
201
- "tseslint/no-meaningless-void-operator": "error",
202
- "tseslint/no-misused-new": "error",
203
- "tseslint/no-misused-promises": ["error", { checksVoidReturn: false }],
204
- "tseslint/no-mixed-enums": "error",
205
- "tseslint/no-namespace": "error",
206
- "tseslint/no-non-null-asserted-nullish-coalescing": "error",
207
- "tseslint/no-non-null-asserted-optional-chain": "error",
208
- "tseslint/no-require-imports": "error",
209
- "tseslint/no-this-alias": "error",
210
- "tseslint/no-unnecessary-boolean-literal-compare": "error",
211
- "tseslint/no-unnecessary-condition": "error",
212
- "tseslint/no-unnecessary-parameter-property-assignment": "error",
213
- "tseslint/no-unnecessary-qualifier": "error",
214
- "tseslint/no-unnecessary-template-expression": "error",
215
- "tseslint/no-unnecessary-type-arguments": "error",
216
- "tseslint/no-unnecessary-type-assertion": "error",
217
- "tseslint/no-unnecessary-type-constraint": "error",
218
- "tseslint/no-unnecessary-type-parameters": "error", // Спорно
219
- "tseslint/no-unsafe-argument": "error",
220
- "tseslint/no-unsafe-assignment": "error",
221
- "tseslint/no-unsafe-call": "error",
222
- "tseslint/no-unsafe-declaration-merging": "error",
223
- "tseslint/no-unsafe-enum-comparison": "error",
224
- "tseslint/no-unsafe-function-type": "error",
225
- "tseslint/no-unsafe-member-access": "error",
226
- "tseslint/no-unsafe-return": "error",
227
- "tseslint/no-unsafe-unary-minus": "error",
228
- "tseslint/no-useless-empty-export": "error",
229
- "tseslint/no-var-requires": "error",
230
- "tseslint/no-wrapper-object-types": "error",
231
- "tseslint/non-nullable-type-assertion-style": "error",
232
- "tseslint/prefer-as-const": "error",
233
- "tseslint/prefer-find": "error",
234
- "tseslint/prefer-for-of": "error",
235
- "tseslint/prefer-function-type": "error",
236
- "tseslint/prefer-includes": "error",
237
- "tseslint/prefer-literal-enum-member": "error",
238
- "tseslint/prefer-namespace-keyword": "error",
239
- "tseslint/prefer-nullish-coalescing": "error",
240
- "tseslint/prefer-optional-chain": "error",
241
- "tseslint/prefer-readonly": "error",
242
- "tseslint/prefer-reduce-type-parameter": "error",
243
- "tseslint/prefer-regexp-exec": "warn",
244
- "tseslint/prefer-return-this-type": "error",
245
- "tseslint/prefer-string-starts-ends-with": ["error", { allowSingleElementEquality: "always" }],
246
- "tseslint/require-array-sort-compare": "error",
247
- "tseslint/restrict-plus-operands": "error",
248
- "tseslint/switch-exhaustiveness-check": ["error", { requireDefaultForNonUnion: true }],
249
- "tseslint/triple-slash-reference": "error",
250
- "tseslint/unbound-method": "error",
251
- "tseslint/unified-signatures": "error",
252
- "tseslint/use-unknown-in-catch-callback-variable": "error",
253
-
254
- "default-param-last": "off",
255
- "tseslint/default-param-last": jsRules["default-param-last"],
256
-
257
- "dot-notation": "off",
258
- "tseslint/dot-notation": jsRules["dot-notation"],
259
-
260
- "max-params": "off",
261
- "tseslint/max-params": jsRules["max-params"],
262
-
263
- camelcase: "off",
264
- "tseslint/naming-convention": [
265
- "error",
266
- {
267
- selector: "default",
268
- format: null,
269
- leadingUnderscore: "allowSingleOrDouble",
270
- },
271
- {
272
- selector: ["variableLike", "import"],
273
- format: ["camelCase", "PascalCase"],
274
- leadingUnderscore: "allowSingleOrDouble",
275
- },
276
- {
277
- selector: ["method", "classProperty", "typeProperty"],
278
- format: ["camelCase"],
279
- leadingUnderscore: "allowSingleOrDouble",
280
- },
281
- {
282
- selector: ["typeLike", "enumMember"],
283
- format: ["PascalCase"],
284
- leadingUnderscore: "forbid",
285
- },
286
- ],
287
-
288
- "no-empty-function": "off",
289
- "tseslint/no-empty-function": jsRules["no-empty-function"],
290
-
291
- "no-implied-eval": "off",
292
- "tseslint/no-implied-eval": jsRules["no-implied-eval"],
293
-
294
- "no-loop-func": "off",
295
- "tseslint/no-loop-func": jsRules["no-loop-func"],
296
-
297
- "no-shadow": "off",
298
- "tseslint/no-shadow": jsRules["no-shadow"],
299
-
300
- "no-unused-expressions": "off",
301
- "tseslint/no-unused-expressions": jsRules["no-unused-expressions"],
302
-
303
- "no-unused-vars": "off",
304
- "tseslint/no-unused-vars": jsRules["no-unused-vars"],
305
-
306
- "no-use-before-define": "off",
307
- "tseslint/no-use-before-define": jsRules["no-use-before-define"],
308
-
309
- "no-useless-constructor": "off",
310
- "tseslint/no-useless-constructor": jsRules["no-useless-constructor"],
311
-
312
- "no-throw-literal": "off",
313
- "tseslint/only-throw-error": jsRules["no-throw-literal"],
314
-
315
- "prefer-destructuring": "off",
316
- "tseslint/prefer-destructuring": jsRules["prefer-destructuring"],
317
-
318
- "prefer-promise-reject-errors": "off",
319
- "tseslint/prefer-promise-reject-errors": "error",
320
-
321
- "require-await": "off",
322
- "tseslint/require-await": "error",
323
-
324
- "no-return-await": "off",
325
- "tseslint/return-await": ["error", "never"],
326
- };
327
-
328
- globals.node.NodeJS = false;
329
-
330
- export default tseslint.config(
331
- // TypeScript
332
- {
333
- files: ["**/*.ts", "**/*.mts", "**/*.cts", "**/*.tsx"],
334
- ignores: ["**/dist/**"],
335
-
336
- languageOptions: {
337
- parserOptions: { project: true },
338
- parser: tseslint.parser,
339
- sourceType: "module",
340
- globals: globals.node,
341
- },
342
-
343
- plugins: {
344
- tseslint: tseslint.plugin,
345
- prettier,
346
- import: importPlugin,
347
- },
348
-
349
- rules: tsRules,
350
- },
351
- // JavaScript
352
- {
353
- files: ["**/*.js", "**/*.mjs", "**/*.cjs", "**/*.jsx"],
354
- ignores: ["**/dist/**"],
355
-
356
- languageOptions: {
357
- ecmaVersion: "latest",
358
- sourceType: "module",
359
- globals: globals.node,
360
- },
361
-
362
- plugins: {
363
- prettier,
364
- import: importPlugin,
365
- },
366
-
367
- rules: jsRules,
368
- },
369
- );
package/index.js DELETED
@@ -1,3 +0,0 @@
1
- import config from "./eslint.config.js";
2
-
3
- export default config;