@metamask/eslint-config-typescript 11.0.2 → 12.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,6 +6,20 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
6
6
 
7
7
  ## [Unreleased]
8
8
 
9
+ ## [12.0.0]
10
+ ### Added
11
+ - **BREAKING:** Add rule to enforce generic parameters have a length of at least 3 characters ([#292](https://github.com/MetaMask/eslint-config/pull/292))
12
+ - **BREAKING:** Enable `@typescript-eslint/consistent-type-imports` rule ([#284](https://github.com/MetaMask/eslint-config/pull/284))
13
+ - **BREAKING:** Enable `@typescript-eslint/prefer-enum-initializers` rule ([#269](https://github.com/MetaMask/eslint-config/pull/269))
14
+
15
+ ### Changed
16
+ - **BREAKING:** Update peer dependency `@metamask/eslint-config` to v12
17
+ - Disable naming convention for properties that require quotes ([#293](https://github.com/MetaMask/eslint-config/pull/293))
18
+
19
+ ## [11.1.0]
20
+ ### Changed
21
+ - Exclude test files from package ([#266](https://github.com/MetaMask/eslint-config/pull/266))
22
+
9
23
  ## [11.0.2]
10
24
  ### Changed
11
25
  - Allow async functions without any 'await' ([#262](https://github.com/MetaMask/eslint-config/pull/262))
@@ -89,7 +103,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
89
103
  - 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`.
90
104
  - Update `eslint` and other ESLint peer dependencies ([#151](https://github.com/MetaMask/eslint-config/pull/151))
91
105
 
92
- [Unreleased]: https://github.com/MetaMask/eslint-config/compare/v11.0.2...HEAD
106
+ [Unreleased]: https://github.com/MetaMask/eslint-config/compare/v12.0.0...HEAD
107
+ [12.0.0]: https://github.com/MetaMask/eslint-config/compare/v11.1.0...v12.0.0
108
+ [11.1.0]: https://github.com/MetaMask/eslint-config/compare/v11.0.2...v11.1.0
93
109
  [11.0.2]: https://github.com/MetaMask/eslint-config/compare/v11.0.0...v11.0.2
94
110
  [11.0.0]: https://github.com/MetaMask/eslint-config/compare/v10.0.0...v11.0.0
95
111
  [10.0.0]: https://github.com/MetaMask/eslint-config/compare/v9.0.1...v10.0.0
package/README.md CHANGED
@@ -6,8 +6,8 @@ MetaMask's [TypeScript](https://www.typescriptlang.org) ESLint configuration.
6
6
 
7
7
  ```bash
8
8
  yarn add --dev \
9
- @metamask/eslint-config@^11.0.1 \
10
- @metamask/eslint-config-typescript@^11.0.0 \
9
+ @metamask/eslint-config@^12.0.0 \
10
+ @metamask/eslint-config-typescript@^12.0.0 \
11
11
  @typescript-eslint/eslint-plugin@^5.42.1 \
12
12
  @typescript-eslint/parser@^5.42.1 \
13
13
  eslint@^8.27.0 \
@@ -15,6 +15,7 @@ yarn add --dev \
15
15
  eslint-plugin-import@^2.26.0 \
16
16
  eslint-plugin-jsdoc@^39.6.2 \
17
17
  eslint-plugin-prettier@^4.2.1 \
18
+ eslint-plugin-promise@^6.1.1 \
18
19
  prettier@^2.7.1
19
20
  ```
20
21
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@metamask/eslint-config-typescript",
3
- "version": "11.0.2",
3
+ "version": "12.0.0",
4
4
  "description": "Shareable MetaMask ESLint config for TypeScript.",
5
5
  "homepage": "https://github.com/MetaMask/eslint-config#readme",
6
6
  "bugs": {
@@ -13,7 +13,9 @@
13
13
  "license": "MIT",
14
14
  "main": "src/index.js",
15
15
  "files": [
16
- "src/"
16
+ "src/",
17
+ "!src/**/*.test.js",
18
+ "!src/**/__test__"
17
19
  ],
18
20
  "scripts": {
19
21
  "lint:changelog": "auto-changelog validate",
@@ -22,7 +24,7 @@
22
24
  },
23
25
  "devDependencies": {
24
26
  "@metamask/auto-changelog": "^3.0.0",
25
- "@metamask/eslint-config": "^11.0.0",
27
+ "@metamask/eslint-config": "^12.0.0",
26
28
  "@typescript-eslint/eslint-plugin": "^5.42.1",
27
29
  "@typescript-eslint/parser": "^5.42.1",
28
30
  "eslint": "^8.27.0",
@@ -34,7 +36,7 @@
34
36
  "typescript": "~4.8.4"
35
37
  },
36
38
  "peerDependencies": {
37
- "@metamask/eslint-config": "^11.0.0",
39
+ "@metamask/eslint-config": "^12.0.0",
38
40
  "@typescript-eslint/eslint-plugin": "^5.42.1",
39
41
  "@typescript-eslint/parser": "^5.42.1",
40
42
  "eslint": "^8.27.0",
package/src/index.js CHANGED
@@ -42,6 +42,7 @@ module.exports = {
42
42
  '@typescript-eslint/array-type': 'error',
43
43
  '@typescript-eslint/consistent-type-assertions': 'error',
44
44
  '@typescript-eslint/consistent-type-definitions': ['error', 'type'],
45
+ '@typescript-eslint/consistent-type-imports': 'error',
45
46
  '@typescript-eslint/no-explicit-any': 'off',
46
47
  '@typescript-eslint/no-namespace': [
47
48
  'error',
@@ -109,6 +110,14 @@ module.exports = {
109
110
  selector: 'typeLike',
110
111
  format: ['PascalCase'],
111
112
  },
113
+ {
114
+ selector: 'typeParameter',
115
+ format: ['PascalCase'],
116
+ custom: {
117
+ regex: '^.{3,}',
118
+ match: true,
119
+ },
120
+ },
112
121
  {
113
122
  selector: 'variable',
114
123
  format: ['camelCase', 'UPPER_CASE', 'PascalCase'],
@@ -119,11 +128,26 @@ module.exports = {
119
128
  format: ['camelCase', 'PascalCase'],
120
129
  leadingUnderscore: 'allow',
121
130
  },
131
+ {
132
+ selector: [
133
+ 'classProperty',
134
+ 'objectLiteralProperty',
135
+ 'typeProperty',
136
+ 'classMethod',
137
+ 'objectLiteralMethod',
138
+ 'typeMethod',
139
+ 'accessor',
140
+ 'enumMember',
141
+ ],
142
+ format: null,
143
+ modifiers: ['requiresQuotes'],
144
+ },
122
145
  ],
123
146
  '@typescript-eslint/no-meaningless-void-operator': 'error',
124
147
  '@typescript-eslint/no-unnecessary-boolean-literal-compare': 'error',
125
148
  '@typescript-eslint/no-unnecessary-qualifier': 'error',
126
149
  '@typescript-eslint/no-unnecessary-type-arguments': 'error',
150
+ '@typescript-eslint/prefer-enum-initializers': 'error',
127
151
  '@typescript-eslint/prefer-includes': 'error',
128
152
  '@typescript-eslint/prefer-nullish-coalescing': 'error',
129
153
  '@typescript-eslint/prefer-readonly': 'error',
@@ -1,2 +0,0 @@
1
- // This file is only used to test the config.
2
- console.log('Hello, world!');
package/src/index.test.js DELETED
@@ -1,31 +0,0 @@
1
- const { ESLint } = require('eslint');
2
- const { resolve } = require('path');
3
-
4
- const config = require('.');
5
-
6
- describe('index', () => {
7
- it('is a valid ESLint config', async () => {
8
- const api = new ESLint({
9
- baseConfig: config,
10
- useEslintrc: false,
11
- overrideConfig: {
12
- env: {
13
- node: true,
14
- },
15
- parserOptions: {
16
- tsconfigRootDir: resolve(__dirname, '..'),
17
- project: 'tsconfig.json',
18
- },
19
- },
20
- });
21
-
22
- // In order to test rules that require type information, we need to actually
23
- // compile the file with TypeScript, so rather than using `api.lintText()`,
24
- // we use `api.lintFiles()` and pass in a file that we know will pass.
25
- const result = await api.lintFiles(resolve(__dirname, '__test__/dummy.ts'));
26
-
27
- expect(result[0].messages).toStrictEqual([]);
28
- expect(result[0].warningCount).toBe(0);
29
- expect(result[0].errorCount).toBe(0);
30
- });
31
- });