@typescript-eslint/eslint-plugin 8.0.0-alpha.6 → 8.0.0-alpha.8
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/dist/util/createRule.js.map +1 -1
- package/dist/util/getFunctionHeadLoc.js.map +1 -1
- package/docs/rules/consistent-type-imports.mdx +1 -1
- package/docs/rules/no-duplicate-imports.mdx +1 -1
- package/docs/rules/no-floating-promises.mdx +2 -2
- package/docs/rules/no-import-type-side-effects.mdx +1 -1
- package/docs/rules/no-unnecessary-boolean-literal-compare.mdx +12 -12
- package/docs/rules/unbound-method.mdx +1 -1
- package/package.json +7 -7
- package/rules.d.ts +6 -2
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"createRule.js","sourceRoot":"","sources":["../../src/util/createRule.ts"],"names":[],"mappings":";;;AAAA,oDAAuD;
|
1
|
+
{"version":3,"file":"createRule.js","sourceRoot":"","sources":["../../src/util/createRule.ts"],"names":[],"mappings":";;;AAAA,oDAAuD;AA4B1C,QAAA,UAAU,GAAG,mBAAW,CAAC,WAAW,CAC/C,IAAI,CAAC,EAAE,CAAC,sCAAsC,IAAI,EAAE,CACrD,CAAC"}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"getFunctionHeadLoc.js","sourceRoot":"","sources":["../../src/util/getFunctionHeadLoc.ts"],"names":[],"mappings":";AAAA,uIAAuI;;;AAGvI,oDAAuE;AAEvE,yCAA+D;AAO/D;;;;;GAKG;AACH,SAAS,uBAAuB,CAC9B,IAAkB,EAClB,UAA+B;IAE/B,4GAA4G;IAC5G,IACE,IAAI,CAAC,IAAI,KAAK,sBAAc,CAAC,uBAAuB;QACpD,IAAI,CAAC,MAAM,CAAC,MAAM,KAAK,CAAC,EACxB,CAAC;QACD,MAAM,QAAQ,GAAG,mBAAW,CAAC,UAAU,CACrC,UAAU,CAAC,aAAa,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,EACxC,mBAA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G,UAAU,CAAC,GAAG,CAAC,GAAG,CAAC;IAC3B,CAAC;SAAM,CAAC;QACN,KAAK,GAAG,IAAI,CAAC,GAAG,CAAC,KAAK,CAAC;QACvB,GAAG,GAAG,uBAAuB,CAAC,IAAI,EAAE,UAAU,CAAC,CAAC,GAAG,CAAC,KAAK,CAAC;IAC5D,CAAC;IAED,OAAO;QACL,KAAK,EAAE,MAAM,CAAC,MAAM,CAAC,EAAE,EAAE,KAAK,CAAC;QAC/B,GAAG,EAAE,MAAM,CAAC,MAAM,CAAC,EAAE,EAAE,GAAG,CAAC;KAC5B,CAAC;AACJ,CAAC;AApDD,gDAoDC"}
|
@@ -132,5 +132,5 @@ We recommend picking a single option for this rule that works best for your proj
|
|
132
132
|
## Related To
|
133
133
|
|
134
134
|
- [`no-import-type-side-effects`](./no-import-type-side-effects.mdx)
|
135
|
-
- [`import/consistent-type-specifier-style`](https://github.com/import-js/eslint-plugin-import/blob/main/docs/rules/consistent-type-specifier-style.
|
135
|
+
- [`import/consistent-type-specifier-style`](https://github.com/import-js/eslint-plugin-import/blob/main/docs/rules/consistent-type-specifier-style.md)
|
136
136
|
- [`import/no-duplicates` with `{"prefer-inline": true}`](https://github.com/import-js/eslint-plugin-import/blob/main/docs/rules/no-duplicates.md#inline-type-imports)
|
@@ -1,6 +1,6 @@
|
|
1
1
|
:::danger Deprecated
|
2
2
|
|
3
|
-
This rule has been deprecated in favour of the [`import/no-duplicates`](https://github.com/import-js/eslint-plugin-import/blob/HEAD/docs/rules/no-duplicates.
|
3
|
+
This rule has been deprecated in favour of the [`import/no-duplicates`](https://github.com/import-js/eslint-plugin-import/blob/HEAD/docs/rules/no-duplicates.md) rule.
|
4
4
|
|
5
5
|
:::
|
6
6
|
|
@@ -22,8 +22,8 @@ Valid ways of handling a Promise-valued statement include:
|
|
22
22
|
|
23
23
|
This rule also reports when an Array containing Promises is created and not properly handled. The main way to resolve this is by using one of the Promise concurrency methods to create a single Promise, then handling that according to the procedure above. These methods include:
|
24
24
|
|
25
|
-
- `Promise.all()
|
26
|
-
- `Promise.allSettled()
|
25
|
+
- `Promise.all()`
|
26
|
+
- `Promise.allSettled()`
|
27
27
|
- `Promise.any()`
|
28
28
|
- `Promise.race()`
|
29
29
|
|
@@ -76,5 +76,5 @@ If you're not using TypeScript 5.0's `verbatimModuleSyntax` option and your proj
|
|
76
76
|
## Related To
|
77
77
|
|
78
78
|
- [`consistent-type-imports`](./consistent-type-imports.mdx)
|
79
|
-
- [`import/consistent-type-specifier-style`](https://github.com/import-js/eslint-plugin-import/blob/main/docs/rules/consistent-type-specifier-style.
|
79
|
+
- [`import/consistent-type-specifier-style`](https://github.com/import-js/eslint-plugin-import/blob/main/docs/rules/consistent-type-specifier-style.md)
|
80
80
|
- [`import/no-duplicates` with `{"prefer-inline": true}`](https://github.com/import-js/eslint-plugin-import/blob/main/docs/rules/no-duplicates.md#inline-type-imports)
|
@@ -114,11 +114,11 @@ if (someNullCondition !== false) {
|
|
114
114
|
|
115
115
|
```ts option='{ "allowComparingNullableBooleansToFalse": false }'
|
116
116
|
declare const someUndefinedCondition: boolean | undefined;
|
117
|
-
if (someUndefinedCondition ?? true) {
|
117
|
+
if (!(someUndefinedCondition ?? true)) {
|
118
118
|
}
|
119
119
|
|
120
120
|
declare const someNullCondition: boolean | null;
|
121
|
-
if (
|
121
|
+
if (someNullCondition ?? true) {
|
122
122
|
}
|
123
123
|
```
|
124
124
|
|
@@ -127,16 +127,16 @@ if (!(someNullCondition ?? true)) {
|
|
127
127
|
|
128
128
|
## Fixer
|
129
129
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
130
|
+
| Comparison | Fixer Output | Notes |
|
131
|
+
| :----------------------------: | ------------------------------- | ----------------------------------------------------------------------------------- |
|
132
|
+
| `booleanVar === true` | `booleanVar` | |
|
133
|
+
| `booleanVar !== true` | `!booleanVar` | |
|
134
|
+
| `booleanVar === false` | `!booleanVar` | |
|
135
|
+
| `booleanVar !== false` | `booleanVar` | |
|
136
|
+
| `nullableBooleanVar === true` | `nullableBooleanVar` | Only checked/fixed if the `allowComparingNullableBooleansToTrue` option is `false` |
|
137
|
+
| `nullableBooleanVar !== true` | `!nullableBooleanVar` | Only checked/fixed if the `allowComparingNullableBooleansToTrue` option is `false` |
|
138
|
+
| `nullableBooleanVar === false` | `!(nullableBooleanVar ?? true)` | Only checked/fixed if the `allowComparingNullableBooleansToFalse` option is `false` |
|
139
|
+
| `nullableBooleanVar !== false` | `nullableBooleanVar ?? true` | Only checked/fixed if the `allowComparingNullableBooleansToFalse` option is `false` |
|
140
140
|
|
141
141
|
## When Not To Use It
|
142
142
|
|
@@ -16,7 +16,7 @@ Otherwise, passing class methods around as values can remove type safety by fail
|
|
16
16
|
This rule reports when a class method is referenced in an unbound manner.
|
17
17
|
|
18
18
|
:::note Tip
|
19
|
-
If you're working with `jest`, you can use [`eslint-plugin-jest`'s version of this rule](https://github.com/jest-community/eslint-plugin-jest/blob/main/docs/rules/unbound-method.
|
19
|
+
If you're working with `jest`, you can use [`eslint-plugin-jest`'s version of this rule](https://github.com/jest-community/eslint-plugin-jest/blob/main/docs/rules/unbound-method.md) to lint your test files, which knows when it's ok to pass an unbound method to `expect` calls.
|
20
20
|
:::
|
21
21
|
|
22
22
|
## Examples
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@typescript-eslint/eslint-plugin",
|
3
|
-
"version": "8.0.0-alpha.
|
3
|
+
"version": "8.0.0-alpha.8",
|
4
4
|
"description": "TypeScript plugin for ESLint",
|
5
5
|
"files": [
|
6
6
|
"dist",
|
@@ -62,10 +62,10 @@
|
|
62
62
|
},
|
63
63
|
"dependencies": {
|
64
64
|
"@eslint-community/regexpp": "^4.10.0",
|
65
|
-
"@typescript-eslint/scope-manager": "8.0.0-alpha.
|
66
|
-
"@typescript-eslint/type-utils": "8.0.0-alpha.
|
67
|
-
"@typescript-eslint/utils": "8.0.0-alpha.
|
68
|
-
"@typescript-eslint/visitor-keys": "8.0.0-alpha.
|
65
|
+
"@typescript-eslint/scope-manager": "8.0.0-alpha.8",
|
66
|
+
"@typescript-eslint/type-utils": "8.0.0-alpha.8",
|
67
|
+
"@typescript-eslint/utils": "8.0.0-alpha.8",
|
68
|
+
"@typescript-eslint/visitor-keys": "8.0.0-alpha.8",
|
69
69
|
"debug": "^4.3.4",
|
70
70
|
"graphemer": "^1.4.0",
|
71
71
|
"ignore": "^5.3.1",
|
@@ -78,8 +78,8 @@
|
|
78
78
|
"@types/marked": "*",
|
79
79
|
"@types/mdast": "^4.0.3",
|
80
80
|
"@types/natural-compare": "*",
|
81
|
-
"@typescript-eslint/rule-schema-to-typescript-types": "8.0.0-alpha.
|
82
|
-
"@typescript-eslint/rule-tester": "8.0.0-alpha.
|
81
|
+
"@typescript-eslint/rule-schema-to-typescript-types": "8.0.0-alpha.8",
|
82
|
+
"@typescript-eslint/rule-tester": "8.0.0-alpha.8",
|
83
83
|
"ajv": "^6.12.6",
|
84
84
|
"chalk": "^5.3.0",
|
85
85
|
"cross-env": "^7.0.3",
|
package/rules.d.ts
CHANGED
@@ -35,11 +35,15 @@ This is likely not portable. A type annotation is necessary. ts(2742)
|
|
35
35
|
```
|
36
36
|
*/
|
37
37
|
|
38
|
-
import type {
|
38
|
+
import type { RuleModuleWithMetaDocs } from '@typescript-eslint/utils/ts-eslint';
|
39
|
+
|
40
|
+
import type { ESLintPluginDocs, ESLintPluginRuleModule } from './src/util';
|
41
|
+
|
42
|
+
export { ESLintPluginDocs, ESLintPluginRuleModule };
|
39
43
|
|
40
44
|
export type TypeScriptESLintRules = Record<
|
41
45
|
string,
|
42
|
-
|
46
|
+
RuleModuleWithMetaDocs<string, unknown[], ESLintPluginDocs>
|
43
47
|
>;
|
44
48
|
declare const rules: TypeScriptESLintRules;
|
45
49
|
// eslint-disable-next-line import/no-default-export
|