@metamask/eslint-config-typescript 12.1.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 +82 -16
- package/README.md +34 -31
- package/package.json +40 -21
- package/src/index.d.mts +6 -0
- package/src/{index.js → index.mjs} +41 -38
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,31 +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
|
+
|
|
35
|
+
## [13.0.0]
|
|
36
|
+
|
|
37
|
+
### Changed
|
|
38
|
+
|
|
39
|
+
- **BREAKING:** Bump TypeScript to v5.5 ([#364](https://github.com/MetaMask/eslint-config/pull/364))
|
|
40
|
+
- Also bump relevant `@typescript-eslint` packages.
|
|
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))
|
|
43
|
+
- Bumps all ESLint dependencies to the latest version compatible with Node.js 16.
|
|
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))
|
|
45
|
+
|
|
9
46
|
## [12.1.0]
|
|
47
|
+
|
|
10
48
|
### Changed
|
|
49
|
+
|
|
11
50
|
- Add support for typescript 5.0.x, 5.1.x ([#288](https://github.com/MetaMask/eslint-config/pull/288))
|
|
12
51
|
|
|
13
52
|
## [12.0.0]
|
|
53
|
+
|
|
14
54
|
### Added
|
|
55
|
+
|
|
15
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))
|
|
16
57
|
- **BREAKING:** Enable `@typescript-eslint/consistent-type-imports` rule ([#284](https://github.com/MetaMask/eslint-config/pull/284))
|
|
17
58
|
- **BREAKING:** Enable `@typescript-eslint/prefer-enum-initializers` rule ([#269](https://github.com/MetaMask/eslint-config/pull/269))
|
|
18
59
|
|
|
19
60
|
### Changed
|
|
61
|
+
|
|
20
62
|
- **BREAKING:** Update peer dependency `@metamask/eslint-config` to v12
|
|
21
63
|
- Disable naming convention for properties that require quotes ([#293](https://github.com/MetaMask/eslint-config/pull/293))
|
|
22
64
|
|
|
23
65
|
## [11.1.0]
|
|
66
|
+
|
|
24
67
|
### Changed
|
|
68
|
+
|
|
25
69
|
- Exclude test files from package ([#266](https://github.com/MetaMask/eslint-config/pull/266))
|
|
26
70
|
|
|
27
71
|
## [11.0.2]
|
|
72
|
+
|
|
28
73
|
### Changed
|
|
74
|
+
|
|
29
75
|
- Allow async functions without any 'await' ([#262](https://github.com/MetaMask/eslint-config/pull/262))
|
|
30
76
|
- Allow parameters to use PascalCase ([#264](https://github.com/MetaMask/eslint-config/pull/264))
|
|
31
77
|
|
|
32
78
|
## [11.0.0]
|
|
79
|
+
|
|
33
80
|
### Added
|
|
81
|
+
|
|
34
82
|
- **BREAKING:** Add rules that require type information ([#250](https://github.com/MetaMask/eslint-config/pull/250))
|
|
35
83
|
- This requires setting some parser options. See the README for more details.
|
|
36
84
|
- **BREAKING:** Bump all ESLint dependencies to the latest version ([#252](https://github.com/MetaMask/eslint-config/pull/252))
|
|
@@ -38,7 +86,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
38
86
|
- **BREAKING:** Forbid TypeScript's private modifier in favour of hash names ([#244](https://github.com/MetaMask/eslint-config/pull/244))
|
|
39
87
|
|
|
40
88
|
## [10.0.0]
|
|
89
|
+
|
|
41
90
|
### Changed
|
|
91
|
+
|
|
42
92
|
- **BREAKING:** Update ESLint from v7 to v8 ([#233](https://github.com/MetaMask/eslint-config/pull/233))
|
|
43
93
|
- This is breaking because `eslint` is a `peerDependency`.
|
|
44
94
|
- Four new rules have been added:
|
|
@@ -51,48 +101,62 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
51
101
|
- There are two new rules:
|
|
52
102
|
- [`@typescript-eslint/no-loss-of-precision`](https://typescript-eslint.io/rules/no-loss-of-precision)
|
|
53
103
|
- [`@typescript-eslint/no-unnecessary-type-constraint`](https://typescript-eslint.io/rules/no-unnecessary-type-constraint).
|
|
54
|
-
- **BREAKING:** Update
|
|
104
|
+
- **BREAKING:** Update minimum Node.js version to v14 ([#225](https://github.com/MetaMask/eslint-config/pull/225))
|
|
55
105
|
- **BREAKING:** Forbid TypeScript interfaces ([#216](https://github.com/MetaMask/eslint-config/pull/216))
|
|
56
106
|
- Ignore rest siblings for `no-unused-vars` ([#213](https://github.com/MetaMask/eslint-config/pull/213))
|
|
57
107
|
- This makes the `no-unused-vars` rule more permissive
|
|
58
108
|
|
|
59
109
|
## [9.0.1]
|
|
110
|
+
|
|
60
111
|
### Changed
|
|
112
|
+
|
|
61
113
|
- Disable `@typescript-eslint/no-throw-literal` ([#210](https://github.com/MetaMask/eslint-config/pull/210))
|
|
62
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.
|
|
63
115
|
|
|
64
116
|
## [9.0.0]
|
|
117
|
+
|
|
65
118
|
### Added
|
|
119
|
+
|
|
66
120
|
- **BREAKING:** Add JSDoc ESLint rules ([#203](https://github.com/MetaMask/eslint-config/pull/203))
|
|
67
121
|
|
|
68
122
|
### Changed
|
|
123
|
+
|
|
69
124
|
- **BREAKING:** Disable `no-throw-literal` and enable `@typescript-eslint/no-throw-literal` ([#201](https://github.com/MetaMask/eslint-config/pull/201))
|
|
70
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).
|
|
71
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.
|
|
72
127
|
|
|
73
128
|
## [8.0.0]
|
|
129
|
+
|
|
74
130
|
### Changed
|
|
131
|
+
|
|
75
132
|
- **BREAKING:** The peer dependency `@metamask/eslint-config` has been updated from v7 to v8.
|
|
76
133
|
|
|
77
134
|
## [7.0.1]
|
|
135
|
+
|
|
78
136
|
### Fixed
|
|
137
|
+
|
|
79
138
|
- Restore default `parserOptions.ecmaVersion` ([#193](https://github.com/MetaMask/eslint-config/pull/193))
|
|
80
139
|
- In some cases, `parserOptions.ecmaVersion` could be set to an incorrect version.
|
|
81
|
-
|
|
140
|
+
The `ecmaVersion` is now explicitly set to `2020`, matching the corresponding setting in `env`.
|
|
82
141
|
|
|
83
142
|
## [7.0.0]
|
|
143
|
+
|
|
84
144
|
### Changed
|
|
145
|
+
|
|
85
146
|
- **BREAKING:** Update `@typescript/no-shadow` config ([#168](https://github.com/MetaMask/eslint-config/pull/168))
|
|
86
147
|
- Use recommended `eslint-plugin-import` rule sets ([#184](https://github.com/MetaMask/eslint-config/pull/184))
|
|
87
148
|
- This only removed or disabled rules, and is not breaking.
|
|
88
149
|
- Update install instructions in readme ([#185](https://github.com/MetaMask/eslint-config/pull/185))
|
|
89
150
|
|
|
90
151
|
### Fixed
|
|
152
|
+
|
|
91
153
|
- Add `@metamask/eslint-config` as a peer dependency ([#186](https://github.com/MetaMask/eslint-config/pull/186))
|
|
92
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.
|
|
93
155
|
|
|
94
156
|
## [6.0.0] - 2021-04-08
|
|
157
|
+
|
|
95
158
|
### Changed
|
|
159
|
+
|
|
96
160
|
- **BREAKING:** Set minimum Node.js version to `^12.0.0` ([#144](https://github.com/MetaMask/eslint-config/pull/144))
|
|
97
161
|
- **BREAKING:** Set ECMAScript version to `es2020`/`11` ([#150](https://github.com/MetaMask/eslint-config/pull/150))
|
|
98
162
|
- **BREAKING:** Enable all rules recommended by the `@typescript-eslint` plugin ([#156](https://github.com/MetaMask/eslint-config/pull/156))
|
|
@@ -103,20 +167,22 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
103
167
|
- [prefer-spread](https://eslint.org/docs/7.0.0/rules/prefer-spread)
|
|
104
168
|
- Publish this config as its own package ([#141](https://github.com/MetaMask/eslint-config/pull/141))
|
|
105
169
|
- The contents of this package were previously published as part of [`@metamask/eslint-config`](https://npmjs.com/package/@metamask/eslint-config).
|
|
106
|
-
|
|
170
|
+
For changes prior to version `6.0.0`, please refer to the changelog of that package.
|
|
107
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`.
|
|
108
172
|
- Update `eslint` and other ESLint peer dependencies ([#151](https://github.com/MetaMask/eslint-config/pull/151))
|
|
109
173
|
|
|
110
|
-
[Unreleased]: https://github.com/MetaMask/eslint-config/compare/
|
|
111
|
-
[
|
|
112
|
-
[
|
|
113
|
-
[
|
|
114
|
-
[
|
|
115
|
-
[11.
|
|
116
|
-
[
|
|
117
|
-
[
|
|
118
|
-
[
|
|
119
|
-
[
|
|
120
|
-
[
|
|
121
|
-
[
|
|
122
|
-
[
|
|
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": {
|
|
26
|
-
"@
|
|
27
|
-
"@metamask/
|
|
28
|
-
"@
|
|
29
|
-
"
|
|
30
|
-
"eslint": "^
|
|
31
|
-
"eslint-
|
|
32
|
-
"eslint-plugin-import": "^
|
|
33
|
-
"eslint-plugin-jsdoc": "^
|
|
34
|
-
"eslint-plugin-prettier": "^
|
|
35
|
-
"
|
|
36
|
-
"
|
|
40
|
+
"@jest/globals": "^29.7.0",
|
|
41
|
+
"@metamask/auto-changelog": "^3.4.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,56 +1,59 @@
|
|
|
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
|
-
// Should be disabled per Prettier
|
|
36
|
-
'@typescript-eslint/no-extra-semi': 'off',
|
|
37
|
-
|
|
38
41
|
// Handled by TypeScript
|
|
39
|
-
'import/no-unresolved': 'off',
|
|
42
|
+
'import-x/no-unresolved': 'off',
|
|
40
43
|
|
|
41
44
|
// Our rules
|
|
42
45
|
'@typescript-eslint/array-type': 'error',
|
|
43
46
|
'@typescript-eslint/consistent-type-assertions': 'error',
|
|
44
47
|
'@typescript-eslint/consistent-type-definitions': ['error', 'type'],
|
|
45
48
|
'@typescript-eslint/consistent-type-imports': 'error',
|
|
49
|
+
'@typescript-eslint/explicit-function-return-type': 'error',
|
|
46
50
|
'@typescript-eslint/no-explicit-any': 'off',
|
|
47
51
|
'@typescript-eslint/no-namespace': [
|
|
48
52
|
'error',
|
|
49
53
|
{ allowDefinitionFiles: true },
|
|
50
54
|
],
|
|
51
55
|
'@typescript-eslint/no-non-null-assertion': 'error',
|
|
52
|
-
'@typescript-eslint/
|
|
53
|
-
'@typescript-eslint/no-require-imports': 'error',
|
|
56
|
+
'@typescript-eslint/parameter-properties': 'error',
|
|
54
57
|
'@typescript-eslint/prefer-for-of': 'error',
|
|
55
58
|
'@typescript-eslint/prefer-function-type': 'error',
|
|
56
59
|
'@typescript-eslint/prefer-optional-chain': 'error',
|
|
@@ -74,6 +77,8 @@ module.exports = {
|
|
|
74
77
|
'@typescript-eslint/no-unsafe-return': 'off',
|
|
75
78
|
|
|
76
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',
|
|
77
82
|
'@typescript-eslint/require-await': 'off',
|
|
78
83
|
|
|
79
84
|
// Our rules that require type information
|
|
@@ -169,10 +174,6 @@ module.exports = {
|
|
|
169
174
|
'no-shadow': 'off',
|
|
170
175
|
'@typescript-eslint/no-shadow': ['error', { builtinGlobals: true }],
|
|
171
176
|
|
|
172
|
-
'no-throw-literal': 'off',
|
|
173
|
-
'@typescript-eslint/no-throw-literal': 'error',
|
|
174
|
-
|
|
175
|
-
'no-unused-expressions': 'off',
|
|
176
177
|
'@typescript-eslint/no-unused-expressions': [
|
|
177
178
|
'error',
|
|
178
179
|
{ allowShortCircuit: true, allowTernary: true },
|
|
@@ -211,4 +212,6 @@ module.exports = {
|
|
|
211
212
|
},
|
|
212
213
|
],
|
|
213
214
|
},
|
|
214
|
-
};
|
|
215
|
+
});
|
|
216
|
+
|
|
217
|
+
export default config;
|