@peerigon/configs 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.
Files changed (32) hide show
  1. package/CHANGELOG.md +22 -0
  2. package/README.md +1 -1
  3. package/eslint/presets/javascript-browser.js +9 -1
  4. package/eslint/presets/javascript-node.js +9 -1
  5. package/eslint/presets/javascript.js +4 -1
  6. package/eslint/presets/typescript-node.js +4 -1
  7. package/eslint/presets/typescript-react.js +4 -1
  8. package/eslint/presets/typescript.js +9 -1
  9. package/eslint/presets/typescript.test/main.ts +7 -0
  10. package/eslint/rules/javascript.js +2 -0
  11. package/eslint/rules/typescript.js +193 -193
  12. package/package.json +20 -20
  13. package/types/eslint/presets/javascript-browser.d.ts +3 -3
  14. package/types/eslint/presets/javascript-browser.d.ts.map +1 -1
  15. package/types/eslint/presets/javascript-node.d.ts +3 -3
  16. package/types/eslint/presets/javascript-node.d.ts.map +1 -1
  17. package/types/eslint/presets/javascript.d.ts +3 -3
  18. package/types/eslint/presets/javascript.d.ts.map +1 -1
  19. package/types/eslint/presets/typescript-node.d.ts +3 -3
  20. package/types/eslint/presets/typescript-node.d.ts.map +1 -1
  21. package/types/eslint/presets/typescript-react.d.ts +3 -3
  22. package/types/eslint/presets/typescript-react.d.ts.map +1 -1
  23. package/types/eslint/presets/typescript.d.ts +3 -3
  24. package/types/eslint/presets/typescript.d.ts.map +1 -1
  25. package/types/eslint/rules/javascript.d.ts.map +1 -1
  26. package/types/eslint/rules/typescript.d.ts +2 -1
  27. package/types/eslint/rules/typescript.d.ts.map +1 -1
  28. package/types/eslint/styles/no-default-export.test/eslint.config.d.ts +1 -1
  29. package/types/eslint/styles/no-null.test/eslint.config.d.ts +1 -1
  30. package/types/eslint/styles/prefer-array-shorthand.test/eslint.config.d.ts +1 -1
  31. package/types/eslint/styles/prefer-interface.test/eslint.config.d.ts +1 -1
  32. package/typescript/base.json +4 -0
package/CHANGELOG.md CHANGED
@@ -1,3 +1,25 @@
1
+ # [4.0.0](https://github.com/peerigon/configs/compare/v3.2.0...v4.0.0) (2025-03-06)
2
+
3
+ ### Features
4
+
5
+ - Update dependencies ([37d1288](https://github.com/peerigon/configs/commit/37d1288e614ebcb0c3dc5b59d88aaa48ef40ebd3))
6
+
7
+ ### BREAKING CHANGES
8
+
9
+ - Updated some peerDependencies
10
+
11
+ # [3.2.0](https://github.com/peerigon/configs/compare/v3.1.0...v3.2.0) (2025-03-06)
12
+
13
+ ### Bug Fixes
14
+
15
+ - Incorrect types returned by presets ([5744961](https://github.com/peerigon/configs/commit/5744961bb760c48738a4a74e8ae0d4f2bfe0abe5))
16
+ - Turn off consistent-return rule in TypeScript files ([0830152](https://github.com/peerigon/configs/commit/08301524f081fc2223c2ad72bf6cb630735ac712))
17
+ - Turn off no-new for tests ([26bc778](https://github.com/peerigon/configs/commit/26bc778ff2239cc61acb21825b72ca15ee3c1ef3))
18
+
19
+ ### Features
20
+
21
+ - Improve base tsconfig ([392b0ff](https://github.com/peerigon/configs/commit/392b0ff6b552e926c3ff77867952627e63f6a496))
22
+
1
23
  # [3.1.0](https://github.com/peerigon/configs/compare/v3.0.0...v3.1.0) (2025-03-03)
2
24
 
3
25
  ### Features
package/README.md CHANGED
@@ -10,7 +10,7 @@
10
10
  ## Installation
11
11
 
12
12
  ```sh
13
- npm install @peerigon/configs
13
+ npm install @peerigon/configs --save-dev
14
14
  ```
15
15
 
16
16
  Also checkout the instructions for each respective config:
@@ -3,4 +3,12 @@ import { base } from "../rules/base.js";
3
3
  import { browser } from "../rules/browser.js";
4
4
  import { javascript } from "../rules/javascript.js";
5
5
 
6
- export default [...base, ...javascript, ...browser, eslintConfigPrettier];
6
+ /** @type {import("eslint").Linter.Config[]} */
7
+ export const javascriptBrowserPreset = [
8
+ ...base,
9
+ ...javascript,
10
+ ...browser,
11
+ eslintConfigPrettier,
12
+ ];
13
+
14
+ export default javascriptBrowserPreset;
@@ -3,4 +3,12 @@ import { base } from "../rules/base.js";
3
3
  import { javascript } from "../rules/javascript.js";
4
4
  import { node } from "../rules/node.js";
5
5
 
6
- export default [...base, ...javascript, ...node, eslintConfigPrettier];
6
+ /** @type {import("eslint").Linter.Config[]} */
7
+ export const javascriptNodePreset = [
8
+ ...base,
9
+ ...javascript,
10
+ ...node,
11
+ eslintConfigPrettier,
12
+ ];
13
+
14
+ export default javascriptNodePreset;
@@ -2,4 +2,7 @@ import eslintConfigPrettier from "eslint-config-prettier";
2
2
  import { base } from "../rules/base.js";
3
3
  import { javascript } from "../rules/javascript.js";
4
4
 
5
- export default [...base, ...javascript, eslintConfigPrettier];
5
+ /** @type {import("eslint").Linter.Config[]} */
6
+ export const javascriptPreset = [...base, ...javascript, eslintConfigPrettier];
7
+
8
+ export default javascriptPreset;
@@ -4,10 +4,13 @@ import { javascript } from "../rules/javascript.js";
4
4
  import { node } from "../rules/node.js";
5
5
  import { typescript } from "../rules/typescript.js";
6
6
 
7
- export default [
7
+ /** @type {import("eslint").Linter.Config[]} */
8
+ export const typescriptNodePreset = [
8
9
  ...base,
9
10
  ...javascript,
10
11
  ...typescript,
11
12
  ...node,
12
13
  eslintConfigPrettier,
13
14
  ];
15
+
16
+ export default typescriptNodePreset;
@@ -5,7 +5,8 @@ import { javascript } from "../rules/javascript.js";
5
5
  import { react } from "../rules/react.js";
6
6
  import { typescript } from "../rules/typescript.js";
7
7
 
8
- export default [
8
+ /** @type {import("eslint").Linter.Config[]} */
9
+ export const typescriptReactPreset = [
9
10
  ...base,
10
11
  ...javascript,
11
12
  ...typescript,
@@ -13,3 +14,5 @@ export default [
13
14
  ...browser,
14
15
  eslintConfigPrettier,
15
16
  ];
17
+
18
+ export default typescriptReactPreset;
@@ -3,4 +3,12 @@ import { base } from "../rules/base.js";
3
3
  import { javascript } from "../rules/javascript.js";
4
4
  import { typescript } from "../rules/typescript.js";
5
5
 
6
- export default [...base, ...javascript, ...typescript, eslintConfigPrettier];
6
+ /** @type {import("eslint").Linter.Config[]} */
7
+ export const typescriptPreset = [
8
+ ...base,
9
+ ...javascript,
10
+ ...typescript,
11
+ eslintConfigPrettier,
12
+ ];
13
+
14
+ export default typescriptPreset;
@@ -33,3 +33,10 @@ type SomeType = {
33
33
  };
34
34
 
35
35
  console.log(getMessage(), SomeClass, snake_case, test);
36
+
37
+ /* @ts-expect-error Inconsistent returns should be caught by TypeScript */
38
+ (() => {
39
+ if (Math.random() > 0.5) {
40
+ return true;
41
+ }
42
+ })();
@@ -148,6 +148,8 @@ export const javascript = [
148
148
  "unicorn/prefer-top-level-await": "off",
149
149
  // Nesting is pretty common in tests when you group tests
150
150
  "max-nested-callbacks": "off",
151
+ // In case you want to test errors thrown by a constructor
152
+ "no-new": "off",
151
153
  },
152
154
  },
153
155
  ];
@@ -3,204 +3,204 @@ import tsEslint from "typescript-eslint";
3
3
  import { globPatterns } from "../lib/glob-patterns.js";
4
4
  import { ruleOptions } from "../lib/rule-options.js";
5
5
 
6
- // Type annotation doesn't work here because of type inconsistencies
7
- // between eslint and typescript-eslint.
8
- /*
9
- * @type {Array<import("eslint").Linter.Config>}
10
- */
11
- export const typescript = tsEslint.config(
12
- ...tsEslint.configs.strictTypeChecked,
13
- ...tsEslint.configs.stylisticTypeChecked,
14
- /** @type {import("eslint").Linter.Config} */
15
- {
16
- languageOptions: {
17
- parserOptions: {
18
- projectService: true,
19
- },
20
- },
21
- },
22
- /** @type {import("eslint").Linter.Config} */
23
- {
24
- files: [
25
- globPatterns.typescript,
26
- globPatterns.typescriptAmbient,
27
- globPatterns.typescriptJsx,
28
- ],
29
- plugins: {
30
- ["prefer-arrow"]: preferArrow,
31
- },
32
- rules: {
33
- "@typescript-eslint/array-type": ["warn", { default: "generic" }],
34
- "@typescript-eslint/ban-ts-comment": [
35
- // https://typescript-eslint.io/rules/ban-ts-comment
36
- "warn",
37
- {
38
- "ts-expect-error": "allow-with-description",
39
- },
40
- ],
41
- "@typescript-eslint/class-literal-property-style": "off", // https://typescript-eslint.io/rules/class-literal-property-style
42
- "@typescript-eslint/consistent-type-definitions": ["warn", "type"], // https://typescript-eslint.io/rules/consistent-type-definitions
43
- "@typescript-eslint/explicit-member-accessibility": [
44
- // https://typescript-eslint.io/rules/explicit-member-accessibility
45
- "warn",
46
- {
47
- accessibility: "no-public",
48
- overrides: {
49
- parameterProperties: "explicit",
6
+ /** @type {import("eslint").Linter.Config[]} */
7
+ export const typescript =
8
+ // We need to do a type assertion here because tsEslint.config() returns
9
+ // something that is not assignable to import("eslint").Linter.Config[].
10
+ // This seems to be a type inconsistency between eslint and typescript-eslint.
11
+ /** @type {import("eslint").Linter.Config[]} */ (
12
+ tsEslint.config(
13
+ ...tsEslint.configs.strictTypeChecked,
14
+ ...tsEslint.configs.stylisticTypeChecked,
15
+ {
16
+ languageOptions: {
17
+ parserOptions: {
18
+ projectService: true,
50
19
  },
51
20
  },
52
- ],
53
- "@typescript-eslint/method-signature-style": ["warn", "property"], // https://typescript-eslint.io/rules/method-signature-style
54
- "@typescript-eslint/naming-convention": [
55
- // https://typescript-eslint.io/rules/naming-convention
56
- "warn",
57
- ...ruleOptions["@typescript-eslint/naming-convention"].defaultRules,
58
- ],
59
- "@typescript-eslint/no-base-to-string": "off", // https://typescript-eslint.io/rules/no-base-to-string
60
- "@typescript-eslint/no-confusing-void-expression": [
61
- // https://typescript-eslint.io/rules/no-confusing-void-expression
62
- "off",
63
- {
64
- ignoreArrowShorthand: true,
65
- ignoreVoidOperator: true,
66
- },
67
- ],
68
- "@typescript-eslint/no-empty-function": "off", // https://typescript-eslint.io/rules/no-empty-function
69
- "@typescript-eslint/no-empty-interface": "off", // https://typescript-eslint.io/rules/no-empty-interface
70
- // `any` is sometimes useful for small and abstract functions.
71
- // Should only be used in isolated parts of the codebase.
72
- // Appropriate usage can only be checked in a PR review.
73
- "@typescript-eslint/no-explicit-any": [
74
- // https://typescript-eslint.io/rules/no-explicit-any
75
- "off",
76
- {
77
- fixToUnknown: false,
78
- ignoreRestArgs: true,
79
- },
80
- ],
81
- "@typescript-eslint/no-non-null-assertion": "off", // https://typescript-eslint.io/rules/no-non-null-assertion
82
- "@typescript-eslint/no-unnecessary-boolean-literal-compare": "off", // https://typescript-eslint.io/rules/no-unnecessary-boolean-literal-compare
83
- "@typescript-eslint/no-unnecessary-condition": [
84
- "warn",
85
- {
86
- allowConstantLoopConditions: true,
87
- },
88
- ], // https://typescript-eslint.io/rules/no-unnecessary-condition
89
- "@typescript-eslint/no-unnecessary-qualifier": "warn", // https://typescript-eslint.io/rules/no-unnecessary-qualifier
90
- "@typescript-eslint/no-unsafe-argument": "off", // https://typescript-eslint.io/rules/no-unsafe-argument
91
- "@typescript-eslint/no-unsafe-assignment": "off", // https://typescript-eslint.io/rules/no-unsafe-assignment
92
- "@typescript-eslint/no-unsafe-call": "off", // https://typescript-eslint.io/rules/no-unsafe-call
93
- "@typescript-eslint/no-unsafe-member-access": "off", // https://typescript-eslint.io/rules/no-unsafe-member-access
94
- "@typescript-eslint/no-unused-expressions": [
95
- // https://typescript-eslint.io/rules/no-unused-expressions
96
- "warn",
97
- {
98
- allowShortCircuit: true,
99
- allowTernary: true,
100
- },
101
- ],
102
- "@typescript-eslint/no-unused-vars": [
103
- // https://typescript-eslint.io/rules/no-unused-vars
104
- "error",
105
- ruleOptions["no-unused-vars"],
106
- ],
107
- "@typescript-eslint/promise-function-async": [
108
- // https://typescript-eslint.io/rules/promise-function-async
109
- "warn",
110
- {
111
- allowAny: true,
112
- allowedPromiseNames: [],
113
- checkArrowFunctions: true,
114
- checkFunctionDeclarations: true,
115
- checkFunctionExpressions: true,
116
- checkMethodDeclarations: true,
117
- },
118
- ],
119
- "@typescript-eslint/require-await": "off", // https://typescript-eslint.io/rules/require-await
120
- "@typescript-eslint/restrict-plus-operands": "off", // https://typescript-eslint.io/rules/restrict-plus-operands
121
- "@typescript-eslint/restrict-template-expressions": [
122
- // https://typescript-eslint.io/rules/restrict-template-expressions
123
- "off",
124
- {
125
- allowBoolean: false,
126
- allowNullable: false,
127
- allowNumber: true,
21
+ },
22
+ {
23
+ files: [
24
+ globPatterns.typescript,
25
+ globPatterns.typescriptAmbient,
26
+ globPatterns.typescriptJsx,
27
+ ],
28
+ plugins: {
29
+ ["prefer-arrow"]: preferArrow,
128
30
  },
129
- ],
130
- "no-return-await": "off",
131
- "@typescript-eslint/return-await": ["warn", "in-try-catch"], // https://typescript-eslint.io/rules/return-await
132
- "@typescript-eslint/switch-exhaustiveness-check": [
133
- "warn",
134
- {
135
- // It should not be necessary to list all possible values for a union type
136
- // explicitly in a switch statement. E.g. if the types are generated, we don't
137
- // want to adjust all switch statements every time the types are changed.
138
- considerDefaultExhaustiveForUnions: true,
31
+ rules: {
32
+ "@typescript-eslint/array-type": ["warn", { default: "generic" }],
33
+ "@typescript-eslint/ban-ts-comment": [
34
+ // https://typescript-eslint.io/rules/ban-ts-comment
35
+ "warn",
36
+ {
37
+ "ts-expect-error": "allow-with-description",
38
+ },
39
+ ],
40
+ "@typescript-eslint/class-literal-property-style": "off", // https://typescript-eslint.io/rules/class-literal-property-style
41
+ "@typescript-eslint/consistent-type-definitions": ["warn", "type"], // https://typescript-eslint.io/rules/consistent-type-definitions
42
+ "@typescript-eslint/explicit-member-accessibility": [
43
+ // https://typescript-eslint.io/rules/explicit-member-accessibility
44
+ "warn",
45
+ {
46
+ accessibility: "no-public",
47
+ overrides: {
48
+ parameterProperties: "explicit",
49
+ },
50
+ },
51
+ ],
52
+ "@typescript-eslint/method-signature-style": ["warn", "property"], // https://typescript-eslint.io/rules/method-signature-style
53
+ "@typescript-eslint/naming-convention": [
54
+ // https://typescript-eslint.io/rules/naming-convention
55
+ "warn",
56
+ ...ruleOptions["@typescript-eslint/naming-convention"].defaultRules,
57
+ ],
58
+ "@typescript-eslint/no-base-to-string": "off", // https://typescript-eslint.io/rules/no-base-to-string
59
+ "@typescript-eslint/no-confusing-void-expression": [
60
+ // https://typescript-eslint.io/rules/no-confusing-void-expression
61
+ "off",
62
+ {
63
+ ignoreArrowShorthand: true,
64
+ ignoreVoidOperator: true,
65
+ },
66
+ ],
67
+ "@typescript-eslint/no-empty-function": "off", // https://typescript-eslint.io/rules/no-empty-function
68
+ "@typescript-eslint/no-empty-interface": "off", // https://typescript-eslint.io/rules/no-empty-interface
69
+ // `any` is sometimes useful for small and abstract functions.
70
+ // Should only be used in isolated parts of the codebase.
71
+ // Appropriate usage can only be checked in a PR review.
72
+ "@typescript-eslint/no-explicit-any": [
73
+ // https://typescript-eslint.io/rules/no-explicit-any
74
+ "off",
75
+ {
76
+ fixToUnknown: false,
77
+ ignoreRestArgs: true,
78
+ },
79
+ ],
80
+ "@typescript-eslint/no-non-null-assertion": "off", // https://typescript-eslint.io/rules/no-non-null-assertion
81
+ "@typescript-eslint/no-unnecessary-boolean-literal-compare": "off", // https://typescript-eslint.io/rules/no-unnecessary-boolean-literal-compare
82
+ "@typescript-eslint/no-unnecessary-condition": [
83
+ "warn",
84
+ {
85
+ allowConstantLoopConditions: true,
86
+ },
87
+ ], // https://typescript-eslint.io/rules/no-unnecessary-condition
88
+ "@typescript-eslint/no-unnecessary-qualifier": "warn", // https://typescript-eslint.io/rules/no-unnecessary-qualifier
89
+ "@typescript-eslint/no-unsafe-argument": "off", // https://typescript-eslint.io/rules/no-unsafe-argument
90
+ "@typescript-eslint/no-unsafe-assignment": "off", // https://typescript-eslint.io/rules/no-unsafe-assignment
91
+ "@typescript-eslint/no-unsafe-call": "off", // https://typescript-eslint.io/rules/no-unsafe-call
92
+ "@typescript-eslint/no-unsafe-member-access": "off", // https://typescript-eslint.io/rules/no-unsafe-member-access
93
+ "@typescript-eslint/no-unused-expressions": [
94
+ // https://typescript-eslint.io/rules/no-unused-expressions
95
+ "warn",
96
+ {
97
+ allowShortCircuit: true,
98
+ allowTernary: true,
99
+ },
100
+ ],
101
+ "@typescript-eslint/no-unused-vars": [
102
+ // https://typescript-eslint.io/rules/no-unused-vars
103
+ "error",
104
+ ruleOptions["no-unused-vars"],
105
+ ],
106
+ "@typescript-eslint/promise-function-async": [
107
+ // https://typescript-eslint.io/rules/promise-function-async
108
+ "warn",
109
+ {
110
+ allowAny: true,
111
+ allowedPromiseNames: [],
112
+ checkArrowFunctions: true,
113
+ checkFunctionDeclarations: true,
114
+ checkFunctionExpressions: true,
115
+ checkMethodDeclarations: true,
116
+ },
117
+ ],
118
+ "@typescript-eslint/require-await": "off", // https://typescript-eslint.io/rules/require-await
119
+ "@typescript-eslint/restrict-plus-operands": "off", // https://typescript-eslint.io/rules/restrict-plus-operands
120
+ "@typescript-eslint/restrict-template-expressions": [
121
+ // https://typescript-eslint.io/rules/restrict-template-expressions
122
+ "off",
123
+ {
124
+ allowBoolean: false,
125
+ allowNullable: false,
126
+ allowNumber: true,
127
+ },
128
+ ],
129
+ // TS' noImplicitReturns catches this already more effectively
130
+ "consistent-return": "off",
131
+ "no-return-await": "off",
132
+ "@typescript-eslint/return-await": ["warn", "in-try-catch"], // https://typescript-eslint.io/rules/return-await
133
+ "@typescript-eslint/switch-exhaustiveness-check": [
134
+ "warn",
135
+ {
136
+ // It should not be necessary to list all possible values for a union type
137
+ // explicitly in a switch statement. E.g. if the types are generated, we don't
138
+ // want to adjust all switch statements every time the types are changed.
139
+ considerDefaultExhaustiveForUnions: true,
140
+ },
141
+ ], // https://typescript-eslint.io/rules/switch-exhaustiveness-check
142
+ camelcase: "off",
143
+ "max-lines": [
144
+ "warn",
145
+ {
146
+ max: 1400,
147
+ skipBlankLines: true,
148
+ skipComments: true,
149
+ },
150
+ ],
151
+ "func-style": ["warn", "expression"], // https://eslint.org/docs/latest/rules/func-style
152
+ "prefer-arrow/prefer-arrow-functions": [
153
+ // https://github.com/TristonJ/eslint-plugin-prefer-arrow
154
+ "warn",
155
+ {
156
+ disallowPrototype: false,
157
+ singleReturnOnly: false,
158
+ // We used to enforce arrow functions also for class methods (as class properties)
159
+ // but arrow functions in sub-classes can't call their overridden counterpart
160
+ // in their super-class, see https://stackoverflow.com/a/52823577
161
+ classPropertiesAllowed: false,
162
+ },
163
+ ],
164
+ "@typescript-eslint/use-unknown-in-catch-callback-variable": "off", // https://typescript-eslint.io/rules/use-unknown-in-catch-callback-variable
139
165
  },
140
- ], // https://typescript-eslint.io/rules/switch-exhaustiveness-check
141
- camelcase: "off",
142
- "max-lines": [
143
- "warn",
144
- {
145
- max: 1400,
146
- skipBlankLines: true,
147
- skipComments: true,
166
+ },
167
+ {
168
+ files: globPatterns.typescriptAmbient,
169
+ rules: {
170
+ // In d.ts files it might be necessary to merge an existing interface
171
+ "@typescript-eslint/consistent-type-definitions": "off", // https://typescript-eslint.io/rules/consistent-type-definitions
172
+ // In d.ts files it's sometimes necessary to overload existing methods
173
+ "@typescript-eslint/method-signature-style": "off", // https://typescript-eslint.io/rules/method-signature-style
174
+ "@typescript-eslint/naming-convention": "off", // https://typescript-eslint.io/rules/naming-convention
175
+ // Unused vars can be common in d.ts files when declaration merging is used
176
+ "@typescript-eslint/no-unused-vars": "off", // https://typescript-eslint.io/rules/no-unused-vars
177
+ // Since d.ts files are used to type external modules, we can't control the coding style
178
+ "import/no-default-export": "off",
179
+ // When someone wants to extend the typings of a third-party module, it might
180
+ // be necessary to import the module so that TypeScript finds the typings that should be extended.
181
+ // This is a better alternative to the triple-slash directive
182
+ "import/no-unassigned-import": "off",
148
183
  },
149
- ],
150
- "func-style": ["warn", "expression"], // https://eslint.org/docs/latest/rules/func-style
151
- "prefer-arrow/prefer-arrow-functions": [
152
- // https://github.com/TristonJ/eslint-plugin-prefer-arrow
153
- "warn",
154
- {
155
- disallowPrototype: false,
156
- singleReturnOnly: false,
157
- // We used to enforce arrow functions also for class methods (as class properties)
158
- // but arrow functions in sub-classes can't call their overridden counterpart
159
- // in their super-class, see https://stackoverflow.com/a/52823577
160
- classPropertiesAllowed: false,
184
+ },
185
+ {
186
+ files: globPatterns.tests,
187
+ rules: {
188
+ // Type assertions are quite common in tests
189
+ "@typescript-eslint/consistent-type-assertions": "off", // https://typescript-eslint.io/rules/consistent-type-assertions
190
+ // Mocking often requires to mock objects with a different naming convention
191
+ "@typescript-eslint/naming-convention": "off", // https://typescript-eslint.io/rules/naming-convention
192
+ // We allow any to be used in tests, so returning it is ok
193
+ "@typescript-eslint/no-unsafe-return": "off", // https://typescript-eslint.io/rules/no-unsafe-return
194
+ // chai uses these as assertions
195
+ "@typescript-eslint/no-unused-expressions": "off", // https://typescript-eslint.io/rules/no-unused-expressions
196
+ // It's uncommon to use async/await in Cypress tests
197
+ // https://docs.cypress.io/guides/core-concepts/introduction-to-cypress.html#Commands-Are-Asynchronous
198
+ "@typescript-eslint/promise-function-async": "off", // https://typescript-eslint.io/rules/promise-function-async
199
+ // Passing functions around like this can be common with mocking
200
+ "@typescript-eslint/unbound-method": "off", // https://typescript-eslint.io/rules/unbound-method
161
201
  },
162
- ],
163
- "@typescript-eslint/use-unknown-in-catch-callback-variable": "off", // https://typescript-eslint.io/rules/use-unknown-in-catch-callback-variable
164
- },
165
- },
166
- /** @type {import("eslint").Linter.Config} */
167
- {
168
- files: globPatterns.typescriptAmbient,
169
- rules: {
170
- // In d.ts files it might be necessary to merge an existing interface
171
- "@typescript-eslint/consistent-type-definitions": "off", // https://typescript-eslint.io/rules/consistent-type-definitions
172
- // In d.ts files it's sometimes necessary to overload existing methods
173
- "@typescript-eslint/method-signature-style": "off", // https://typescript-eslint.io/rules/method-signature-style
174
- "@typescript-eslint/naming-convention": "off", // https://typescript-eslint.io/rules/naming-convention
175
- // Unused vars can be common in d.ts files when declaration merging is used
176
- "@typescript-eslint/no-unused-vars": "off", // https://typescript-eslint.io/rules/no-unused-vars
177
- // Since d.ts files are used to type external modules, we can't control the coding style
178
- "import/no-default-export": "off",
179
- // When someone wants to extend the typings of a third-party module, it might
180
- // be necessary to import the module so that TypeScript finds the typings that should be extended.
181
- // This is a better alternative to the triple-slash directive
182
- "import/no-unassigned-import": "off",
183
- },
184
- },
185
- /** @type {import("eslint").Linter.Config} */
186
- {
187
- files: globPatterns.tests,
188
- rules: {
189
- // Type assertions are quite common in tests
190
- "@typescript-eslint/consistent-type-assertions": "off", // https://typescript-eslint.io/rules/consistent-type-assertions
191
- // Mocking often requires to mock objects with a different naming convention
192
- "@typescript-eslint/naming-convention": "off", // https://typescript-eslint.io/rules/naming-convention
193
- // We allow any to be used in tests, so returning it is ok
194
- "@typescript-eslint/no-unsafe-return": "off", // https://typescript-eslint.io/rules/no-unsafe-return
195
- // chai uses these as assertions
196
- "@typescript-eslint/no-unused-expressions": "off", // https://typescript-eslint.io/rules/no-unused-expressions
197
- // It's uncommon to use async/await in Cypress tests
198
- // https://docs.cypress.io/guides/core-concepts/introduction-to-cypress.html#Commands-Are-Asynchronous
199
- "@typescript-eslint/promise-function-async": "off", // https://typescript-eslint.io/rules/promise-function-async
200
- // Passing functions around like this can be common with mocking
201
- "@typescript-eslint/unbound-method": "off", // https://typescript-eslint.io/rules/unbound-method
202
- },
203
- },
204
- );
202
+ },
203
+ )
204
+ );
205
205
 
206
206
  export default typescript;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@peerigon/configs",
3
- "version": "3.1.0",
3
+ "version": "4.0.0",
4
4
  "description": "Configs for ESLint, Prettier, TypeScript & friends",
5
5
  "keywords": [
6
6
  "eslint",
@@ -122,49 +122,49 @@
122
122
  "*.{js,jsx,ts,tsx,css,md,yml,yaml}": "prettier --write"
123
123
  },
124
124
  "dependencies": {
125
- "@eslint-react/eslint-plugin": "^1.26.2",
126
- "@eslint/compat": "^1.2.6",
127
- "@eslint/js": "^9.20.0",
125
+ "@eslint-react/eslint-plugin": "^1.30.2",
126
+ "@eslint/compat": "^1.2.7",
127
+ "@eslint/js": "^9.21.0",
128
128
  "@ianvs/prettier-plugin-sort-imports": "^4.4.1",
129
129
  "@semantic-release/changelog": "^6.0.3",
130
130
  "@semantic-release/exec": "^7.0.3",
131
131
  "@semantic-release/git": "^10.0.1",
132
132
  "@types/eslint-config-prettier": "^6.11.3",
133
133
  "@types/eslint-plugin-jsx-a11y": "^6.10.0",
134
- "eslint-config-prettier": "^10.0.1",
134
+ "eslint-config-prettier": "^10.0.2",
135
135
  "eslint-plugin-jsx-a11y": "^6.10.2",
136
136
  "eslint-plugin-prefer-arrow": "^1.2.3",
137
137
  "eslint-plugin-react": "^7.37.4",
138
138
  "eslint-plugin-react-compiler": "^19.0.0-beta-714736e-20250131",
139
- "eslint-plugin-react-hooks": "^5.1.0",
139
+ "eslint-plugin-react-hooks": "^5.2.0",
140
140
  "eslint-plugin-react-refresh": "^0.4.19",
141
141
  "eslint-plugin-unicorn": "^57.0.0",
142
- "globals": "^15.14.0",
142
+ "globals": "^16.0.0",
143
143
  "prettier-plugin-css-order": "^2.1.2",
144
144
  "prettier-plugin-jsdoc": "^1.3.2",
145
- "prettier-plugin-packagejson": "^2.5.8",
145
+ "prettier-plugin-packagejson": "^2.5.10",
146
146
  "prettier-plugin-tailwindcss": "^0.6.11",
147
- "typescript-eslint": "^8.24.0"
147
+ "typescript-eslint": "^8.26.0"
148
148
  },
149
149
  "devDependencies": {
150
- "@types/node": "^22.13.1",
151
- "@types/react": "^19.0.8",
150
+ "@types/node": "^22.13.9",
151
+ "@types/react": "^19.0.10",
152
152
  "@types/signale": "^1.4.7",
153
- "eslint": "^9.20.1",
153
+ "eslint": "^9.21.0",
154
154
  "husky": "^9.1.7",
155
155
  "lint-staged": "^15.4.3",
156
156
  "npm-run-all2": "^7.0.2",
157
- "pin-github-action": "^2.1.0",
158
- "prettier": "^3.5.0",
157
+ "pin-github-action": "^2.1.1",
158
+ "prettier": "^3.5.3",
159
159
  "react": "^19.0.0",
160
- "semantic-release": "^24.2.2",
161
- "typescript": "^5.7.3"
160
+ "semantic-release": "^24.2.3",
161
+ "typescript": "^5.8.2"
162
162
  },
163
163
  "peerDependencies": {
164
- "eslint": "^9.20.1",
165
- "prettier": "^3.5.0",
166
- "semantic-release": "^24.2.2",
167
- "typescript": "^5.7.3"
164
+ "eslint": "^9.21.0",
165
+ "prettier": "^3.5.3",
166
+ "semantic-release": "^24.2.3",
167
+ "typescript": "^5.8.2"
168
168
  },
169
169
  "peerDependenciesMeta": {
170
170
  "eslint": {
@@ -1,4 +1,4 @@
1
- declare const _default: (import("eslint").Linter.Config<import("eslint").Linter.RulesRecord> | typeof eslintConfigPrettier)[];
2
- export default _default;
3
- import eslintConfigPrettier from "eslint-config-prettier";
1
+ /** @type {import("eslint").Linter.Config[]} */
2
+ export const javascriptBrowserPreset: import("eslint").Linter.Config[];
3
+ export default javascriptBrowserPreset;
4
4
  //# sourceMappingURL=javascript-browser.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"javascript-browser.d.ts","sourceRoot":"","sources":["../../../eslint/presets/javascript-browser.js"],"names":[],"mappings":";;iCAAiC,wBAAwB"}
1
+ {"version":3,"file":"javascript-browser.d.ts","sourceRoot":"","sources":["../../../eslint/presets/javascript-browser.js"],"names":[],"mappings":"AAKA,+CAA+C;AAC/C,sCADW,OAAO,QAAQ,EAAE,MAAM,CAAC,MAAM,EAAE,CAMzC"}
@@ -1,4 +1,4 @@
1
- declare const _default: (import("eslint").Linter.Config<import("eslint").Linter.RulesRecord> | typeof eslintConfigPrettier)[];
2
- export default _default;
3
- import eslintConfigPrettier from "eslint-config-prettier";
1
+ /** @type {import("eslint").Linter.Config[]} */
2
+ export const javascriptNodePreset: import("eslint").Linter.Config[];
3
+ export default javascriptNodePreset;
4
4
  //# sourceMappingURL=javascript-node.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"javascript-node.d.ts","sourceRoot":"","sources":["../../../eslint/presets/javascript-node.js"],"names":[],"mappings":";;iCAAiC,wBAAwB"}
1
+ {"version":3,"file":"javascript-node.d.ts","sourceRoot":"","sources":["../../../eslint/presets/javascript-node.js"],"names":[],"mappings":"AAKA,+CAA+C;AAC/C,mCADW,OAAO,QAAQ,EAAE,MAAM,CAAC,MAAM,EAAE,CAMzC"}
@@ -1,4 +1,4 @@
1
- declare const _default: (import("eslint").Linter.Config<import("eslint").Linter.RulesRecord> | typeof eslintConfigPrettier)[];
2
- export default _default;
3
- import eslintConfigPrettier from "eslint-config-prettier";
1
+ /** @type {import("eslint").Linter.Config[]} */
2
+ export const javascriptPreset: import("eslint").Linter.Config[];
3
+ export default javascriptPreset;
4
4
  //# sourceMappingURL=javascript.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"javascript.d.ts","sourceRoot":"","sources":["../../../eslint/presets/javascript.js"],"names":[],"mappings":";;iCAAiC,wBAAwB"}
1
+ {"version":3,"file":"javascript.d.ts","sourceRoot":"","sources":["../../../eslint/presets/javascript.js"],"names":[],"mappings":"AAIA,+CAA+C;AAC/C,+BADW,OAAO,QAAQ,EAAE,MAAM,CAAC,MAAM,EAAE,CACoC"}
@@ -1,4 +1,4 @@
1
- declare const _default: (import("eslint").Linter.Config<import("eslint").Linter.RulesRecord> | typeof eslintConfigPrettier | import("@typescript-eslint/utils/ts-eslint").FlatConfig.Config)[];
2
- export default _default;
3
- import eslintConfigPrettier from "eslint-config-prettier";
1
+ /** @type {import("eslint").Linter.Config[]} */
2
+ export const typescriptNodePreset: import("eslint").Linter.Config[];
3
+ export default typescriptNodePreset;
4
4
  //# sourceMappingURL=typescript-node.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"typescript-node.d.ts","sourceRoot":"","sources":["../../../eslint/presets/typescript-node.js"],"names":[],"mappings":";;iCAAiC,wBAAwB"}
1
+ {"version":3,"file":"typescript-node.d.ts","sourceRoot":"","sources":["../../../eslint/presets/typescript-node.js"],"names":[],"mappings":"AAMA,+CAA+C;AAC/C,mCADW,OAAO,QAAQ,EAAE,MAAM,CAAC,MAAM,EAAE,CAOzC"}
@@ -1,4 +1,4 @@
1
- declare const _default: (import("eslint").Linter.Config<import("eslint").Linter.RulesRecord> | typeof eslintConfigPrettier | import("@typescript-eslint/utils/ts-eslint").FlatConfig.Config)[];
2
- export default _default;
3
- import eslintConfigPrettier from "eslint-config-prettier";
1
+ /** @type {import("eslint").Linter.Config[]} */
2
+ export const typescriptReactPreset: import("eslint").Linter.Config[];
3
+ export default typescriptReactPreset;
4
4
  //# sourceMappingURL=typescript-react.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"typescript-react.d.ts","sourceRoot":"","sources":["../../../eslint/presets/typescript-react.js"],"names":[],"mappings":";;iCAAiC,wBAAwB"}
1
+ {"version":3,"file":"typescript-react.d.ts","sourceRoot":"","sources":["../../../eslint/presets/typescript-react.js"],"names":[],"mappings":"AAOA,+CAA+C;AAC/C,oCADW,OAAO,QAAQ,EAAE,MAAM,CAAC,MAAM,EAAE,CAQzC"}
@@ -1,4 +1,4 @@
1
- declare const _default: (import("eslint").Linter.Config<import("eslint").Linter.RulesRecord> | typeof eslintConfigPrettier | import("@typescript-eslint/utils/ts-eslint").FlatConfig.Config)[];
2
- export default _default;
3
- import eslintConfigPrettier from "eslint-config-prettier";
1
+ /** @type {import("eslint").Linter.Config[]} */
2
+ export const typescriptPreset: import("eslint").Linter.Config[];
3
+ export default typescriptPreset;
4
4
  //# sourceMappingURL=typescript.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"typescript.d.ts","sourceRoot":"","sources":["../../../eslint/presets/typescript.js"],"names":[],"mappings":";;iCAAiC,wBAAwB"}
1
+ {"version":3,"file":"typescript.d.ts","sourceRoot":"","sources":["../../../eslint/presets/typescript.js"],"names":[],"mappings":"AAKA,+CAA+C;AAC/C,+BADW,OAAO,QAAQ,EAAE,MAAM,CAAC,MAAM,EAAE,CAMzC"}
@@ -1 +1 @@
1
- {"version":3,"file":"javascript.d.ts","sourceRoot":"","sources":["../../../eslint/rules/javascript.js"],"names":[],"mappings":"AAKA,+CAA+C;AAC/C,yBADW,OAAO,QAAQ,EAAE,MAAM,CAAC,MAAM,EAAE,CAmJzC"}
1
+ {"version":3,"file":"javascript.d.ts","sourceRoot":"","sources":["../../../eslint/rules/javascript.js"],"names":[],"mappings":"AAKA,+CAA+C;AAC/C,yBADW,OAAO,QAAQ,EAAE,MAAM,CAAC,MAAM,EAAE,CAqJzC"}
@@ -1,3 +1,4 @@
1
- export const typescript: import("@typescript-eslint/utils/ts-eslint").FlatConfig.ConfigArray;
1
+ /** @type {import("eslint").Linter.Config[]} */
2
+ export const typescript: import("eslint").Linter.Config[];
2
3
  export default typescript;
3
4
  //# sourceMappingURL=typescript.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"typescript.d.ts","sourceRoot":"","sources":["../../../eslint/rules/typescript.js"],"names":[],"mappings":"AAUA,6FAiME"}
1
+ {"version":3,"file":"typescript.d.ts","sourceRoot":"","sources":["../../../eslint/rules/typescript.js"],"names":[],"mappings":"AAKA,+CAA+C;AAC/C,yBADW,OAAO,QAAQ,EAAE,MAAM,CAAC,MAAM,EAAE,CAsMvC"}
@@ -1,3 +1,3 @@
1
- declare const _default: (import("eslint").Linter.Config<import("eslint").Linter.RulesRecord> | typeof import("eslint-config-prettier") | import("@typescript-eslint/utils/ts-eslint").FlatConfig.Config)[];
1
+ declare const _default: import("eslint").Linter.Config<import("eslint").Linter.RulesRecord>[];
2
2
  export default _default;
3
3
  //# sourceMappingURL=eslint.config.d.ts.map
@@ -1,3 +1,3 @@
1
- declare const _default: (import("eslint").Linter.Config<import("eslint").Linter.RulesRecord> | typeof import("eslint-config-prettier") | import("@typescript-eslint/utils/ts-eslint").FlatConfig.Config)[];
1
+ declare const _default: import("eslint").Linter.Config<import("eslint").Linter.RulesRecord>[];
2
2
  export default _default;
3
3
  //# sourceMappingURL=eslint.config.d.ts.map
@@ -1,3 +1,3 @@
1
- declare const _default: (import("eslint").Linter.Config<import("eslint").Linter.RulesRecord> | typeof import("eslint-config-prettier") | import("@typescript-eslint/utils/ts-eslint").FlatConfig.Config)[];
1
+ declare const _default: import("eslint").Linter.Config<import("eslint").Linter.RulesRecord>[];
2
2
  export default _default;
3
3
  //# sourceMappingURL=eslint.config.d.ts.map
@@ -1,3 +1,3 @@
1
- declare const _default: (import("eslint").Linter.Config<import("eslint").Linter.RulesRecord> | typeof import("eslint-config-prettier") | import("@typescript-eslint/utils/ts-eslint").FlatConfig.Config)[];
1
+ declare const _default: import("eslint").Linter.Config<import("eslint").Linter.RulesRecord>[];
2
2
  export default _default;
3
3
  //# sourceMappingURL=eslint.config.d.ts.map
@@ -12,6 +12,8 @@
12
12
  // == Strictness settings ==
13
13
  "strict": true,
14
14
  "noImplicitOverride": true,
15
+ // Warns about functions with implicit returns where other code paths return a value.
16
+ // This option is basically the same as ESLint's `consistent-return` rule.
15
17
  "noImplicitReturns": true,
16
18
  "noUncheckedIndexedAccess": true,
17
19
  "noUncheckedSideEffectImports": true,
@@ -26,6 +28,7 @@
26
28
  "allowImportingTsExtensions": true,
27
29
 
28
30
  // == Other settings ==
31
+ "allowJs": true,
29
32
  "checkJs": true,
30
33
  "forceConsistentCasingInFileNames": true,
31
34
  // Using noEmit true here because you should have a separate build config anyway
@@ -36,5 +39,6 @@
36
39
  "skipLibCheck": false,
37
40
  "verbatimModuleSyntax": true
38
41
  },
42
+ "exclude": ["dist"],
39
43
  "$schema": "https://json.schemastore.org/tsconfig"
40
44
  }