@xaliksss/eslint-config 4.0.1 → 4.0.2

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.
package/dist/index.d.ts CHANGED
@@ -1,2 +1,2 @@
1
- declare const _default: import("eslint/config").Config[];
1
+ declare const _default: import("eslint/config").ConfigObject[];
2
2
  export default _default;
package/dist/index.js CHANGED
@@ -2,10 +2,11 @@ import { defineConfig } from 'eslint/config';
2
2
  import globals from "globals";
3
3
  import tseslint from "typescript-eslint";
4
4
  import stylisticPlugin from "@stylistic/eslint-plugin";
5
- import importPlugin from "eslint-plugin-import";
5
+ import importPlugin from "eslint-plugin-import-x";
6
+ import nPlugin from "eslint-plugin-n";
6
7
  import { eslintRules } from "./rules/eslint.js";
7
8
  import { stylisticRules } from "./rules/stylistic.js";
8
- import { importRules } from "./rules/import.js";
9
+ import { importRules } from "./rules/import-x.js";
9
10
  import { typescriptRules, typescriptTypeAwareRules } from "./rules/typescript.js";
10
11
  const IGNORES = [
11
12
  "**/dist/**",
@@ -29,7 +30,8 @@ export default defineConfig({
29
30
  },
30
31
  plugins: {
31
32
  "@stylistic": stylisticPlugin,
32
- import: importPlugin,
33
+ "import-x": importPlugin,
34
+ n: nPlugin,
33
35
  },
34
36
  rules: {
35
37
  ...eslintRules,
@@ -9,7 +9,7 @@ export const eslintRules = {
9
9
  "no-compare-neg-zero": "error",
10
10
  "no-cond-assign": "error",
11
11
  "no-const-assign": "error", // [TS]
12
- "no-constant-binary-expression": "error",
12
+ "no-constant-binary-expression": ["error", { checkRelationalComparisons: true }],
13
13
  "no-constant-condition": "error",
14
14
  "no-constructor-return": "error",
15
15
  "no-control-regex": "off", // запрещает делать regex с контрол-символами,
@@ -44,7 +44,7 @@ export const eslintRules = {
44
44
  "no-unassigned-vars": "error",
45
45
  "no-undef": "error", // [TS]
46
46
  "no-unexpected-multiline": "error",
47
- "no-unmodified-loop-condition": "error",
47
+ "no-unmodified-loop-condition": ["error", { checkConditionalExpressions: true }],
48
48
  "no-unreachable": "error", // [TS]
49
49
  "no-unreachable-loop": "error",
50
50
  "no-unsafe-finally": "error",
@@ -143,7 +143,7 @@ export const eslintRules = {
143
143
  "max-depth": "off",
144
144
  "max-lines": "off",
145
145
  "max-lines-per-function": "off",
146
- "max-nested-callbacks": ["error", { max: 3 }],
146
+ "max-nested-callbacks": ["error", { max: 3, checkConstructorCallCallbacks: true }],
147
147
  "max-params": ["error", { max: 6 }],
148
148
  "max-statements": "off",
149
149
  "new-cap": "off",
@@ -0,0 +1,61 @@
1
+ import { Linter } from "eslint";
2
+ export const importRules = {
3
+ "import-x/consistent-type-specifier-style": ["error", "prefer-top-level"],
4
+ "import-x/default": "error",
5
+ "import-x/dynamic-import-chunkname": "off",
6
+ "import-x/export": "error",
7
+ "import-x/exports-last": "off",
8
+ "import-x/extensions": "off", // Для каждого проекта должно быть свое решение
9
+ "import-x/first": "error",
10
+ "import-x/group-exports": "off",
11
+ "import-x/max-dependencies": "off",
12
+ "import-x/named": "error",
13
+ "import-x/namespace": "error",
14
+ "import-x/newline-after-import": ["error", { count: 1, considerComments: true }],
15
+ "import-x/no-absolute-path": "error",
16
+ "import-x/no-amd": "error",
17
+ "import-x/no-anonymous-default-export": "error",
18
+ "import-x/no-commonjs": "error",
19
+ "import-x/no-cycle": ["error", {
20
+ maxDepth: 4, // Возможно придется обновить на 1
21
+ ignoreExternal: true,
22
+ allowUnsafeDynamicCyclicDependency: false
23
+ }],
24
+ "import-x/no-default-export": "off",
25
+ "import-x/no-deprecated": "off", // С этим лучше справляется @typescript-eslint/no-deprecated
26
+ "import-x/no-duplicates": "off", // уже используем extensions
27
+ "import-x/no-dynamic-require": "error",
28
+ "import-x/no-empty-named-blocks": "error",
29
+ "import-x/no-extraneous-dependencies": "error",
30
+ "import-x/no-import-module-exports": "error",
31
+ "import-x/no-internal-modules": "off",
32
+ "import-x/no-mutable-exports": "error",
33
+ "import-x/no-named-as-default-member": "error",
34
+ "import-x/no-named-as-default": "error",
35
+ "import-x/no-named-default": "error",
36
+ "import-x/no-named-export": "off",
37
+ "import-x/no-namespace": "off",
38
+ "import-x/no-nodejs-modules": "off",
39
+ "import-x/no-relative-packages": "off",
40
+ "import-x/no-relative-parent-imports": "off",
41
+ "import-x/no-rename-default": "error",
42
+ "import-x/no-restricted-paths": "off", // в связке с no-restricted-imports от Eslint
43
+ "import-x/no-self-import": "error",
44
+ "import-x/no-unassigned-import": "off",
45
+ "import-x/no-unresolved": "off",
46
+ "import-x/no-unused-modules": ["error", { unusedExports: true, missingExports: false }],
47
+ "import-x/no-useless-path-segments": "error",
48
+ "import-x/no-webpack-loader-syntax": "error",
49
+ "import-x/order": ["error",
50
+ {
51
+ groups: ["builtin", "external", "type", "internal", "parent", "sibling", "index", "object"],
52
+ "newlines-between": "always",
53
+ alphabetize: { order: "asc" },
54
+ named: true,
55
+ "newlines-between-types": "ignore",
56
+ },
57
+ ],
58
+ "import-x/prefer-default-export": "off",
59
+ "import-x/prefer-namespace-import": "off",
60
+ "import-x/unambiguous": "error",
61
+ };
@@ -0,0 +1,2 @@
1
+ import { Linter } from "eslint";
2
+ export declare const nRules: Linter.RulesRecord;
@@ -0,0 +1,46 @@
1
+ import { Linter } from "eslint";
2
+ export const nRules = {
3
+ "n/callback-return": "error",
4
+ "n/exports-style": ["error", "exports"],
5
+ "n/file-extension-in-import": "off", // TypeScript знает лучше
6
+ "n/global-require": "error",
7
+ "n/handle-callback-err": "error",
8
+ "n/hashbang": "error",
9
+ "n/no-callback-literal": "off",
10
+ "n/no-deprecated-api": "error",
11
+ "n/no-exports-assign": "error",
12
+ "n/no-extraneous-import": "off", // есть import-x/no-extraneous-dependencies
13
+ "n/no-extraneous-require": "off", // есть import-x/no-extraneous-dependencies
14
+ "n/no-missing-import": "off", // есть import-x/no-unresolved
15
+ "n/no-missing-require": "off", // есть import-x/no-unresolved
16
+ "n/no-mixed-requires": "error", // есть import-x/order
17
+ "n/no-new-require": "error",
18
+ "n/no-path-concat": "error",
19
+ "n/no-process-env": "off",
20
+ "n/no-process-exit": "off",
21
+ "n/no-restricted-import": "off", // есть import-x/no-restricted-paths
22
+ "n/no-restricted-require": "off", // есть import-x/no-restricted-paths
23
+ "n/no-sync": "off",
24
+ "n/no-top-level-await": "off",
25
+ "n/no-unpublished-bin": "off", // > npm v10
26
+ "n/no-unpublished-import": "off",
27
+ "n/no-unpublished-require": "off",
28
+ "n/no-unsupported-features/es-builtins": "error",
29
+ "n/no-unsupported-features/es-syntax": "error",
30
+ "n/no-unsupported-features/node-builtins": "error",
31
+ "n/prefer-global/buffer": "error",
32
+ "n/prefer-global/console": "error",
33
+ "n/prefer-global/crypto": "error", // webcrypto
34
+ "n/prefer-global/process": "error",
35
+ "n/prefer-global/text-decoder": "error",
36
+ "n/prefer-global/text-encoder": "error",
37
+ "n/prefer-global/timers": "error",
38
+ "n/prefer-global/url": "error",
39
+ "n/prefer-global/url-search-params": "error",
40
+ "n/prefer-import/assert-strict": "error",
41
+ "n/prefer-node-protocol": "error",
42
+ "n/prefer-process-get-builtin-module": "off", // Мир пока не готов к process.getBuiltinModule()
43
+ "n/prefer-promises/dns": "error",
44
+ "n/prefer-promises/fs": "error",
45
+ "n/process-exit-as-throw": "error",
46
+ };
@@ -40,6 +40,7 @@ export const typescriptRules = {
40
40
  "@typescript-eslint/method-signature-style": ["error", "method"],
41
41
  "@typescript-eslint/no-array-constructor": "off", // есть no-array-constructor
42
42
  "@typescript-eslint/no-confusing-non-null-assertion": "error",
43
+ "@typescript-eslint/no-deprecated": "error",
43
44
  "@typescript-eslint/no-dupe-class-members": "off", // оно в TS вообще не нужно
44
45
  "@typescript-eslint/no-duplicate-enum-values": "error",
45
46
  "@typescript-eslint/no-dynamic-delete": "error",
@@ -52,7 +53,6 @@ export const typescriptRules = {
52
53
  "@typescript-eslint/no-inferrable-types": "error",
53
54
  "@typescript-eslint/no-invalid-this": "off", // есть no-invalid-this
54
55
  "@typescript-eslint/no-invalid-void-type": ["error", { allowAsThisParameter: true }],
55
- "@typescript-eslint/no-loop-func": "off", // есть no-loop-func
56
56
  "@typescript-eslint/no-magic-numbers": "off", // есть no-magic-numbers
57
57
  "@typescript-eslint/no-misused-new": "error",
58
58
  "@typescript-eslint/no-namespace": "error",
@@ -61,7 +61,6 @@ export const typescriptRules = {
61
61
  "@typescript-eslint/no-non-null-assertion": "off",
62
62
  "@typescript-eslint/no-redeclare": "off", // TS сам справится
63
63
  "@typescript-eslint/no-require-imports": "error",
64
- "@typescript-eslint/no-restricted-imports": "off", // есть no-restricted-imports
65
64
  "@typescript-eslint/no-restricted-types": "off",
66
65
  "@typescript-eslint/no-shadow": "off", // есть no-shadow
67
66
  "@typescript-eslint/no-this-alias": "error",
@@ -137,11 +136,7 @@ export const typescriptTypeAwareRules = {
137
136
  ],
138
137
  "@typescript-eslint/no-array-delete": "error",
139
138
  "@typescript-eslint/no-base-to-string": "error",
140
- "@typescript-eslint/no-confusing-void-expression": ["error",
141
- {
142
- ignoreVoidReturningFunctions: true,
143
- }
144
- ],
139
+ "@typescript-eslint/no-confusing-void-expression": "off",
145
140
  "@typescript-eslint/no-floating-promises": ["error", {
146
141
  ignoreIIFE: true,
147
142
  }],
package/package.json CHANGED
@@ -1,34 +1,35 @@
1
- {
2
- "name": "@xaliksss/eslint-config",
3
- "version": "4.0.1",
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
- }
1
+ {
2
+ "name": "@xaliksss/eslint-config",
3
+ "version": "4.0.2",
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.10.0",
27
+ "eslint-plugin-import-x": "^4.17.1",
28
+ "eslint-plugin-n": "^18.3.0",
29
+ "globals": "17.12.0",
30
+ "typescript-eslint": "8.69.0"
31
+ },
32
+ "devDependencies": {
33
+ "typescript": "^6.0.3"
34
+ }
35
+ }
@@ -1,57 +0,0 @@
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
- };
File without changes