@metamask/eslint-config-typescript 13.0.0 → 14.1.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
@@ -1,4 +1,5 @@
1
1
  # Changelog
2
+
2
3
  All notable changes to this project will be documented in this file.
3
4
 
4
5
  The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
@@ -6,40 +7,91 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
6
7
 
7
8
  ## [Unreleased]
8
9
 
10
+ ## [14.1.0]
11
+
12
+ ### Added
13
+
14
+ - Add support for TypeScript 5.6.x-5.8.x ([#395](https://github.com/MetaMask/eslint-config/pull/395))
15
+
16
+ ### Changed
17
+
18
+ - Disable `@typescript-eslint/no-unsafe-enum-comparison` rule ([#387](https://github.com/MetaMask/eslint-config/pull/387))
19
+ - Loosen `@typescript-eslint/prefer-promise-reject-errors` rule to allow rejecting with `unknown` ([#389](https://github.com/MetaMask/eslint-config/pull/389))
20
+ - Loosen `@typescript-eslint/naming-convention` rule to allow more formats for import names ([#388](https://github.com/MetaMask/eslint-config/pull/388))
21
+ - Loosen `@typescript-eslint/switch-exhaustiveness-check` rule to allow `default` case ([#390](https://github.com/MetaMask/eslint-config/pull/390))
22
+
23
+ ## [14.0.0]
24
+
25
+ ### Added
26
+
27
+ - **BREAKING:** Add peer dependency on `typescript-eslint@^8.6.0`. ([#370](https://github.com/MetaMask/eslint-config/pull/370))
28
+ - **BREAKING:** Add peer dependency on `eslint-import-resolver-typescript@^3.6.3` ([#370](https://github.com/MetaMask/eslint-config/pull/370))
29
+ - **BREAKING:** Add peer dependency on `eslint-plugin-import-x@^4.3.0` ([#370](https://github.com/MetaMask/eslint-config/pull/370))
30
+ - **BREAKING:** Add peer dependency on `eslint-plugin-jsdoc@^50.2.4` ([#370](https://github.com/MetaMask/eslint-config/pull/370))
31
+
32
+ ### Changed
33
+
34
+ - **BREAKING:** Bump minimum Node.js version from 16 to 18.18 ([#371](https://github.com/MetaMask/eslint-config/pull/371))
35
+ - **BREAKING:** Bump peer dependency on ESLint from `^8.57.0` to `^9.11.0` ([#370](https://github.com/MetaMask/eslint-config/pull/370))
36
+ - ESLint 9 requires flat configs, so this change also rewrites the configs to
37
+ use flat configs. The legacy config format is no longer supported.
38
+ - **BREAKING:** Bump peer dependency on `@metamask/eslint-config` from `^13.0.0` to `^14.0.0` ([#377](https://github.com/MetaMask/eslint-config/pull/377))
39
+ - **BREAKING:** Change package to be pure ESM ([#370](https://github.com/MetaMask/eslint-config/pull/370))
40
+ - ESLint 9 supports ESM out-of-the-box, so this change updates the package to
41
+ be pure ESM. This means that the package can no longer be used with CommonJS
42
+ `require` syntax.
43
+
44
+ ### Removed
45
+
46
+ - Remove peer dependency on `@typescript-eslint/eslint-plugin` and `@typescript-eslint/parser` ([#370](https://github.com/MetaMask/eslint-config/pull/370))
47
+
9
48
  ## [13.0.0]
49
+
10
50
  ### Changed
11
- - **BREAKING**: Bump TypeScript to v5.5 ([#364](https://github.com/MetaMask/eslint-config/pull/364))
51
+
52
+ - **BREAKING:** Bump TypeScript to v5.5 ([#364](https://github.com/MetaMask/eslint-config/pull/364))
12
53
  - Also bump relevant `@typescript-eslint` packages.
13
- - **BREAKING**: Replace `eslint-plugin-import` with `eslint-plugin-import-x` ([#366](https://github.com/MetaMask/eslint-config/pull/366))
14
- - **BREAKING**: Bump all ESLint dependencies ([#351](https://github.com/MetaMask/eslint-config/pull/351))
54
+ - **BREAKING:** Replace `eslint-plugin-import` with `eslint-plugin-import-x` ([#366](https://github.com/MetaMask/eslint-config/pull/366))
55
+ - **BREAKING:** Bump all ESLint dependencies ([#351](https://github.com/MetaMask/eslint-config/pull/351))
15
56
  - Bumps all ESLint dependencies to the latest version compatible with Node.js 16.
16
- - **BREAKING**: Bump minimum Node.js version from 14 to 16 ([#332](https://github.com/MetaMask/eslint-config/pull/332), [#339](https://github.com/MetaMask/eslint-config/pull/339))
57
+ - **BREAKING:** Bump minimum Node.js version from 14 to 16 ([#332](https://github.com/MetaMask/eslint-config/pull/332), [#339](https://github.com/MetaMask/eslint-config/pull/339))
17
58
 
18
59
  ## [12.1.0]
60
+
19
61
  ### Changed
62
+
20
63
  - Add support for typescript 5.0.x, 5.1.x ([#288](https://github.com/MetaMask/eslint-config/pull/288))
21
64
 
22
65
  ## [12.0.0]
66
+
23
67
  ### Added
68
+
24
69
  - **BREAKING:** Add rule to enforce generic parameters have a length of at least 3 characters ([#292](https://github.com/MetaMask/eslint-config/pull/292))
25
70
  - **BREAKING:** Enable `@typescript-eslint/consistent-type-imports` rule ([#284](https://github.com/MetaMask/eslint-config/pull/284))
26
71
  - **BREAKING:** Enable `@typescript-eslint/prefer-enum-initializers` rule ([#269](https://github.com/MetaMask/eslint-config/pull/269))
27
72
 
28
73
  ### Changed
74
+
29
75
  - **BREAKING:** Update peer dependency `@metamask/eslint-config` to v12
30
76
  - Disable naming convention for properties that require quotes ([#293](https://github.com/MetaMask/eslint-config/pull/293))
31
77
 
32
78
  ## [11.1.0]
79
+
33
80
  ### Changed
81
+
34
82
  - Exclude test files from package ([#266](https://github.com/MetaMask/eslint-config/pull/266))
35
83
 
36
84
  ## [11.0.2]
85
+
37
86
  ### Changed
87
+
38
88
  - Allow async functions without any 'await' ([#262](https://github.com/MetaMask/eslint-config/pull/262))
39
89
  - Allow parameters to use PascalCase ([#264](https://github.com/MetaMask/eslint-config/pull/264))
40
90
 
41
91
  ## [11.0.0]
92
+
42
93
  ### Added
94
+
43
95
  - **BREAKING:** Add rules that require type information ([#250](https://github.com/MetaMask/eslint-config/pull/250))
44
96
  - This requires setting some parser options. See the README for more details.
45
97
  - **BREAKING:** Bump all ESLint dependencies to the latest version ([#252](https://github.com/MetaMask/eslint-config/pull/252))
@@ -47,7 +99,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
47
99
  - **BREAKING:** Forbid TypeScript's private modifier in favour of hash names ([#244](https://github.com/MetaMask/eslint-config/pull/244))
48
100
 
49
101
  ## [10.0.0]
102
+
50
103
  ### Changed
104
+
51
105
  - **BREAKING:** Update ESLint from v7 to v8 ([#233](https://github.com/MetaMask/eslint-config/pull/233))
52
106
  - This is breaking because `eslint` is a `peerDependency`.
53
107
  - Four new rules have been added:
@@ -66,42 +120,56 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
66
120
  - This makes the `no-unused-vars` rule more permissive
67
121
 
68
122
  ## [9.0.1]
123
+
69
124
  ### Changed
125
+
70
126
  - Disable `@typescript-eslint/no-throw-literal` ([#210](https://github.com/MetaMask/eslint-config/pull/210))
71
127
  - The introduction of this rule was one of the two breaking changes in the previous release. It was included unintentionally, and has now been removed to make updating to v9 easier.
72
128
 
73
129
  ## [9.0.0]
130
+
74
131
  ### Added
132
+
75
133
  - **BREAKING:** Add JSDoc ESLint rules ([#203](https://github.com/MetaMask/eslint-config/pull/203))
76
134
 
77
135
  ### Changed
136
+
78
137
  - **BREAKING:** Disable `no-throw-literal` and enable `@typescript-eslint/no-throw-literal` ([#201](https://github.com/MetaMask/eslint-config/pull/201))
79
138
  - This rule requires type information, which requires [additional project setup](https://github.com/typescript-eslint/typescript-eslint/blob/master/docs/getting-started/linting/TYPED_LINTING.md).
80
139
  - Note: This change has been undone in v9.0.1. You can ignore this change if you're updating to v9.0.1 or greater.
81
140
 
82
141
  ## [8.0.0]
142
+
83
143
  ### Changed
144
+
84
145
  - **BREAKING:** The peer dependency `@metamask/eslint-config` has been updated from v7 to v8.
85
146
 
86
147
  ## [7.0.1]
148
+
87
149
  ### Fixed
150
+
88
151
  - Restore default `parserOptions.ecmaVersion` ([#193](https://github.com/MetaMask/eslint-config/pull/193))
89
152
  - In some cases, `parserOptions.ecmaVersion` could be set to an incorrect version.
90
- The `ecmaVersion` is now explicitly set to `2020`, matching the corresponding setting in `env`.
153
+ The `ecmaVersion` is now explicitly set to `2020`, matching the corresponding setting in `env`.
91
154
 
92
155
  ## [7.0.0]
156
+
93
157
  ### Changed
158
+
94
159
  - **BREAKING:** Update `@typescript/no-shadow` config ([#168](https://github.com/MetaMask/eslint-config/pull/168))
95
160
  - Use recommended `eslint-plugin-import` rule sets ([#184](https://github.com/MetaMask/eslint-config/pull/184))
96
161
  - This only removed or disabled rules, and is not breaking.
97
162
  - Update install instructions in readme ([#185](https://github.com/MetaMask/eslint-config/pull/185))
98
163
 
99
164
  ### Fixed
165
+
100
166
  - Add `@metamask/eslint-config` as a peer dependency ([#186](https://github.com/MetaMask/eslint-config/pull/186))
101
167
  - This package is designed to be used in conjunction with the MetaMask base ESLint config, so this should always have been a peer dependency.
102
168
 
103
169
  ## [6.0.0] - 2021-04-08
170
+
104
171
  ### Changed
172
+
105
173
  - **BREAKING:** Set minimum Node.js version to `^12.0.0` ([#144](https://github.com/MetaMask/eslint-config/pull/144))
106
174
  - **BREAKING:** Set ECMAScript version to `es2020`/`11` ([#150](https://github.com/MetaMask/eslint-config/pull/150))
107
175
  - **BREAKING:** Enable all rules recommended by the `@typescript-eslint` plugin ([#156](https://github.com/MetaMask/eslint-config/pull/156))
@@ -112,21 +180,23 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
112
180
  - [prefer-spread](https://eslint.org/docs/7.0.0/rules/prefer-spread)
113
181
  - Publish this config as its own package ([#141](https://github.com/MetaMask/eslint-config/pull/141))
114
182
  - The contents of this package were previously published as part of [`@metamask/eslint-config`](https://npmjs.com/package/@metamask/eslint-config).
115
- For changes prior to version `6.0.0`, please refer to the changelog of that package.
183
+ For changes prior to version `6.0.0`, please refer to the changelog of that package.
116
184
  - 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`.
117
185
  - Update `eslint` and other ESLint peer dependencies ([#151](https://github.com/MetaMask/eslint-config/pull/151))
118
186
 
119
- [Unreleased]: https://github.com/MetaMask/eslint-config/compare/v13.0.0...HEAD
120
- [13.0.0]: https://github.com/MetaMask/eslint-config/compare/v12.1.0...v13.0.0
121
- [12.1.0]: https://github.com/MetaMask/eslint-config/compare/v12.0.0...v12.1.0
122
- [12.0.0]: https://github.com/MetaMask/eslint-config/compare/v11.1.0...v12.0.0
123
- [11.1.0]: https://github.com/MetaMask/eslint-config/compare/v11.0.2...v11.1.0
124
- [11.0.2]: https://github.com/MetaMask/eslint-config/compare/v11.0.0...v11.0.2
125
- [11.0.0]: https://github.com/MetaMask/eslint-config/compare/v10.0.0...v11.0.0
126
- [10.0.0]: https://github.com/MetaMask/eslint-config/compare/v9.0.1...v10.0.0
127
- [9.0.1]: https://github.com/MetaMask/eslint-config/compare/v9.0.0...v9.0.1
128
- [9.0.0]: https://github.com/MetaMask/eslint-config/compare/v8.0.0...v9.0.0
129
- [8.0.0]: https://github.com/MetaMask/eslint-config/compare/v7.0.1...v8.0.0
130
- [7.0.1]: https://github.com/MetaMask/eslint-config/compare/v7.0.0...v7.0.1
131
- [7.0.0]: https://github.com/MetaMask/eslint-config/compare/v6.0.0...v7.0.0
132
- [6.0.0]: https://github.com/MetaMask/eslint-config/releases/tag/v6.0.0
187
+ [Unreleased]: https://github.com/MetaMask/eslint-config/compare/@metamask/eslint-config-typescript@14.1.0...HEAD
188
+ [14.1.0]: https://github.com/MetaMask/eslint-config/compare/@metamask/eslint-config-typescript@14.0.0...@metamask/eslint-config-typescript@14.1.0
189
+ [14.0.0]: https://github.com/MetaMask/eslint-config/compare/@metamask/eslint-config-typescript@13.0.0...@metamask/eslint-config-typescript@14.0.0
190
+ [13.0.0]: https://github.com/MetaMask/eslint-config/compare/@metamask/eslint-config-typescript@12.1.0...@metamask/eslint-config-typescript@13.0.0
191
+ [12.1.0]: https://github.com/MetaMask/eslint-config/compare/@metamask/eslint-config-typescript@12.0.0...@metamask/eslint-config-typescript@12.1.0
192
+ [12.0.0]: https://github.com/MetaMask/eslint-config/compare/@metamask/eslint-config-typescript@11.1.0...@metamask/eslint-config-typescript@12.0.0
193
+ [11.1.0]: https://github.com/MetaMask/eslint-config/compare/@metamask/eslint-config-typescript@11.0.2...@metamask/eslint-config-typescript@11.1.0
194
+ [11.0.2]: https://github.com/MetaMask/eslint-config/compare/@metamask/eslint-config-typescript@11.0.0...@metamask/eslint-config-typescript@11.0.2
195
+ [11.0.0]: https://github.com/MetaMask/eslint-config/compare/@metamask/eslint-config-typescript@10.0.0...@metamask/eslint-config-typescript@11.0.0
196
+ [10.0.0]: https://github.com/MetaMask/eslint-config/compare/@metamask/eslint-config-typescript@9.0.1...@metamask/eslint-config-typescript@10.0.0
197
+ [9.0.1]: https://github.com/MetaMask/eslint-config/compare/@metamask/eslint-config-typescript@9.0.0...@metamask/eslint-config-typescript@9.0.1
198
+ [9.0.0]: https://github.com/MetaMask/eslint-config/compare/@metamask/eslint-config-typescript@8.0.0...@metamask/eslint-config-typescript@9.0.0
199
+ [8.0.0]: https://github.com/MetaMask/eslint-config/compare/@metamask/eslint-config-typescript@7.0.1...@metamask/eslint-config-typescript@8.0.0
200
+ [7.0.1]: https://github.com/MetaMask/eslint-config/compare/@metamask/eslint-config-typescript@7.0.0...@metamask/eslint-config-typescript@7.0.1
201
+ [7.0.0]: https://github.com/MetaMask/eslint-config/compare/@metamask/eslint-config-typescript@6.0.0...@metamask/eslint-config-typescript@7.0.0
202
+ [6.0.0]: https://github.com/MetaMask/eslint-config/releases/tag/@metamask/eslint-config-typescript@6.0.0
package/README.md CHANGED
@@ -6,46 +6,50 @@ MetaMask's [TypeScript](https://www.typescriptlang.org) ESLint configuration.
6
6
 
7
7
  ```bash
8
8
  yarn add --dev \
9
- @metamask/eslint-config@^12.2.0 \
10
- @metamask/eslint-config-typescript@^12.1.0 \
11
- @typescript-eslint/eslint-plugin@^6.21.0 \
12
- @typescript-eslint/parser@^6.21.0 \
13
- eslint@^8.57.0 \
14
- eslint-config-prettier@^8.5.0 \
15
- eslint-plugin-import-x@^0.5.1 \
16
- eslint-plugin-jsdoc@^47.0.2 \
17
- eslint-plugin-prettier@^4.2.1 \
18
- eslint-plugin-promise@^6.1.1 \
19
- prettier@^2.7.1
9
+ @metamask/eslint-config@^14.0.0 \
10
+ @metamask/eslint-config-typescript@^14.0.0 \
11
+ eslint@^9.11.0 \
12
+ eslint-config-prettier@^9.1.0 \
13
+ eslint-plugin-import-x@^4.3.0 \
14
+ eslint-plugin-jsdoc@^50.2.4 \
15
+ eslint-plugin-prettier@^5.2.1 \
16
+ eslint-plugin-promise@^7.1.0 \
17
+ prettier@^3.3.3 \
18
+ typescript@~5.8.0 \
19
+ typescript-eslint@^8.28.0
20
20
  ```
21
21
 
22
22
  The order in which you extend ESLint rules matters.
23
- The `@metamask/*` eslint configs should be added to the `extends` array _last_,
23
+ The `@metamask/*` eslint configs should be added to the config array _last_,
24
24
  with `@metamask/eslint-config` first, and `@metamask/eslint-config-*` in any
25
25
  order thereafter.
26
26
 
27
27
  ```js
28
- module.exports = {
29
- root: true,
28
+ import base, { createConfig } from '@metamask/eslint-config';
29
+ import typescript from '@metamask/eslint-config-typescript';
30
30
 
31
- extends: [
32
- // This should be added last unless you know what you're doing.
33
- '@metamask/eslint-config',
34
- ],
35
-
36
- overrides: [
31
+ const config = createConfig({
32
+ {
37
33
  // The TypeScript config disables certain rules that you want to keep for
38
34
  // non-TypeScript files, so it should be added in an override.
39
- {
40
- files: ['*.ts'],
41
- extends: ['@metamask/eslint-config-typescript'],
35
+ files: ['**/*.ts', '**/*.mts', '**/*.cts'],
36
+
37
+ extends: [
38
+ // Any custom shared config should be added here.
39
+ // ...
40
+
41
+ // This should be added last unless you know what you're doing.
42
+ ...base,
43
+ ...typescript,
44
+ ],
45
+
46
+ languageOptions: {
47
+ parserOptions: {
48
+ // This is required for rules that use type information.
49
+ // See here for more information: https://typescript-eslint.io/getting-started/typed-linting
50
+ tsconfigRootDir: import.meta.dirname,
51
+ },
42
52
  },
43
- ],
44
-
45
- // This is required for rules that use type information.
46
- // See here for more information: https://github.com/typescript-eslint/typescript-eslint/blob/master/docs/getting-started/linting/TYPED_LINTING.md
47
- parserOptions: {
48
- tsconfigRootDir: __dirname,
49
- },
50
- };
53
+ }
54
+ });
51
55
  ```
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@metamask/eslint-config-typescript",
3
- "version": "13.0.0",
3
+ "version": "14.1.0",
4
4
  "description": "Shareable MetaMask ESLint config for TypeScript.",
5
5
  "homepage": "https://github.com/MetaMask/eslint-config#readme",
6
6
  "bugs": {
@@ -11,39 +11,58 @@
11
11
  "url": "https://github.com/MetaMask/eslint-config.git"
12
12
  },
13
13
  "license": "MIT",
14
- "main": "src/index.js",
14
+ "type": "module",
15
+ "exports": {
16
+ ".": {
17
+ "import": {
18
+ "types": "./src/index.d.mts",
19
+ "default": "./src/index.mjs"
20
+ }
21
+ }
22
+ },
23
+ "main": "./src/index.mjs",
24
+ "types": "./src/index.d.mts",
15
25
  "files": [
16
26
  "src/",
17
- "!src/**/*.test.js",
27
+ "!src/**/*.test.mjs",
18
28
  "!src/**/__test__"
19
29
  ],
20
30
  "scripts": {
21
- "lint:changelog": "auto-changelog validate",
31
+ "changelog:update": "../../scripts/update-changelog.sh @metamask/eslint-config-typescript",
32
+ "changelog:validate": "../../scripts/validate-changelog.sh @metamask/eslint-config-typescript",
22
33
  "publish": "npm publish",
23
34
  "test": "eslint ."
24
35
  },
36
+ "dependencies": {
37
+ "@eslint/js": "^9.11.0"
38
+ },
25
39
  "devDependencies": {
40
+ "@jest/globals": "^29.7.0",
26
41
  "@metamask/auto-changelog": "^3.4.4",
27
- "@metamask/eslint-config": "^13.0.0",
28
- "@typescript-eslint/eslint-plugin": "^8.1.0",
29
- "@typescript-eslint/parser": "^8.1.0",
30
- "eslint": "^8.57.0",
31
- "eslint-config-prettier": "^8.5.0",
32
- "eslint-plugin-import-x": "^0.5.1",
33
- "eslint-plugin-jsdoc": "^47.0.2",
34
- "eslint-plugin-prettier": "^4.2.1",
35
- "prettier": "^2.7.1",
36
- "typescript": "~5.5.4"
42
+ "@metamask/eslint-config": "^14.1.0",
43
+ "eslint": "^9.11.0",
44
+ "eslint-config-prettier": "^9.1.0",
45
+ "eslint-import-resolver-typescript": "^3.6.3",
46
+ "eslint-plugin-import-x": "^4.3.0",
47
+ "eslint-plugin-jsdoc": "^50.2.4",
48
+ "eslint-plugin-prettier": "^5.2.1",
49
+ "globals": "^15.9.0",
50
+ "prettier": "^3.3.3",
51
+ "typescript": "~5.8.0",
52
+ "typescript-eslint": "^8.28.0",
53
+ "vitest": "^2.1.9"
37
54
  },
38
55
  "peerDependencies": {
39
- "@metamask/eslint-config": "^13.0.0",
40
- "@typescript-eslint/eslint-plugin": "^8.1.0",
41
- "@typescript-eslint/parser": "^8.1.0",
42
- "eslint": "^8.57.0",
43
- "typescript": ">=4.8.4 <5.6"
56
+ "@metamask/eslint-config": "^14.1.0",
57
+ "eslint": "^9.11.0",
58
+ "eslint-import-resolver-typescript": "^3.6.3",
59
+ "eslint-plugin-import-x": "^4.3.0",
60
+ "eslint-plugin-jsdoc": "^50.2.4",
61
+ "typescript": ">=4.8.4 <5.9.0",
62
+ "typescript-eslint": "^8.24"
44
63
  },
45
64
  "engines": {
46
- "node": "^16.20 || ^18.18 || >=20"
65
+ "node": "^18.18 || >=20"
47
66
  },
48
67
  "publishConfig": {
49
68
  "access": "public",
@@ -0,0 +1,6 @@
1
+ declare module '@metamask/eslint-config-typescript' {
2
+ import type { Linter } from 'eslint';
3
+
4
+ const config: Linter.Config[];
5
+ export default config;
6
+ }
@@ -1,35 +1,41 @@
1
- module.exports = {
2
- parser: '@typescript-eslint/parser',
3
-
4
- env: {
5
- // See comment under `parserOptions` below.
6
- es2020: true,
1
+ import { createConfig } from '@metamask/eslint-config';
2
+ import * as resolver from 'eslint-import-resolver-typescript';
3
+ import importX from 'eslint-plugin-import-x';
4
+ import jsdoc from 'eslint-plugin-jsdoc';
5
+ // TODO: Look into why this doesn't resolve.
6
+ // eslint-disable-next-line import-x/no-unresolved
7
+ import typescript from 'typescript-eslint';
8
+
9
+ const config = createConfig({
10
+ name: '@metamask/eslint-config-typescript',
11
+
12
+ plugins: {
13
+ '@typescript-eslint': typescript.plugin,
7
14
  },
8
15
 
9
- parserOptions: {
10
- // The `esXXXX` option under `env` is supposed to set the correct
11
- // `ecmaVersion` option here, but we've had issues with it being
12
- // overridden in the past and therefore set it explicitly.
13
- //
14
- // For TypeScript, the EcmaScript version always be the latest release
15
- // (not pre-release) here: https://github.com/tc39/ecma262/releases
16
- ecmaVersion: 2020,
17
- sourceType: 'module',
16
+ extends: [
17
+ typescript.configs.recommended,
18
+ typescript.configs.recommendedTypeChecked,
19
+ importX.flatConfigs.typescript,
20
+ jsdoc.configs['flat/recommended-typescript-error'],
21
+ ],
18
22
 
19
- // This enables support for linting rules that require type information. We
20
- // assume that the project has a `tsconfig.json` file in the directory where
21
- // ESLint is being run.
22
- tsconfigRootDir: process.cwd(),
23
- project: ['./tsconfig.json'],
23
+ languageOptions: {
24
+ sourceType: 'module',
25
+ parserOptions: {
26
+ // This option requires `tsconfigRootDir` to be set, but this needs to
27
+ // be set on a per-project basis.
28
+ projectService: true,
29
+ ecmaVersion: 2022,
30
+ },
24
31
  },
25
32
 
26
- plugins: ['@typescript-eslint', 'jsdoc'],
27
-
28
- extends: [
29
- 'plugin:@typescript-eslint/recommended',
30
- 'plugin:@typescript-eslint/recommended-type-checked',
31
- 'plugin:import-x/typescript',
32
- ],
33
+ settings: {
34
+ 'import-x/resolver': {
35
+ name: 'typescript',
36
+ resolver,
37
+ },
38
+ },
33
39
 
34
40
  rules: {
35
41
  // Handled by TypeScript
@@ -71,6 +77,9 @@ module.exports = {
71
77
  '@typescript-eslint/no-unsafe-return': 'off',
72
78
 
73
79
  // Recommended rules that we do not want to use
80
+ '@typescript-eslint/no-duplicate-type-constituents': 'off',
81
+ '@typescript-eslint/no-redundant-type-constituents': 'off',
82
+ '@typescript-eslint/no-unsafe-enum-comparison': 'off',
74
83
  '@typescript-eslint/require-await': 'off',
75
84
 
76
85
  // Our rules that require type information
@@ -87,6 +96,10 @@ module.exports = {
87
96
  selector: 'enumMember',
88
97
  format: ['PascalCase'],
89
98
  },
99
+ {
100
+ selector: 'import',
101
+ format: ['camelCase', 'PascalCase', 'snake_case', 'UPPER_CASE'],
102
+ },
90
103
  {
91
104
  selector: 'interface',
92
105
  format: ['PascalCase'],
@@ -147,6 +160,10 @@ module.exports = {
147
160
  '@typescript-eslint/prefer-enum-initializers': 'error',
148
161
  '@typescript-eslint/prefer-includes': 'error',
149
162
  '@typescript-eslint/prefer-nullish-coalescing': 'error',
163
+ '@typescript-eslint/prefer-promise-reject-errors': [
164
+ 'error',
165
+ { allowThrowingUnknown: true },
166
+ ],
150
167
  '@typescript-eslint/prefer-readonly': 'error',
151
168
  '@typescript-eslint/prefer-reduce-type-parameter': 'error',
152
169
  '@typescript-eslint/prefer-string-starts-ends-with': 'error',
@@ -158,7 +175,12 @@ module.exports = {
158
175
  allowNumber: true,
159
176
  },
160
177
  ],
161
- '@typescript-eslint/switch-exhaustiveness-check': 'error',
178
+ '@typescript-eslint/switch-exhaustiveness-check': [
179
+ 'error',
180
+ {
181
+ considerDefaultExhaustiveForUnions: true,
182
+ },
183
+ ],
162
184
 
163
185
  'default-param-last': 'off',
164
186
  '@typescript-eslint/default-param-last': 'error',
@@ -204,4 +226,6 @@ module.exports = {
204
226
  },
205
227
  ],
206
228
  },
207
- };
229
+ });
230
+
231
+ export default config;