@metamask/eslint-config-typescript 14.0.0 → 15.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/CHANGELOG.md CHANGED
@@ -7,6 +7,46 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
7
7
 
8
8
  ## [Unreleased]
9
9
 
10
+ ## [15.0.0]
11
+
12
+ ### Changed
13
+
14
+ - **BREAKING:** Bump peer dependency on `@metamask/eslint-config` from `^14.0.0` to `^15.0.0` ([#431](https://github.com/MetaMask/eslint-config/pull/431))
15
+ - **BREAKING:** Update `typescript-eslint` peer dependency to have a minimum version of v8.39.0 ([#423](https://github.com/MetaMask/eslint-config/pull/423))
16
+ - This version has a matching supported `typescript` range, and includes some bug fixes for problems we ran into.
17
+ - **BREAKING:** Update type import specifier rules ([#381](https://github.com/MetaMask/eslint-config/pull/381))
18
+ - `@typescript-eslint/consistent-type-imports` has been replaced with `import-x/consistent-type-specifier-style`
19
+ - The rule now prefers "top-level" type imports over inline. e.g. `import type { a } from 'x'` over `import { type a } from 'x'`
20
+ - Disable `@typescript-eslint/no-unnecessary-type-arguments` ([#426](https://github.com/MetaMask/eslint-config/pull/426))
21
+ - We decided that "unnecessary" type arguments make types easier to read sometimes, so we should allow them.
22
+ - Disable `promise/valid-params` because it's redundant in type-checked projects ([#425](https://github.com/MetaMask/eslint-config/pull/425))
23
+ - Disable `import-x/no-duplicates` ([#427](https://github.com/MetaMask/eslint-config/pull/427))
24
+ - It was a style preference that we may not want, and the auto-fix was broken.
25
+ - Loosen `@typescript-eslint/naming-convention` by not enforcing naming conventions for object literal properties ([#428](https://github.com/MetaMask/eslint-config/pull/428))
26
+ - Object literals are too often used as parameters for 3rd party libraries/services.
27
+ - Disable `jsdoc/check-indentation` ([#430](https://github.com/MetaMask/eslint-config/pull/430))
28
+ - Disabled due to a problem with indended sections in TSDoc blocks.
29
+ - Widen `typescript` peer dependency to allow all 5.x versions ([#422](https://github.com/MetaMask/eslint-config/pull/422))
30
+
31
+ ### Fixed
32
+
33
+ - Prevent non-type imports from being grouped under a type import upon auto-fix ([#427](https://github.com/MetaMask/eslint-config/pull/427))
34
+ - This was caused by `import-x/no-duplicates`, which is now disabled.
35
+ - Fix false positive lint error on TSDoc blocks with indended sections (e.g. bullet lists) ([#430](https://github.com/MetaMask/eslint-config/pull/430))
36
+
37
+ ## [14.1.0]
38
+
39
+ ### Added
40
+
41
+ - Add support for TypeScript 5.6.x-5.8.x ([#395](https://github.com/MetaMask/eslint-config/pull/395))
42
+
43
+ ### Changed
44
+
45
+ - Disable `@typescript-eslint/no-unsafe-enum-comparison` rule ([#387](https://github.com/MetaMask/eslint-config/pull/387))
46
+ - Loosen `@typescript-eslint/prefer-promise-reject-errors` rule to allow rejecting with `unknown` ([#389](https://github.com/MetaMask/eslint-config/pull/389))
47
+ - Loosen `@typescript-eslint/naming-convention` rule to allow more formats for import names ([#388](https://github.com/MetaMask/eslint-config/pull/388))
48
+ - Loosen `@typescript-eslint/switch-exhaustiveness-check` rule to allow `default` case ([#390](https://github.com/MetaMask/eslint-config/pull/390))
49
+
10
50
  ## [14.0.0]
11
51
 
12
52
  ### Added
@@ -171,7 +211,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
171
211
  - To continue extending this config, install this package and update your `.eslintrc.js` `extends` array to include `@metamask/eslint-config-typescript` instead of `@metamask/eslint-config/typescript`.
172
212
  - Update `eslint` and other ESLint peer dependencies ([#151](https://github.com/MetaMask/eslint-config/pull/151))
173
213
 
174
- [Unreleased]: https://github.com/MetaMask/eslint-config/compare/@metamask/eslint-config-typescript@14.0.0...HEAD
214
+ [Unreleased]: https://github.com/MetaMask/eslint-config/compare/@metamask/eslint-config-typescript@15.0.0...HEAD
215
+ [15.0.0]: https://github.com/MetaMask/eslint-config/compare/@metamask/eslint-config-typescript@14.1.0...@metamask/eslint-config-typescript@15.0.0
216
+ [14.1.0]: https://github.com/MetaMask/eslint-config/compare/@metamask/eslint-config-typescript@14.0.0...@metamask/eslint-config-typescript@14.1.0
175
217
  [14.0.0]: https://github.com/MetaMask/eslint-config/compare/@metamask/eslint-config-typescript@13.0.0...@metamask/eslint-config-typescript@14.0.0
176
218
  [13.0.0]: https://github.com/MetaMask/eslint-config/compare/@metamask/eslint-config-typescript@12.1.0...@metamask/eslint-config-typescript@13.0.0
177
219
  [12.1.0]: https://github.com/MetaMask/eslint-config/compare/@metamask/eslint-config-typescript@12.0.0...@metamask/eslint-config-typescript@12.1.0
package/README.md CHANGED
@@ -14,8 +14,9 @@ yarn add --dev \
14
14
  eslint-plugin-jsdoc@^50.2.4 \
15
15
  eslint-plugin-prettier@^5.2.1 \
16
16
  eslint-plugin-promise@^7.1.0 \
17
- prettier@^3.3.3
18
- typescript-eslint@^8.6.0
17
+ prettier@^3.3.3 \
18
+ typescript@~5.8.0 \
19
+ typescript-eslint@^8.28.0
19
20
  ```
20
21
 
21
22
  The order in which you extend ESLint rules matters.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@metamask/eslint-config-typescript",
3
- "version": "14.0.0",
3
+ "version": "15.0.0",
4
4
  "description": "Shareable MetaMask ESLint config for TypeScript.",
5
5
  "homepage": "https://github.com/MetaMask/eslint-config#readme",
6
6
  "bugs": {
@@ -39,7 +39,7 @@
39
39
  "devDependencies": {
40
40
  "@jest/globals": "^29.7.0",
41
41
  "@metamask/auto-changelog": "^3.4.4",
42
- "@metamask/eslint-config": "^14.0.0",
42
+ "@metamask/eslint-config": "^15.0.0",
43
43
  "eslint": "^9.11.0",
44
44
  "eslint-config-prettier": "^9.1.0",
45
45
  "eslint-import-resolver-typescript": "^3.6.3",
@@ -48,18 +48,18 @@
48
48
  "eslint-plugin-prettier": "^5.2.1",
49
49
  "globals": "^15.9.0",
50
50
  "prettier": "^3.3.3",
51
- "typescript": "~5.5.4",
52
- "typescript-eslint": "^8.6.0",
53
- "vitest": "^2.1.1"
51
+ "typescript": "^5.9.3",
52
+ "typescript-eslint": "^8.47.0",
53
+ "vitest": "^2.1.9"
54
54
  },
55
55
  "peerDependencies": {
56
- "@metamask/eslint-config": "^14.0.0",
56
+ "@metamask/eslint-config": "^15.0.0",
57
57
  "eslint": "^9.11.0",
58
58
  "eslint-import-resolver-typescript": "^3.6.3",
59
59
  "eslint-plugin-import-x": "^4.3.0",
60
60
  "eslint-plugin-jsdoc": "^50.2.4",
61
- "typescript": ">=4.8.4 <5.6",
62
- "typescript-eslint": "^8.6.0"
61
+ "typescript": ">=4.8.4 <6",
62
+ "typescript-eslint": "^8.39.0"
63
63
  },
64
64
  "engines": {
65
65
  "node": "^18.18 || >=20"
package/src/index.mjs CHANGED
@@ -38,14 +38,10 @@ const config = createConfig({
38
38
  },
39
39
 
40
40
  rules: {
41
- // Handled by TypeScript
42
- 'import-x/no-unresolved': 'off',
43
-
44
41
  // Our rules
45
42
  '@typescript-eslint/array-type': 'error',
46
43
  '@typescript-eslint/consistent-type-assertions': 'error',
47
44
  '@typescript-eslint/consistent-type-definitions': ['error', 'type'],
48
- '@typescript-eslint/consistent-type-imports': 'error',
49
45
  '@typescript-eslint/explicit-function-return-type': 'error',
50
46
  '@typescript-eslint/no-explicit-any': 'off',
51
47
  '@typescript-eslint/no-namespace': [
@@ -79,8 +75,12 @@ const config = createConfig({
79
75
  // Recommended rules that we do not want to use
80
76
  '@typescript-eslint/no-duplicate-type-constituents': 'off',
81
77
  '@typescript-eslint/no-redundant-type-constituents': 'off',
78
+ '@typescript-eslint/no-unsafe-enum-comparison': 'off',
82
79
  '@typescript-eslint/require-await': 'off',
83
80
 
81
+ // Disabled because unnecessary type arguments are sometimes helpful for readability
82
+ '@typescript-eslint/no-unnecessary-type-arguments': 'off',
83
+
84
84
  // Our rules that require type information
85
85
  '@typescript-eslint/consistent-type-exports': 'error',
86
86
  '@typescript-eslint/naming-convention': [
@@ -95,6 +95,10 @@ const config = createConfig({
95
95
  selector: 'enumMember',
96
96
  format: ['PascalCase'],
97
97
  },
98
+ {
99
+ selector: 'import',
100
+ format: ['camelCase', 'PascalCase', 'snake_case', 'UPPER_CASE'],
101
+ },
98
102
  {
99
103
  selector: 'interface',
100
104
  format: ['PascalCase'],
@@ -109,7 +113,9 @@ const config = createConfig({
109
113
  },
110
114
  {
111
115
  selector: 'objectLiteralProperty',
112
- format: ['camelCase', 'PascalCase', 'UPPER_CASE'],
116
+ // Disabled because object literals are often parameters to 3rd party libraries/services,
117
+ // which we don't set the naming conventions for
118
+ format: null,
113
119
  },
114
120
  {
115
121
  selector: 'typeLike',
@@ -151,10 +157,13 @@ const config = createConfig({
151
157
  '@typescript-eslint/no-meaningless-void-operator': 'error',
152
158
  '@typescript-eslint/no-unnecessary-boolean-literal-compare': 'error',
153
159
  '@typescript-eslint/no-unnecessary-qualifier': 'error',
154
- '@typescript-eslint/no-unnecessary-type-arguments': 'error',
155
160
  '@typescript-eslint/prefer-enum-initializers': 'error',
156
161
  '@typescript-eslint/prefer-includes': 'error',
157
162
  '@typescript-eslint/prefer-nullish-coalescing': 'error',
163
+ '@typescript-eslint/prefer-promise-reject-errors': [
164
+ 'error',
165
+ { allowThrowingUnknown: true },
166
+ ],
158
167
  '@typescript-eslint/prefer-readonly': 'error',
159
168
  '@typescript-eslint/prefer-reduce-type-parameter': 'error',
160
169
  '@typescript-eslint/prefer-string-starts-ends-with': 'error',
@@ -166,7 +175,12 @@ const config = createConfig({
166
175
  allowNumber: true,
167
176
  },
168
177
  ],
169
- '@typescript-eslint/switch-exhaustiveness-check': 'error',
178
+ '@typescript-eslint/switch-exhaustiveness-check': [
179
+ 'error',
180
+ {
181
+ considerDefaultExhaustiveForUnions: true,
182
+ },
183
+ ],
170
184
 
171
185
  'default-param-last': 'off',
172
186
  '@typescript-eslint/default-param-last': 'error',
@@ -185,13 +199,28 @@ const config = createConfig({
185
199
  'no-useless-constructor': 'off',
186
200
  '@typescript-eslint/no-useless-constructor': 'error',
187
201
 
202
+ /* import-x plugin rules */
203
+
204
+ // This rule is to aggresive about combining type and non-type imports, which I'm not sure that we want.
205
+ // But more importantly, the auto-fixer is broken.
206
+ // See here for details on that bug: https://github.com/un-ts/eslint-plugin-import-x/issues/231
207
+ 'import-x/no-duplicates': 'off',
208
+
209
+ // Handled by TypeScript
210
+ 'import-x/no-unresolved': 'off',
211
+
212
+ // Combined with the "verbatimModuleSyntax" tsconfig option, a better option than
213
+ // @typescript-eslint/consistent-type-imports
214
+ 'import-x/consistent-type-specifier-style': ['error', 'prefer-top-level'],
215
+
188
216
  /* jsdoc plugin rules */
189
217
 
190
218
  'jsdoc/check-syntax': 'error',
191
219
 
192
- // This is enabled here rather than in the base config because it doesn't play nicely with
193
- // multi-line JSDoc types.
194
- 'jsdoc/check-indentation': 'error',
220
+ // This is disabled because it doesn't work with bullet lists, and other types of indented
221
+ // sections. This issue is fixed in later versions, we can re-enable it after updating.
222
+ // See https://github.com/gajus/eslint-plugin-jsdoc/issues/541 for details
223
+ 'jsdoc/check-indentation': 'off',
195
224
 
196
225
  // Use TypeScript types rather than JSDoc types.
197
226
  'jsdoc/no-types': 'error',
@@ -211,6 +240,11 @@ const config = createConfig({
211
240
  message: 'Use a hash name instead.',
212
241
  },
213
242
  ],
243
+
244
+ /* promise plugin rules */
245
+
246
+ // TypeScript already validates Promise params, no need to validate them twice
247
+ 'promise/valid-params': 'off',
214
248
  },
215
249
  });
216
250