@metamask/eslint-config-typescript 13.0.0 → 14.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 +76 -20
- package/README.md +34 -31
- package/package.json +39 -20
- package/src/index.d.mts +6 -0
- package/src/{index.js → index.mjs} +38 -28
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,78 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
6
7
|
|
|
7
8
|
## [Unreleased]
|
|
8
9
|
|
|
10
|
+
## [14.0.0]
|
|
11
|
+
|
|
12
|
+
### Added
|
|
13
|
+
|
|
14
|
+
- **BREAKING:** Add peer dependency on `typescript-eslint@^8.6.0`. ([#370](https://github.com/MetaMask/eslint-config/pull/370))
|
|
15
|
+
- **BREAKING:** Add peer dependency on `eslint-import-resolver-typescript@^3.6.3` ([#370](https://github.com/MetaMask/eslint-config/pull/370))
|
|
16
|
+
- **BREAKING:** Add peer dependency on `eslint-plugin-import-x@^4.3.0` ([#370](https://github.com/MetaMask/eslint-config/pull/370))
|
|
17
|
+
- **BREAKING:** Add peer dependency on `eslint-plugin-jsdoc@^50.2.4` ([#370](https://github.com/MetaMask/eslint-config/pull/370))
|
|
18
|
+
|
|
19
|
+
### Changed
|
|
20
|
+
|
|
21
|
+
- **BREAKING:** Bump minimum Node.js version from 16 to 18.18 ([#371](https://github.com/MetaMask/eslint-config/pull/371))
|
|
22
|
+
- **BREAKING:** Bump peer dependency on ESLint from `^8.57.0` to `^9.11.0` ([#370](https://github.com/MetaMask/eslint-config/pull/370))
|
|
23
|
+
- ESLint 9 requires flat configs, so this change also rewrites the configs to
|
|
24
|
+
use flat configs. The legacy config format is no longer supported.
|
|
25
|
+
- **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))
|
|
26
|
+
- **BREAKING:** Change package to be pure ESM ([#370](https://github.com/MetaMask/eslint-config/pull/370))
|
|
27
|
+
- ESLint 9 supports ESM out-of-the-box, so this change updates the package to
|
|
28
|
+
be pure ESM. This means that the package can no longer be used with CommonJS
|
|
29
|
+
`require` syntax.
|
|
30
|
+
|
|
31
|
+
### Removed
|
|
32
|
+
|
|
33
|
+
- Remove peer dependency on `@typescript-eslint/eslint-plugin` and `@typescript-eslint/parser` ([#370](https://github.com/MetaMask/eslint-config/pull/370))
|
|
34
|
+
|
|
9
35
|
## [13.0.0]
|
|
36
|
+
|
|
10
37
|
### Changed
|
|
11
|
-
|
|
38
|
+
|
|
39
|
+
- **BREAKING:** Bump TypeScript to v5.5 ([#364](https://github.com/MetaMask/eslint-config/pull/364))
|
|
12
40
|
- Also bump relevant `@typescript-eslint` packages.
|
|
13
|
-
- **BREAKING
|
|
14
|
-
- **BREAKING
|
|
41
|
+
- **BREAKING:** Replace `eslint-plugin-import` with `eslint-plugin-import-x` ([#366](https://github.com/MetaMask/eslint-config/pull/366))
|
|
42
|
+
- **BREAKING:** Bump all ESLint dependencies ([#351](https://github.com/MetaMask/eslint-config/pull/351))
|
|
15
43
|
- Bumps all ESLint dependencies to the latest version compatible with Node.js 16.
|
|
16
|
-
- **BREAKING
|
|
44
|
+
- **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
45
|
|
|
18
46
|
## [12.1.0]
|
|
47
|
+
|
|
19
48
|
### Changed
|
|
49
|
+
|
|
20
50
|
- Add support for typescript 5.0.x, 5.1.x ([#288](https://github.com/MetaMask/eslint-config/pull/288))
|
|
21
51
|
|
|
22
52
|
## [12.0.0]
|
|
53
|
+
|
|
23
54
|
### Added
|
|
55
|
+
|
|
24
56
|
- **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
57
|
- **BREAKING:** Enable `@typescript-eslint/consistent-type-imports` rule ([#284](https://github.com/MetaMask/eslint-config/pull/284))
|
|
26
58
|
- **BREAKING:** Enable `@typescript-eslint/prefer-enum-initializers` rule ([#269](https://github.com/MetaMask/eslint-config/pull/269))
|
|
27
59
|
|
|
28
60
|
### Changed
|
|
61
|
+
|
|
29
62
|
- **BREAKING:** Update peer dependency `@metamask/eslint-config` to v12
|
|
30
63
|
- Disable naming convention for properties that require quotes ([#293](https://github.com/MetaMask/eslint-config/pull/293))
|
|
31
64
|
|
|
32
65
|
## [11.1.0]
|
|
66
|
+
|
|
33
67
|
### Changed
|
|
68
|
+
|
|
34
69
|
- Exclude test files from package ([#266](https://github.com/MetaMask/eslint-config/pull/266))
|
|
35
70
|
|
|
36
71
|
## [11.0.2]
|
|
72
|
+
|
|
37
73
|
### Changed
|
|
74
|
+
|
|
38
75
|
- Allow async functions without any 'await' ([#262](https://github.com/MetaMask/eslint-config/pull/262))
|
|
39
76
|
- Allow parameters to use PascalCase ([#264](https://github.com/MetaMask/eslint-config/pull/264))
|
|
40
77
|
|
|
41
78
|
## [11.0.0]
|
|
79
|
+
|
|
42
80
|
### Added
|
|
81
|
+
|
|
43
82
|
- **BREAKING:** Add rules that require type information ([#250](https://github.com/MetaMask/eslint-config/pull/250))
|
|
44
83
|
- This requires setting some parser options. See the README for more details.
|
|
45
84
|
- **BREAKING:** Bump all ESLint dependencies to the latest version ([#252](https://github.com/MetaMask/eslint-config/pull/252))
|
|
@@ -47,7 +86,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
47
86
|
- **BREAKING:** Forbid TypeScript's private modifier in favour of hash names ([#244](https://github.com/MetaMask/eslint-config/pull/244))
|
|
48
87
|
|
|
49
88
|
## [10.0.0]
|
|
89
|
+
|
|
50
90
|
### Changed
|
|
91
|
+
|
|
51
92
|
- **BREAKING:** Update ESLint from v7 to v8 ([#233](https://github.com/MetaMask/eslint-config/pull/233))
|
|
52
93
|
- This is breaking because `eslint` is a `peerDependency`.
|
|
53
94
|
- Four new rules have been added:
|
|
@@ -66,42 +107,56 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
66
107
|
- This makes the `no-unused-vars` rule more permissive
|
|
67
108
|
|
|
68
109
|
## [9.0.1]
|
|
110
|
+
|
|
69
111
|
### Changed
|
|
112
|
+
|
|
70
113
|
- Disable `@typescript-eslint/no-throw-literal` ([#210](https://github.com/MetaMask/eslint-config/pull/210))
|
|
71
114
|
- 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
115
|
|
|
73
116
|
## [9.0.0]
|
|
117
|
+
|
|
74
118
|
### Added
|
|
119
|
+
|
|
75
120
|
- **BREAKING:** Add JSDoc ESLint rules ([#203](https://github.com/MetaMask/eslint-config/pull/203))
|
|
76
121
|
|
|
77
122
|
### Changed
|
|
123
|
+
|
|
78
124
|
- **BREAKING:** Disable `no-throw-literal` and enable `@typescript-eslint/no-throw-literal` ([#201](https://github.com/MetaMask/eslint-config/pull/201))
|
|
79
125
|
- 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
126
|
- 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
127
|
|
|
82
128
|
## [8.0.0]
|
|
129
|
+
|
|
83
130
|
### Changed
|
|
131
|
+
|
|
84
132
|
- **BREAKING:** The peer dependency `@metamask/eslint-config` has been updated from v7 to v8.
|
|
85
133
|
|
|
86
134
|
## [7.0.1]
|
|
135
|
+
|
|
87
136
|
### Fixed
|
|
137
|
+
|
|
88
138
|
- Restore default `parserOptions.ecmaVersion` ([#193](https://github.com/MetaMask/eslint-config/pull/193))
|
|
89
139
|
- In some cases, `parserOptions.ecmaVersion` could be set to an incorrect version.
|
|
90
|
-
|
|
140
|
+
The `ecmaVersion` is now explicitly set to `2020`, matching the corresponding setting in `env`.
|
|
91
141
|
|
|
92
142
|
## [7.0.0]
|
|
143
|
+
|
|
93
144
|
### Changed
|
|
145
|
+
|
|
94
146
|
- **BREAKING:** Update `@typescript/no-shadow` config ([#168](https://github.com/MetaMask/eslint-config/pull/168))
|
|
95
147
|
- Use recommended `eslint-plugin-import` rule sets ([#184](https://github.com/MetaMask/eslint-config/pull/184))
|
|
96
148
|
- This only removed or disabled rules, and is not breaking.
|
|
97
149
|
- Update install instructions in readme ([#185](https://github.com/MetaMask/eslint-config/pull/185))
|
|
98
150
|
|
|
99
151
|
### Fixed
|
|
152
|
+
|
|
100
153
|
- Add `@metamask/eslint-config` as a peer dependency ([#186](https://github.com/MetaMask/eslint-config/pull/186))
|
|
101
154
|
- 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
155
|
|
|
103
156
|
## [6.0.0] - 2021-04-08
|
|
157
|
+
|
|
104
158
|
### Changed
|
|
159
|
+
|
|
105
160
|
- **BREAKING:** Set minimum Node.js version to `^12.0.0` ([#144](https://github.com/MetaMask/eslint-config/pull/144))
|
|
106
161
|
- **BREAKING:** Set ECMAScript version to `es2020`/`11` ([#150](https://github.com/MetaMask/eslint-config/pull/150))
|
|
107
162
|
- **BREAKING:** Enable all rules recommended by the `@typescript-eslint` plugin ([#156](https://github.com/MetaMask/eslint-config/pull/156))
|
|
@@ -112,21 +167,22 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
112
167
|
- [prefer-spread](https://eslint.org/docs/7.0.0/rules/prefer-spread)
|
|
113
168
|
- Publish this config as its own package ([#141](https://github.com/MetaMask/eslint-config/pull/141))
|
|
114
169
|
- The contents of this package were previously published as part of [`@metamask/eslint-config`](https://npmjs.com/package/@metamask/eslint-config).
|
|
115
|
-
|
|
170
|
+
For changes prior to version `6.0.0`, please refer to the changelog of that package.
|
|
116
171
|
- 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
172
|
- Update `eslint` and other ESLint peer dependencies ([#151](https://github.com/MetaMask/eslint-config/pull/151))
|
|
118
173
|
|
|
119
|
-
[Unreleased]: https://github.com/MetaMask/eslint-config/compare/
|
|
120
|
-
[
|
|
121
|
-
[
|
|
122
|
-
[12.
|
|
123
|
-
[
|
|
124
|
-
[11.0
|
|
125
|
-
[11.0.
|
|
126
|
-
[
|
|
127
|
-
[
|
|
128
|
-
[9.0.
|
|
129
|
-
[
|
|
130
|
-
[
|
|
131
|
-
[7.0.
|
|
132
|
-
[
|
|
174
|
+
[Unreleased]: https://github.com/MetaMask/eslint-config/compare/@metamask/eslint-config-typescript@14.0.0...HEAD
|
|
175
|
+
[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
|
+
[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
|
+
[12.1.0]: https://github.com/MetaMask/eslint-config/compare/@metamask/eslint-config-typescript@12.0.0...@metamask/eslint-config-typescript@12.1.0
|
|
178
|
+
[12.0.0]: https://github.com/MetaMask/eslint-config/compare/@metamask/eslint-config-typescript@11.1.0...@metamask/eslint-config-typescript@12.0.0
|
|
179
|
+
[11.1.0]: https://github.com/MetaMask/eslint-config/compare/@metamask/eslint-config-typescript@11.0.2...@metamask/eslint-config-typescript@11.1.0
|
|
180
|
+
[11.0.2]: https://github.com/MetaMask/eslint-config/compare/@metamask/eslint-config-typescript@11.0.0...@metamask/eslint-config-typescript@11.0.2
|
|
181
|
+
[11.0.0]: https://github.com/MetaMask/eslint-config/compare/@metamask/eslint-config-typescript@10.0.0...@metamask/eslint-config-typescript@11.0.0
|
|
182
|
+
[10.0.0]: https://github.com/MetaMask/eslint-config/compare/@metamask/eslint-config-typescript@9.0.1...@metamask/eslint-config-typescript@10.0.0
|
|
183
|
+
[9.0.1]: https://github.com/MetaMask/eslint-config/compare/@metamask/eslint-config-typescript@9.0.0...@metamask/eslint-config-typescript@9.0.1
|
|
184
|
+
[9.0.0]: https://github.com/MetaMask/eslint-config/compare/@metamask/eslint-config-typescript@8.0.0...@metamask/eslint-config-typescript@9.0.0
|
|
185
|
+
[8.0.0]: https://github.com/MetaMask/eslint-config/compare/@metamask/eslint-config-typescript@7.0.1...@metamask/eslint-config-typescript@8.0.0
|
|
186
|
+
[7.0.1]: https://github.com/MetaMask/eslint-config/compare/@metamask/eslint-config-typescript@7.0.0...@metamask/eslint-config-typescript@7.0.1
|
|
187
|
+
[7.0.0]: https://github.com/MetaMask/eslint-config/compare/@metamask/eslint-config-typescript@6.0.0...@metamask/eslint-config-typescript@7.0.0
|
|
188
|
+
[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,49 @@ MetaMask's [TypeScript](https://www.typescriptlang.org) ESLint configuration.
|
|
|
6
6
|
|
|
7
7
|
```bash
|
|
8
8
|
yarn add --dev \
|
|
9
|
-
@metamask/eslint-config@^
|
|
10
|
-
@metamask/eslint-config-typescript@^
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
eslint@^
|
|
14
|
-
eslint-
|
|
15
|
-
eslint-plugin-
|
|
16
|
-
eslint-plugin-
|
|
17
|
-
|
|
18
|
-
eslint
|
|
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-eslint@^8.6.0
|
|
20
19
|
```
|
|
21
20
|
|
|
22
21
|
The order in which you extend ESLint rules matters.
|
|
23
|
-
The `@metamask/*` eslint configs should be added to the
|
|
22
|
+
The `@metamask/*` eslint configs should be added to the config array _last_,
|
|
24
23
|
with `@metamask/eslint-config` first, and `@metamask/eslint-config-*` in any
|
|
25
24
|
order thereafter.
|
|
26
25
|
|
|
27
26
|
```js
|
|
28
|
-
|
|
29
|
-
|
|
27
|
+
import base, { createConfig } from '@metamask/eslint-config';
|
|
28
|
+
import typescript from '@metamask/eslint-config-typescript';
|
|
30
29
|
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
'@metamask/eslint-config',
|
|
34
|
-
],
|
|
35
|
-
|
|
36
|
-
overrides: [
|
|
30
|
+
const config = createConfig({
|
|
31
|
+
{
|
|
37
32
|
// The TypeScript config disables certain rules that you want to keep for
|
|
38
33
|
// non-TypeScript files, so it should be added in an override.
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
34
|
+
files: ['**/*.ts', '**/*.mts', '**/*.cts'],
|
|
35
|
+
|
|
36
|
+
extends: [
|
|
37
|
+
// Any custom shared config should be added here.
|
|
38
|
+
// ...
|
|
39
|
+
|
|
40
|
+
// This should be added last unless you know what you're doing.
|
|
41
|
+
...base,
|
|
42
|
+
...typescript,
|
|
43
|
+
],
|
|
44
|
+
|
|
45
|
+
languageOptions: {
|
|
46
|
+
parserOptions: {
|
|
47
|
+
// This is required for rules that use type information.
|
|
48
|
+
// See here for more information: https://typescript-eslint.io/getting-started/typed-linting
|
|
49
|
+
tsconfigRootDir: import.meta.dirname,
|
|
50
|
+
},
|
|
42
51
|
},
|
|
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
|
-
};
|
|
52
|
+
}
|
|
53
|
+
});
|
|
51
54
|
```
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@metamask/eslint-config-typescript",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "14.0.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
|
-
"
|
|
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.
|
|
27
|
+
"!src/**/*.test.mjs",
|
|
18
28
|
"!src/**/__test__"
|
|
19
29
|
],
|
|
20
30
|
"scripts": {
|
|
21
|
-
"
|
|
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": "^
|
|
28
|
-
"
|
|
29
|
-
"
|
|
30
|
-
"eslint": "^
|
|
31
|
-
"eslint-
|
|
32
|
-
"eslint-plugin-
|
|
33
|
-
"eslint-plugin-
|
|
34
|
-
"
|
|
35
|
-
"prettier": "^
|
|
36
|
-
"typescript": "~5.5.4"
|
|
42
|
+
"@metamask/eslint-config": "^14.0.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.5.4",
|
|
52
|
+
"typescript-eslint": "^8.6.0",
|
|
53
|
+
"vitest": "^2.1.1"
|
|
37
54
|
},
|
|
38
55
|
"peerDependencies": {
|
|
39
|
-
"@metamask/eslint-config": "^
|
|
40
|
-
"
|
|
41
|
-
"
|
|
42
|
-
"eslint": "^
|
|
43
|
-
"
|
|
56
|
+
"@metamask/eslint-config": "^14.0.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.6",
|
|
62
|
+
"typescript-eslint": "^8.6.0"
|
|
44
63
|
},
|
|
45
64
|
"engines": {
|
|
46
|
-
"node": "^
|
|
65
|
+
"node": "^18.18 || >=20"
|
|
47
66
|
},
|
|
48
67
|
"publishConfig": {
|
|
49
68
|
"access": "public",
|
package/src/index.d.mts
ADDED
|
@@ -1,35 +1,41 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
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
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
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
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
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
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
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,8 @@ 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',
|
|
74
82
|
'@typescript-eslint/require-await': 'off',
|
|
75
83
|
|
|
76
84
|
// Our rules that require type information
|
|
@@ -204,4 +212,6 @@ module.exports = {
|
|
|
204
212
|
},
|
|
205
213
|
],
|
|
206
214
|
},
|
|
207
|
-
};
|
|
215
|
+
});
|
|
216
|
+
|
|
217
|
+
export default config;
|