@xaliksss/eslint-config 2.0.1 → 3.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/eslint.config.js CHANGED
@@ -1,83 +1,350 @@
1
- const js = require("@eslint/js");
2
- const prettier = require("eslint-plugin-prettier");
3
- const globals = require("globals");
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";
4
6
 
5
- module.exports = [
6
- js.configs.recommended,
7
+ const jsRules = {
8
+ "prettier/prettier": [
9
+ "error",
10
+ {
11
+ useTabs: true,
12
+ endOfLine: "auto",
13
+ printWidth: 110,
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-floating-promises": "error",
178
+ "tseslint/no-for-in-array": "error",
179
+ "tseslint/no-import-type-side-effects": "error",
180
+ "tseslint/no-inferrable-types": "error",
181
+ "tseslint/no-invalid-void-type": "error",
182
+ "tseslint/no-meaningless-void-operator": "error",
183
+ "tseslint/no-misused-new": "error",
184
+ "tseslint/no-misused-promises": ["error", { checksVoidReturn: false }],
185
+ "tseslint/no-mixed-enums": "error",
186
+ "tseslint/no-namespace": "error",
187
+ "tseslint/no-non-null-asserted-nullish-coalescing": "error",
188
+ "tseslint/no-non-null-asserted-optional-chain": "error",
189
+ "tseslint/no-require-imports": "error",
190
+ "tseslint/no-this-alias": "error",
191
+ "tseslint/no-unnecessary-boolean-literal-compare": "error",
192
+ "tseslint/no-unnecessary-condition": "error",
193
+ "tseslint/no-unnecessary-parameter-property-assignment": "error",
194
+ "tseslint/no-unnecessary-qualifier": "error",
195
+ "tseslint/no-unnecessary-template-expression": "error",
196
+ "tseslint/no-unnecessary-type-arguments": "error",
197
+ "tseslint/no-unnecessary-type-assertion": "error",
198
+ "tseslint/no-unnecessary-type-constraint": "error",
199
+ "tseslint/no-unnecessary-type-parameters": "error", // Спорно
200
+ "tseslint/no-unsafe-argument": "error",
201
+ "tseslint/no-unsafe-assignment": "error",
202
+ "tseslint/no-unsafe-call": "error",
203
+ "tseslint/no-unsafe-declaration-merging": "error",
204
+ "tseslint/no-unsafe-enum-comparison": "error",
205
+ "tseslint/no-unsafe-function-type": "error",
206
+ "tseslint/no-unsafe-member-access": "error",
207
+ "tseslint/no-unsafe-return": "error",
208
+ "tseslint/no-unsafe-unary-minus": "error",
209
+ "tseslint/no-useless-empty-export": "error",
210
+ "tseslint/no-var-requires": "error",
211
+ "tseslint/no-wrapper-object-types": "error",
212
+ "tseslint/non-nullable-type-assertion-style": "error",
213
+ "tseslint/prefer-as-const": "error",
214
+ "tseslint/prefer-find": "error",
215
+ "tseslint/prefer-for-of": "error",
216
+ "tseslint/prefer-function-type": "error",
217
+ "tseslint/prefer-includes": "error",
218
+ "tseslint/prefer-literal-enum-member": "error",
219
+ "tseslint/prefer-namespace-keyword": "error",
220
+ "tseslint/prefer-nullish-coalescing": "error",
221
+ "tseslint/prefer-optional-chain": "error",
222
+ "tseslint/prefer-readonly": "error",
223
+ "tseslint/prefer-reduce-type-parameter": "error",
224
+ "tseslint/prefer-regexp-exec": "warn",
225
+ "tseslint/prefer-return-this-type": "error",
226
+ "tseslint/prefer-string-starts-ends-with": ["error", { allowSingleElementEquality: "always" }],
227
+ "tseslint/require-array-sort-compare": "error",
228
+ "tseslint/restrict-plus-operands": "error",
229
+ "tseslint/switch-exhaustiveness-check": ["error", { requireDefaultForNonUnion: true }],
230
+ "tseslint/triple-slash-reference": "error",
231
+ "tseslint/unbound-method": "error",
232
+ "tseslint/unified-signatures": "error",
233
+ "tseslint/use-unknown-in-catch-callback-variable": "error",
234
+
235
+ "default-param-last": "off",
236
+ "tseslint/default-param-last": jsRules["default-param-last"],
237
+
238
+ "dot-notation": "off",
239
+ "tseslint/dot-notation": jsRules["dot-notation"],
240
+
241
+ "max-params": "off",
242
+ "tseslint/max-params": jsRules["max-params"],
243
+
244
+ camelcase: "off",
245
+ "tseslint/naming-convention": [
246
+ "error",
247
+ {
248
+ selector: "default",
249
+ format: null,
250
+ leadingUnderscore: "allowSingleOrDouble",
251
+ },
252
+ {
253
+ selector: ["variableLike", "import"],
254
+ format: ["camelCase", "PascalCase"],
255
+ leadingUnderscore: "allowSingleOrDouble",
256
+ },
257
+ {
258
+ selector: ["method", "classProperty", "typeProperty"],
259
+ format: ["camelCase"],
260
+ leadingUnderscore: "allowSingleOrDouble",
261
+ },
262
+ {
263
+ selector: ["typeLike", "enumMember"],
264
+ format: ["PascalCase"],
265
+ leadingUnderscore: "forbid",
266
+ },
267
+ ],
268
+
269
+ "no-empty-function": "off",
270
+ "tseslint/no-empty-function": jsRules["no-empty-function"],
271
+
272
+ "no-implied-eval": "off",
273
+ "tseslint/no-implied-eval": jsRules["no-implied-eval"],
274
+
275
+ "no-loop-func": "off",
276
+ "tseslint/no-loop-func": jsRules["no-loop-func"],
277
+
278
+ "no-shadow": "off",
279
+ "tseslint/no-shadow": jsRules["no-shadow"],
280
+
281
+ "no-unused-expressions": "off",
282
+ "tseslint/no-unused-expressions": jsRules["no-unused-expressions"],
283
+
284
+ "no-unused-vars": "off",
285
+ "tseslint/no-unused-vars": jsRules["no-unused-vars"],
286
+
287
+ "no-use-before-define": "off",
288
+ "tseslint/no-use-before-define": jsRules["no-use-before-define"],
289
+
290
+ "no-useless-constructor": "off",
291
+ "tseslint/no-useless-constructor": jsRules["no-useless-constructor"],
292
+
293
+ "no-throw-literal": "off",
294
+ "tseslint/only-throw-error": jsRules["no-throw-literal"],
295
+
296
+ "prefer-destructuring": "off",
297
+ "tseslint/prefer-destructuring": jsRules["prefer-destructuring"],
298
+
299
+ "prefer-promise-reject-errors": "off",
300
+ "tseslint/prefer-promise-reject-errors": "error",
301
+
302
+ "require-await": "off",
303
+ "tseslint/require-await": "error",
304
+
305
+ "no-return-await": "off",
306
+ "tseslint/return-await": ["error", "never"],
307
+ };
308
+
309
+ globals.node.NodeJS = false;
310
+
311
+ export default tseslint.config(
312
+ // TypeScript
7
313
  {
8
- files: ["**/*.js"],
314
+ files: ["**/*.ts", "**/*.mts", "**/*.cts", "**/*.tsx"],
315
+ ignores: ["dist/**/*"],
316
+
317
+ languageOptions: {
318
+ parserOptions: { project: true },
319
+ parser: tseslint.parser,
320
+ sourceType: "module",
321
+ globals: globals.node,
322
+ },
323
+
324
+ plugins: {
325
+ tseslint: tseslint.plugin,
326
+ prettier,
327
+ // import: importPlugin,
328
+ },
329
+
330
+ rules: tsRules,
331
+ },
332
+ // JavaScript
333
+ {
334
+ files: ["**/*.js", "**/*.mjs", "**/*.cjs", "**/*.jsx"],
335
+ ignores: ["dist/**/*"],
9
336
 
10
337
  languageOptions: {
11
338
  ecmaVersion: "latest",
12
- sourceType: "commonjs",
339
+ sourceType: "module",
13
340
  globals: globals.node,
14
341
  },
15
342
 
16
- plugins: { prettier },
17
-
18
- rules: {
19
- "no-async-promise-executor": "off",
20
- "no-case-declarations": "off",
21
- "no-template-curly-in-string": "warn",
22
-
23
- "no-constructor-return": "error",
24
- "no-duplicate-imports": "error",
25
- "no-self-compare": "error",
26
- "no-unmodified-loop-condition": "error",
27
- "no-unreachable-loop": "error",
28
- "no-useless-assignment": "error",
29
- "no-useless-return": "error",
30
- "no-useless-rename": "error",
31
- "no-useless-constructor": "error",
32
- "no-useless-concat": "error",
33
- "no-useless-computed-key": "error",
34
- "no-unused-expressions": "error",
35
- "no-object-constructor": "error",
36
- "no-new-wrappers": "error",
37
- "no-new-func": "error",
38
- "no-new": "error",
39
- "no-negated-condition": "error",
40
- "no-multi-str": "error",
41
- "no-multi-assign": "error",
42
- "no-lonely-if": "error",
43
- "no-var": "error",
44
- yoda: "error",
45
- "prefer-template": "error",
46
- "prefer-rest-params": "error",
47
- "prefer-regex-literals": "error",
48
- "no-lone-blocks": "error",
49
- "no-labels": "error",
50
- "no-label-var": "error",
51
- "no-implied-eval": "error",
52
- "no-eval": "error",
53
- "no-eq-null": "error",
54
- "no-else-return": "error",
55
- "no-array-constructor": "error",
56
- "logical-assignment-operators": "error",
57
- eqeqeq: "error",
58
- "dot-notation": "error",
59
- "default-param-last": "error",
60
- "default-case-last": "error",
61
- "default-case": "error",
62
-
63
- "prefer-arrow-callback": ["error", { allowNamedFunctions: true }],
64
- "prefer-const": ["error", { destructuring: "all" }],
65
- curly: ["error", "multi-line"],
66
- "no-use-before-define": ["error", { functions: false, classes: false }],
67
- "object-shorthand": ["error", "always", { avoidQuotes: true }],
68
- "prefer-destructuring": ["error", { array: true, object: false }],
69
- "no-unneeded-ternary": ["error", { defaultAssignment: false }],
70
- "operator-assignment": ["error", "always"],
71
- "no-empty-function": ["error", { allow: ["arrowFunctions"] }],
72
-
73
- "prettier/prettier": [
74
- "error",
75
- {
76
- useTabs: true,
77
- endOfLine: "auto",
78
- printWidth: 123,
79
- },
80
- ],
343
+ plugins: {
344
+ prettier,
345
+ // import: importPlugin,
81
346
  },
347
+
348
+ rules: jsRules,
82
349
  },
83
- ];
350
+ );
package/index.js CHANGED
@@ -1 +1,3 @@
1
- module.exports = require("./eslint.config.js");
1
+ import config from "./eslint.config.js";
2
+
3
+ export default config;
package/package.json CHANGED
@@ -1,7 +1,8 @@
1
1
  {
2
2
  "name": "@xaliksss/eslint-config",
3
- "version": "2.0.1",
3
+ "version": "3.0.0",
4
4
  "main": "index.js",
5
+ "type": "module",
5
6
  "keywords": [
6
7
  "eslint",
7
8
  "config",
@@ -18,11 +19,12 @@
18
19
  },
19
20
  "license": "MIT",
20
21
  "dependencies": {
21
- "@eslint/js": "^9.0.0",
22
- "eslint-plugin-prettier": "^5.1.3",
23
- "globals": "^15.0.0"
22
+ "eslint-plugin-prettier": "^5.2.1",
23
+ "globals": "^15.9.0",
24
+ "typescript-eslint": "^8.2.0"
24
25
  },
25
26
  "peerDependencies": {
26
- "eslint": "^9.0.0"
27
+ "eslint": "^9.9.0",
28
+ "prettier": "^3.3.3"
27
29
  }
28
30
  }