@newsteam/eslint-config 1.2.2 → 1.2.3

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.
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AA+CA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAGrC,OAAO,yBAAyB,CAAC;AAsDjC,QAAA,MAAM,MAAM,EAAE,MAAM,CAAC,MAAM,EA2H1B,CAAC;AAIF,eAAe,MAAM,CAAC;AAGtB,OAAO,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAiDA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAGrC,OAAO,yBAAyB,CAAC;AAsDjC,QAAA,MAAM,MAAM,EAAE,MAAM,CAAC,MAAM,EA6H1B,CAAC;AAIF,eAAe,MAAM,CAAC;AAGtB,OAAO,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC"}
package/dist/index.js CHANGED
@@ -12,6 +12,8 @@
12
12
  */
13
13
  import babelParser from "@babel/eslint-parser";
14
14
  import eslintParser from "@typescript-eslint/parser";
15
+ import eslintImportResolverNode from "eslint-import-resolver-node";
16
+ import { resolve as eslintImportResolverTypescript } from "eslint-import-resolver-typescript";
15
17
  import global from "globals";
16
18
  import { arrayFuncPlugin } from "./plugins/array-function.js";
17
19
  import { constCasePlugin } from "./plugins/const-case.js";
@@ -27,12 +29,12 @@ import { noUselessAssignPlugin } from "./plugins/no-useless-assign.js";
27
29
  import { nodePlugin } from "./plugins/node.js";
28
30
  import { perfectionistPlugin } from "./plugins/perfectionist.js";
29
31
  import { promisePlugin } from "./plugins/promise.js";
30
- import { reactPlugin } from "./plugins/react.js";
31
32
  import { react19UpgradePlugin } from "./plugins/react-19-upgrade.js";
32
33
  import { reactCompilerPlugin } from "./plugins/react-compiler.js";
33
34
  import { reactHooksPlugin } from "./plugins/react-hooks.js";
34
35
  import { reactPerfPlugin } from "./plugins/react-perf.js";
35
36
  import { reactRefreshPlugin } from "./plugins/react-refresh.js";
37
+ import { reactPlugin } from "./plugins/react.js";
36
38
  import { securityPlugin } from "./plugins/security.js";
37
39
  import { stylisticPlugin } from "./plugins/stylistic.js";
38
40
  import { typescriptPlugin } from "./plugins/typescript.js";
@@ -47,10 +49,10 @@ const globals = {
47
49
  JSX: true,
48
50
  };
49
51
  const settings = {
50
- "import-x/resolver": {
51
- node: true,
52
- typescript: true,
53
- },
52
+ "import-x/resolver-next": [
53
+ eslintImportResolverNode,
54
+ eslintImportResolverTypescript,
55
+ ],
54
56
  react: {
55
57
  version: REACT_VERSION,
56
58
  },
@@ -195,6 +197,7 @@ const config = [
195
197
  rules: {
196
198
  "import-x/no-commonjs": "off",
197
199
  "import-x/unambiguous": "off",
200
+ "no-magic-numbers": "off",
198
201
  },
199
202
  },
200
203
  {
@@ -203,6 +206,7 @@ const config = [
203
206
  "**/dist/*",
204
207
  "**/dist_temp/*",
205
208
  "next-env.d.ts",
209
+ "*.gen.ts",
206
210
  ],
207
211
  },
208
212
  ];
@@ -1 +1 @@
1
- {"version":3,"file":"import-x.d.ts","sourceRoot":"","sources":["../../src/plugins/import-x.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAER,MAAM,EACT,MAAM,QAAQ,CAAC;AAGhB,eAAO,MAAM,aAAa,EAAE,MAAM,CAAC,MAAM,EA0exC,CAAC"}
1
+ {"version":3,"file":"import-x.d.ts","sourceRoot":"","sources":["../../src/plugins/import-x.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAER,MAAM,EACT,MAAM,QAAQ,CAAC;AAGhB,eAAO,MAAM,aAAa,EAAE,MAAM,CAAC,MAAM,EA2exC,CAAC"}
@@ -2,6 +2,7 @@ import eslintImportX from "eslint-plugin-import-x";
2
2
  export const importXPlugin = [
3
3
  {
4
4
  plugins: {
5
+ // eslint-disable-next-line @typescript-eslint/no-unsafe-type-assertion -- don't have a choice
5
6
  "import-x": eslintImportX,
6
7
  },
7
8
  rules: {
@@ -1 +1 @@
1
- {"version":3,"file":"more.d.ts","sourceRoot":"","sources":["../../src/plugins/more.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AASrC,eAAO,MAAM,UAAU,EAAE,MAAM,CAAC,MAAM,EA0GrC,CAAC"}
1
+ {"version":3,"file":"more.d.ts","sourceRoot":"","sources":["../../src/plugins/more.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAOrC,eAAO,MAAM,UAAU,EAAE,MAAM,CAAC,MAAM,EA0GrC,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"next.d.ts","sourceRoot":"","sources":["../../src/plugins/next.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AASrC,eAAO,MAAM,UAAU,EAAE,MAAM,CAAC,MAAM,EA2JrC,CAAC"}
1
+ {"version":3,"file":"next.d.ts","sourceRoot":"","sources":["../../src/plugins/next.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAOrC,eAAO,MAAM,UAAU,EAAE,MAAM,CAAC,MAAM,EA2JrC,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"perfectionist.d.ts","sourceRoot":"","sources":["../../src/plugins/perfectionist.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAER,MAAM,EACT,MAAM,QAAQ,CAAC;AAGhB,eAAO,MAAM,mBAAmB,EAAE,MAAM,CAAC,MAAM,EA0F9C,CAAC"}
1
+ {"version":3,"file":"perfectionist.d.ts","sourceRoot":"","sources":["../../src/plugins/perfectionist.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAER,MAAM,EACT,MAAM,QAAQ,CAAC;AAgBhB,eAAO,MAAM,mBAAmB,EAAE,MAAM,CAAC,MAAM,EA8F9C,CAAC"}
@@ -1,15 +1,30 @@
1
1
  import perfectionist from "eslint-plugin-perfectionist";
2
+ // perfectionist
3
+ // /
4
+ // sort-heritage-clauses
5
+ // Enforce sorted heritage clauses.
6
+ // perfectionist
7
+ // /
8
+ // sort-decorators
9
+ // Enforce sorted decorators.
10
+ // perfectionist
11
+ // /
12
+ // sort-modules
13
+ // Enforce sorted modules.
2
14
  export const perfectionistPlugin = [
3
15
  {
4
16
  plugins: {
17
+ // eslint-disable-next-line @typescript-eslint/no-unsafe-type-assertion -- don't have a choice
5
18
  perfectionist: perfectionist,
6
19
  },
7
20
  rules: {
8
21
  "perfectionist/sort-array-includes": "error",
9
22
  "perfectionist/sort-astro-attributes": "off",
10
23
  "perfectionist/sort-classes": "off",
24
+ "perfectionist/sort-decorators": "error",
11
25
  "perfectionist/sort-enums": "error",
12
26
  "perfectionist/sort-exports": "error",
27
+ "perfectionist/sort-heritage-clauses": "error",
13
28
  "perfectionist/sort-imports": [
14
29
  "error",
15
30
  {
@@ -27,8 +42,8 @@ export const perfectionistPlugin = [
27
42
  "unknown",
28
43
  ],
29
44
  internalPattern: [
30
- "@common/**",
31
- "@src/**",
45
+ "@common/.*",
46
+ "@src/.*",
32
47
  ],
33
48
  order: "asc",
34
49
  sortSideEffects: true,
@@ -58,6 +73,7 @@ export const perfectionistPlugin = [
58
73
  ],
59
74
  "perfectionist/sort-jsx-props": "error",
60
75
  "perfectionist/sort-maps": "error",
76
+ "perfectionist/sort-modules": "off",
61
77
  "perfectionist/sort-named-exports": "error",
62
78
  "perfectionist/sort-named-imports": "error",
63
79
  "perfectionist/sort-object-types": "error",
@@ -1 +1 @@
1
- {"version":3,"file":"promise.d.ts","sourceRoot":"","sources":["../../src/plugins/promise.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAQrC,eAAO,MAAM,aAAa,EAAE,MAAM,CAAC,MAAM,EAiIxC,CAAC"}
1
+ {"version":3,"file":"promise.d.ts","sourceRoot":"","sources":["../../src/plugins/promise.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAQrC,eAAO,MAAM,aAAa,EAAE,MAAM,CAAC,MAAM,EAwIxC,CAAC"}
@@ -102,6 +102,12 @@ export const promisePlugin = [
102
102
  * https://github.com/xjamundx/eslint-plugin-promise/blob/HEAD/docs/rules/prefer-await-to-then.md
103
103
  */
104
104
  "promise/prefer-await-to-then": "error",
105
+ /*
106
+ * Prefer catch to then(a, b)/then(null, b) for handling errors (promise/prefer-catch)
107
+ *
108
+ * https://github.com/xjamundx/eslint-plugin-promise/blob/HEAD/docs/rules/prefer-catch.md
109
+ */
110
+ "promise/prefer-catch": "error",
105
111
  /*
106
112
  * Disallow use of non-standard Promise static methods.
107
113
  *
@@ -1 +1 @@
1
- {"version":3,"file":"stylistic.d.ts","sourceRoot":"","sources":["../../src/plugins/stylistic.ts"],"names":[],"mappings":"AASA,OAAO,KAAK,EAER,MAAM,EACT,MAAM,QAAQ,CAAC;AAQhB,eAAO,MAAM,eAAe,EAAE,MAAM,CAAC,MAAM,EA67B1C,CAAC"}
1
+ {"version":3,"file":"stylistic.d.ts","sourceRoot":"","sources":["../../src/plugins/stylistic.ts"],"names":[],"mappings":"AASA,OAAO,KAAK,EAER,MAAM,EACT,MAAM,QAAQ,CAAC;AAQhB,eAAO,MAAM,eAAe,EAAE,MAAM,CAAC,MAAM,EA87B1C,CAAC"}
@@ -8,6 +8,7 @@ import { INDENT_SPACES, MAXIMUM_LINE_LENGTH, } from "../settings.js";
8
8
  export const stylisticPlugin = [
9
9
  {
10
10
  plugins: {
11
+ // eslint-disable-next-line @typescript-eslint/no-unsafe-type-assertion -- don't have a choice
11
12
  "@stylistic": stylistic,
12
13
  },
13
14
  rules: {
@@ -1 +1 @@
1
- {"version":3,"file":"typescript.d.ts","sourceRoot":"","sources":["../../src/plugins/typescript.ts"],"names":[],"mappings":"AAoBA,OAAO,KAAK,EAER,MAAM,EACT,MAAM,QAAQ,CAAC;AAQhB,eAAO,MAAM,gBAAgB,EAAE,MAAM,CAAC,MAAM,EAktC3C,CAAC"}
1
+ {"version":3,"file":"typescript.d.ts","sourceRoot":"","sources":["../../src/plugins/typescript.ts"],"names":[],"mappings":"AAoBA,OAAO,KAAK,EAER,MAAM,EACT,MAAM,QAAQ,CAAC;AAQhB,eAAO,MAAM,gBAAgB,EAAE,MAAM,CAAC,MAAM,EAmwC3C,CAAC"}
@@ -35,6 +35,7 @@ export const typescriptPlugin = [
35
35
  "no-magic-numbers": "off",
36
36
  "no-redeclare": "off",
37
37
  "no-shadow": "off",
38
+ "no-throw-literal": "off",
38
39
  "no-undef": "off",
39
40
  "no-undef-init": "off",
40
41
  "no-undefined": "off",
@@ -47,6 +48,7 @@ export const typescriptPlugin = [
47
48
  {
48
49
  files: ["**/*.{ts,tsx}"],
49
50
  plugins: {
51
+ // eslint-disable-next-line @typescript-eslint/no-unsafe-type-assertion -- don't have a choice
50
52
  "@typescript-eslint": plugin,
51
53
  },
52
54
  rules: {
@@ -91,7 +93,10 @@ export const typescriptPlugin = [
91
93
  *
92
94
  * https://github.com/typescript-eslint/typescript-eslint/blob/main/packages/eslint-plugin/docs/rules/class-methods-use-this.mdx
93
95
  */
94
- "@typescript-eslint/class-methods-use-this": "error",
96
+ "@typescript-eslint/class-methods-use-this": [
97
+ "error",
98
+ { ignoreClassesThatImplementAnInterface: true },
99
+ ],
95
100
  /*
96
101
  * Enforces specifying generic type arguments on type annotation or constructor name of a constructor call.
97
102
  *
@@ -564,7 +569,21 @@ export const typescriptPlugin = [
564
569
  *
565
570
  * https://github.com/typescript-eslint/typescript-eslint/blob/main/packages/eslint-plugin/docs/rules/no-misused-promises.mdx
566
571
  */
567
- "@typescript-eslint/no-misused-promises": "error",
572
+ "@typescript-eslint/no-misused-promises": [
573
+ "error",
574
+ {
575
+ checksConditionals: true,
576
+ checksSpreads: true,
577
+ checksVoidReturn: {
578
+ arguments: true,
579
+ attributes: false,
580
+ inheritedMethods: true,
581
+ properties: true,
582
+ returns: true,
583
+ variables: true,
584
+ },
585
+ },
586
+ ],
568
587
  /*
569
588
  * Disallow enums from having both number and string members.
570
589
  *
@@ -770,6 +789,12 @@ export const typescriptPlugin = [
770
789
  * https://github.com/typescript-eslint/typescript-eslint/blob/main/packages/eslint-plugin/docs/rules/no-unsafe-return.mdx
771
790
  */
772
791
  "@typescript-eslint/no-unsafe-return": "error",
792
+ /*
793
+ * Disallow type assertions that narrow a type.
794
+ *
795
+ * https://github.com/typescript-eslint/typescript-eslint/blob/main/packages/eslint-plugin/docs/rules/no-unsafe-type-assertion.mdx
796
+ */
797
+ "@typescript-eslint/no-unsafe-type-assertion": "error",
773
798
  /*
774
799
  * Require unary negation to take a number.
775
800
  *
@@ -830,7 +855,22 @@ export const typescriptPlugin = [
830
855
  *
831
856
  * https://github.com/typescript-eslint/typescript-eslint/blob/main/packages/eslint-plugin/docs/rules/only-throw-error.mdx
832
857
  */
833
- "@typescript-eslint/only-throw-error": "error",
858
+ "@typescript-eslint/only-throw-error": [
859
+ "error",
860
+ {
861
+ allow: [
862
+ {
863
+ from: "package",
864
+ name: [
865
+ "NotFoundError",
866
+ "Redirect",
867
+ "Redirect<TRouter, TFrom, TTo, TMaskFrom, TMaskTo>",
868
+ ],
869
+ package: "@tanstack/react-router",
870
+ },
871
+ ],
872
+ },
873
+ ],
834
874
  /*
835
875
  * Disallow the use of parameter properties in class constructors.
836
876
  *
@@ -961,6 +1001,12 @@ export const typescriptPlugin = [
961
1001
  * https://github.com/typescript-eslint/typescript-eslint/blob/main/packages/eslint-plugin/docs/rules/promise-function-async.mdx
962
1002
  */
963
1003
  "@typescript-eslint/promise-function-async": "off",
1004
+ /*
1005
+ * Enforce that `get()` types should be assignable to their equivalent `set()` type.
1006
+ *
1007
+ * https://github.com/typescript-eslint/typescript-eslint/blob/main/packages/eslint-plugin/docs/rules/related-getter-setter-pairs.mdx
1008
+ */
1009
+ "@typescript-eslint/related-getter-setter-pairs": "error",
964
1010
  /*
965
1011
  * Enforce giving compare argument to Array#sort
966
1012
  *
@@ -1 +1 @@
1
- {"version":3,"file":"unicorn.d.ts","sourceRoot":"","sources":["../../src/plugins/unicorn.ts"],"names":[],"mappings":"AAiBA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAQrC,eAAO,MAAM,aAAa,EAAE,MAAM,CAAC,MAAM,EA69BxC,CAAC"}
1
+ {"version":3,"file":"unicorn.d.ts","sourceRoot":"","sources":["../../src/plugins/unicorn.ts"],"names":[],"mappings":"AAiBA,OAAO,KAAK,EAER,MAAM,EACT,MAAM,QAAQ,CAAC;AAQhB,eAAO,MAAM,aAAa,EAAE,MAAM,CAAC,MAAM,EA69BxC,CAAC"}
@@ -9,7 +9,7 @@
9
9
  not really an issue in a file like this, it's just a big list
10
10
 
11
11
  */
12
- import unicorn from "eslint-plugin-unicorn";
12
+ import eslintPluginUnicorn from "eslint-plugin-unicorn";
13
13
  /*
14
14
  * Various awesome ESLint rules
15
15
  *
@@ -18,7 +18,7 @@ import unicorn from "eslint-plugin-unicorn";
18
18
  export const unicornPlugin = [
19
19
  {
20
20
  plugins: {
21
- unicorn,
21
+ unicorn: eslintPluginUnicorn,
22
22
  },
23
23
  rules: {
24
24
  /*
@@ -91,7 +91,7 @@ export const unicornPlugin = [
91
91
  *
92
92
  * https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/expiring-todo-comments.md
93
93
  */
94
- "unicorn/expiring-todo-comments": "error",
94
+ "unicorn/expiring-todo-comments": "off",
95
95
  /*
96
96
  * Enforce explicitly comparing the length property of a value. (partly fixable)
97
97
  *
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@newsteam/eslint-config",
3
- "version": "1.2.2",
3
+ "version": "1.2.3",
4
4
  "description": "Shared config for eslint",
5
5
  "main": "./dist/index.js",
6
6
  "types": "./dist/index.d.ts",
@@ -11,6 +11,7 @@
11
11
  "depcheck": "depcheck || true",
12
12
  "lint": "npm run lint:eslint && npm run depcheck && npm run prune",
13
13
  "lint:eslint": "eslint --fix",
14
+ "lint:eslint:inspect": "eslint --inspect-config",
14
15
  "prepublishOnly": "npm run clean && npm run build && npm run lint && npm run test",
15
16
  "prune": "ts-prune",
16
17
  "reinstall": "rimraf node_modules package-lock.json pnpm-lock.yaml .turbo",
@@ -53,43 +54,45 @@
53
54
  "dependencies": {
54
55
  "@babel/eslint-parser": "^7.25.9",
55
56
  "@babel/preset-env": "^7.26.0",
56
- "@eslint/compat": "^1.2.2",
57
- "@next/eslint-plugin-next": "^15.0.2",
58
- "@stylistic/eslint-plugin": "^2.10.1",
59
- "@typescript-eslint/eslint-plugin": "^8.12.2",
60
- "@typescript-eslint/parser": "^8.12.2",
57
+ "@eslint/compat": "^1.2.4",
58
+ "@next/eslint-plugin-next": "^15.1.0",
59
+ "@stylistic/eslint-plugin": "^2.12.1",
60
+ "@typescript-eslint/eslint-plugin": "^8.18.0",
61
+ "@typescript-eslint/parser": "^8.18.0",
61
62
  "confusing-browser-globals": "^1.0.11",
63
+ "eslint-import-resolver-node": "^0.3.9",
64
+ "eslint-import-resolver-typescript": "^3.7.0",
62
65
  "eslint-plugin-array-func": "^5.0.2",
63
66
  "eslint-plugin-const-case": "^1.2.2",
64
67
  "eslint-plugin-css-modules": "^2.12.0",
65
68
  "eslint-plugin-destructuring": "^2.2.1",
66
69
  "eslint-plugin-eslint-comments": "^3.2.0",
67
70
  "eslint-plugin-import-newlines": "^1.4.0",
68
- "eslint-plugin-import-x": "^4.4.0",
71
+ "eslint-plugin-import-x": "^4.5.0",
69
72
  "eslint-plugin-more": "^1.0.5",
70
73
  "eslint-plugin-newline-destructuring": "^1.2.2",
71
74
  "eslint-plugin-no-unsanitized": "^4.1.2",
72
75
  "eslint-plugin-no-useless-assign": "^1.0.3",
73
76
  "eslint-plugin-node": "^11.1.0",
74
77
  "eslint-plugin-only-warn": "^1.1.0",
75
- "eslint-plugin-perfectionist": "^3.9.1",
76
- "eslint-plugin-promise": "^7.1.0",
78
+ "eslint-plugin-perfectionist": "^4.2.0",
79
+ "eslint-plugin-promise": "^7.2.1",
77
80
  "eslint-plugin-react": "^7.37.2",
78
81
  "eslint-plugin-react-19-upgrade": "^1.6.0",
79
- "eslint-plugin-react-compiler": "19.0.0-beta-9ee70a1-20241017",
80
- "eslint-plugin-react-hooks": "^5.0.0",
82
+ "eslint-plugin-react-compiler": "19.0.0-beta-df7b47d-20241124",
83
+ "eslint-plugin-react-hooks": "^5.1.0",
81
84
  "eslint-plugin-react-perf": "^3.3.3",
82
- "eslint-plugin-react-refresh": "^0.4.14",
85
+ "eslint-plugin-react-refresh": "^0.4.16",
83
86
  "eslint-plugin-security": "^3.0.1",
84
- "eslint-plugin-unicorn": "^56.0.0",
85
- "globals": "^15.11.0",
86
- "typescript-eslint": "^8.12.2"
87
+ "eslint-plugin-unicorn": "^56.0.1",
88
+ "globals": "^15.13.0",
89
+ "typescript-eslint": "^8.18.0"
87
90
  },
88
91
  "peerDependencies": {
89
92
  "eslint": ">= 9"
90
93
  },
91
94
  "devDependencies": {
92
95
  "@types/eslint-plugin-security": "^3.0.0",
93
- "@types/node": "^22.8.7"
96
+ "@types/node": "^22.10.1"
94
97
  }
95
98
  }