@metamask/eslint-config-typescript 8.0.0 → 10.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
@@ -6,7 +6,42 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
6
6
 
7
7
  ## [Unreleased]
8
8
 
9
+ ## [10.0.0]
10
+ ### Changed
11
+ - **(BREAKING)** Update ESLint from v7 to v8 ([#233](https://github.com/MetaMask/eslint-config/pull/233))
12
+ - This is breaking because `eslint` is a `peerDependency`.
13
+ - Four new rules have been added:
14
+ - [`no-loss-of-precision`](https://eslint.org/docs/latest/rules/no-loss-of-precision)
15
+ - [`no-nonoctal-decimal-escape`](https://eslint.org/docs/latest/rules/no-nonoctal-decimal-escape)
16
+ - [`no-unsafe-optional-chaining`](https://eslint.org/docs/latest/rules/no-unsafe-optional-chaining)
17
+ - [`no-useless-backreference`](https://eslint.org/docs/latest/rules/no-useless-backreference)
18
+ - **(BREAKING)** Update `@typescript-eslint` parser and plugin ([#230](https://github.com/MetaMask/eslint-config/pull/230))
19
+ - This is breaking because these two packages are `peerDependencies`
20
+ - There are two new rules:
21
+ - [`@typescript-eslint/no-loss-of-precision`](https://typescript-eslint.io/rules/no-loss-of-precision)
22
+ - [`@typescript-eslint/no-unnecessary-type-constraint`](https://typescript-eslint.io/rules/no-unnecessary-type-constraint).
23
+ - **(BREAKING)** Update minimium Node.js version to v14 ([#225](https://github.com/MetaMask/eslint-config/pull/225))
24
+ - **(BREAKING)** Forbid TypeScript interfaces ([#216](https://github.com/MetaMask/eslint-config/pull/216))
25
+ - Ignore rest siblings for `no-unused-vars` ([#213](https://github.com/MetaMask/eslint-config/pull/213))
26
+ - This makes the `no-unused-vars` rule more permissive
27
+
28
+ ## [9.0.1]
29
+ ### Changed
30
+ - Disable `@typescript-eslint/no-throw-literal` ([#210](https://github.com/MetaMask/eslint-config/pull/210))
31
+ - 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.
32
+
33
+ ## [9.0.0]
34
+ ### Added
35
+ - **BREAKING** Add JSDoc ESLint rules ([#203](https://github.com/MetaMask/eslint-config/pull/203))
36
+
37
+ ### Changed
38
+ - **BREAKING** Disable `no-throw-literal` and enable `@typescript-eslint/no-throw-literal` ([#201](https://github.com/MetaMask/eslint-config/pull/201))
39
+ - 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).
40
+ - 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.
41
+
9
42
  ## [8.0.0]
43
+ ### Changed
44
+ - ***BREAKING*** The peer dependency `@metamask/eslint-config` has been updated from v7 to v8.
10
45
 
11
46
  ## [7.0.1]
12
47
  ### Fixed
@@ -41,7 +76,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
41
76
  - 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`.
42
77
  - Update `eslint` and other ESLint peer dependencies ([#151](https://github.com/MetaMask/eslint-config/pull/151))
43
78
 
44
- [Unreleased]: https://github.com/MetaMask/eslint-config/compare/v8.0.0...HEAD
79
+ [Unreleased]: https://github.com/MetaMask/eslint-config/compare/v10.0.0...HEAD
80
+ [10.0.0]: https://github.com/MetaMask/eslint-config/compare/v9.0.1...v10.0.0
81
+ [9.0.1]: https://github.com/MetaMask/eslint-config/compare/v9.0.0...v9.0.1
82
+ [9.0.0]: https://github.com/MetaMask/eslint-config/compare/v8.0.0...v9.0.0
45
83
  [8.0.0]: https://github.com/MetaMask/eslint-config/compare/v7.0.1...v8.0.0
46
84
  [7.0.1]: https://github.com/MetaMask/eslint-config/compare/v7.0.0...v7.0.1
47
85
  [7.0.0]: https://github.com/MetaMask/eslint-config/compare/v6.0.0...v7.0.0
package/README.md CHANGED
@@ -6,13 +6,14 @@ MetaMask's [TypeScript](https://www.typescriptlang.org) ESLint configuration.
6
6
 
7
7
  ```bash
8
8
  yarn add --dev \
9
- @metamask/eslint-config@^7.0.0 \
10
- @metamask/eslint-config-typescript@^7.0.0 \
11
- @typescript-eslint/eslint-plugin@^4.20.0 \
12
- @typescript-eslint/parser@^4.20.0 \
9
+ @metamask/eslint-config@^9.0.0 \
10
+ @metamask/eslint-config-typescript@^9.0.1 \
11
+ @typescript-eslint/eslint-plugin@^5.33.0 \
12
+ @typescript-eslint/parser@^5.33.0 \
13
13
  eslint@^7.23.0 \
14
14
  eslint-config-prettier@^8.1.0 \
15
15
  eslint-plugin-import@^2.22.1 \
16
+ eslint-plugin-jsdoc@^39.2.9 \
16
17
  eslint-plugin-prettier@^3.3.1 \
17
18
  prettier@^2.2.1
18
19
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@metamask/eslint-config-typescript",
3
- "version": "8.0.0",
3
+ "version": "10.0.0",
4
4
  "description": "Shareable MetaMask ESLint config for TypeScript.",
5
5
  "main": "src/index.js",
6
6
  "publishConfig": {
@@ -11,7 +11,7 @@
11
11
  "src/"
12
12
  ],
13
13
  "engines": {
14
- "node": ">=12.0.0"
14
+ "node": ">=14.0.0"
15
15
  },
16
16
  "scripts": {
17
17
  "test": "eslint .",
@@ -27,17 +27,22 @@
27
27
  },
28
28
  "homepage": "https://github.com/MetaMask/eslint-config#readme",
29
29
  "devDependencies": {
30
- "@metamask/eslint-config": "^8.0.0",
31
- "@typescript-eslint/eslint-plugin": "^4.20.0",
32
- "@typescript-eslint/parser": "^4.20.0",
33
- "eslint": "^7.23.0",
30
+ "@metamask/eslint-config": "^10.0.0",
31
+ "@typescript-eslint/eslint-plugin": "^5.33.0",
32
+ "@typescript-eslint/parser": "^5.33.0",
33
+ "eslint": "^8.21.0",
34
+ "eslint-config-prettier": "^8.1.0",
35
+ "eslint-plugin-import": "^2.26.0",
36
+ "eslint-plugin-jsdoc": "^39.2.9",
37
+ "eslint-plugin-prettier": "^4.2.1",
38
+ "prettier": "^2.2.1",
34
39
  "typescript": "^4.0.7"
35
40
  },
36
41
  "peerDependencies": {
37
- "@metamask/eslint-config": "^8.0.0",
38
- "@typescript-eslint/eslint-plugin": "^4.20.0",
39
- "@typescript-eslint/parser": "^4.20.0",
40
- "eslint": "^7.23.0",
42
+ "@metamask/eslint-config": "^10.0.0",
43
+ "@typescript-eslint/eslint-plugin": "^5.33.0",
44
+ "@typescript-eslint/parser": "^5.33.0",
45
+ "eslint": "^8.21.0",
41
46
  "typescript": "^4.0.7"
42
47
  }
43
48
  }
package/src/index.js CHANGED
@@ -17,7 +17,7 @@ module.exports = {
17
17
  sourceType: 'module',
18
18
  },
19
19
 
20
- plugins: ['@typescript-eslint'],
20
+ plugins: ['@typescript-eslint', 'jsdoc'],
21
21
 
22
22
  extends: [
23
23
  'plugin:@typescript-eslint/recommended',
@@ -34,8 +34,7 @@ module.exports = {
34
34
  // Our rules
35
35
  '@typescript-eslint/array-type': 'error',
36
36
  '@typescript-eslint/consistent-type-assertions': 'error',
37
- '@typescript-eslint/consistent-type-definitions': 'error',
38
- '@typescript-eslint/explicit-module-boundary-types': 'off',
37
+ '@typescript-eslint/consistent-type-definitions': ['error', 'type'],
39
38
  '@typescript-eslint/no-explicit-any': 'off',
40
39
  '@typescript-eslint/no-namespace': [
41
40
  'error',
@@ -51,7 +50,12 @@ module.exports = {
51
50
  '@typescript-eslint/no-dupe-class-members': 'error',
52
51
  '@typescript-eslint/no-unused-vars': [
53
52
  'error',
54
- { vars: 'all', args: 'all', argsIgnorePattern: '[_]+' },
53
+ {
54
+ vars: 'all',
55
+ args: 'all',
56
+ argsIgnorePattern: '[_]+',
57
+ ignoreRestSiblings: true,
58
+ },
55
59
  ],
56
60
 
57
61
  'default-param-last': 'off',
@@ -60,6 +64,9 @@ module.exports = {
60
64
  'no-shadow': 'off',
61
65
  '@typescript-eslint/no-shadow': ['error', { builtinGlobals: true }],
62
66
 
67
+ 'no-throw-literal': 'off',
68
+ // '@typescript-eslint/no-throw-literal' is left disabled because it requires type information
69
+
63
70
  'no-unused-expressions': 'off',
64
71
  '@typescript-eslint/no-unused-expressions': [
65
72
  'error',
@@ -71,5 +78,22 @@ module.exports = {
71
78
 
72
79
  'no-useless-constructor': 'off',
73
80
  '@typescript-eslint/no-useless-constructor': 'error',
81
+
82
+ /* jsdoc plugin rules */
83
+
84
+ 'jsdoc/check-syntax': 'error',
85
+
86
+ // This is enabled here rather than in the base config because it doesn't play nicely with
87
+ // multi-line JSDoc types.
88
+ 'jsdoc/check-indentation': 'error',
89
+
90
+ // Use TypeScript types rather than JSDoc types.
91
+ 'jsdoc/no-types': 'error',
92
+
93
+ // These all conflict with `jsdoc/no-types`.
94
+ 'jsdoc/require-param-type': 'off',
95
+ 'jsdoc/require-property-type': 'off',
96
+ 'jsdoc/require-returns-type': 'off',
97
+ 'jsdoc/valid-types': 'off',
74
98
  },
75
99
  };