xo 0.50.0 → 0.51.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/cli.js +1 -1
- package/index.js +7 -2
- package/lib/report.js +3 -1
- package/node_modules/@typescript-eslint/eslint-plugin/README.md +1 -145
- package/node_modules/@typescript-eslint/eslint-plugin/dist/configs/all.js +1 -0
- package/node_modules/@typescript-eslint/eslint-plugin/dist/configs/all.js.map +1 -1
- package/node_modules/@typescript-eslint/eslint-plugin/dist/configs/strict.js +1 -0
- package/node_modules/@typescript-eslint/eslint-plugin/dist/configs/strict.js.map +1 -1
- package/node_modules/@typescript-eslint/eslint-plugin/dist/rules/consistent-generic-constructors.js +87 -0
- package/node_modules/@typescript-eslint/eslint-plugin/dist/rules/consistent-generic-constructors.js.map +1 -0
- package/node_modules/@typescript-eslint/eslint-plugin/dist/rules/consistent-indexed-object-style.js +1 -1
- package/node_modules/@typescript-eslint/eslint-plugin/dist/rules/consistent-indexed-object-style.js.map +1 -1
- package/node_modules/@typescript-eslint/eslint-plugin/dist/rules/index.js +2 -0
- package/node_modules/@typescript-eslint/eslint-plugin/dist/rules/index.js.map +1 -1
- package/node_modules/@typescript-eslint/eslint-plugin/dist/rules/no-base-to-string.js +1 -1
- package/node_modules/@typescript-eslint/eslint-plugin/dist/rules/no-base-to-string.js.map +1 -1
- package/node_modules/@typescript-eslint/eslint-plugin/dist/rules/no-inferrable-types.js +9 -1
- package/node_modules/@typescript-eslint/eslint-plugin/dist/rules/no-inferrable-types.js.map +1 -1
- package/node_modules/@typescript-eslint/eslint-plugin/dist/rules/no-shadow.js +38 -8
- package/node_modules/@typescript-eslint/eslint-plugin/dist/rules/no-shadow.js.map +1 -1
- package/node_modules/@typescript-eslint/eslint-plugin/dist/rules/no-unused-vars.js +4 -3
- package/node_modules/@typescript-eslint/eslint-plugin/dist/rules/no-unused-vars.js.map +1 -1
- package/node_modules/@typescript-eslint/eslint-plugin/dist/rules/space-infix-ops.js +16 -30
- package/node_modules/@typescript-eslint/eslint-plugin/dist/rules/space-infix-ops.js.map +1 -1
- package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/README.md +3 -138
- package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/adjacent-overload-signatures.md +0 -4
- package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/array-type.md +0 -4
- package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/await-thenable.md +0 -4
- package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/ban-ts-comment.md +31 -8
- package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/ban-types.md +0 -4
- package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/comma-dangle.md +1 -1
- package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/consistent-generic-constructors.md +82 -0
- package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/consistent-type-assertions.md +0 -5
- package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/consistent-type-definitions.md +0 -4
- package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/explicit-member-accessibility.md +0 -4
- package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/explicit-module-boundary-types.md +3 -4
- package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/member-ordering.md +0 -4
- package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/no-confusing-void-expression.md +0 -4
- package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/no-dynamic-delete.md +0 -4
- package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/no-empty-interface.md +0 -4
- package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/no-explicit-any.md +0 -4
- package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/no-extraneous-class.md +0 -4
- package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/no-floating-promises.md +0 -1
- package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/no-for-in-array.md +0 -6
- package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/no-inferrable-types.md +0 -4
- package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/no-invalid-void-type.md +0 -4
- package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/no-misused-new.md +0 -4
- package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/no-namespace.md +0 -4
- package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/no-non-null-assertion.md +0 -4
- package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/no-parameter-properties.md +0 -4
- package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/no-require-imports.md +0 -4
- package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/no-this-alias.md +18 -24
- package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/no-type-alias.md +0 -4
- package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/no-unnecessary-boolean-literal-compare.md +0 -4
- package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/no-unnecessary-qualifier.md +0 -4
- package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/no-unnecessary-type-arguments.md +0 -4
- package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/no-unnecessary-type-assertion.md +0 -4
- package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/no-unsafe-argument.md +0 -1
- package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/no-unsafe-assignment.md +0 -1
- package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/no-unsafe-call.md +0 -1
- package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/no-unsafe-member-access.md +0 -1
- package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/no-unsafe-return.md +0 -1
- package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/no-var-requires.md +0 -4
- package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/parameter-properties.md +0 -4
- package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/prefer-for-of.md +0 -4
- package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/prefer-function-type.md +0 -4
- package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/prefer-namespace-keyword.md +0 -4
- package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/prefer-optional-chain.md +2 -2
- package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/prefer-readonly.md +0 -4
- package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/promise-function-async.md +0 -4
- package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/restrict-plus-operands.md +0 -4
- package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/strict-boolean-expressions.md +0 -1
- package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/triple-slash-reference.md +0 -5
- package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/type-annotation-spacing.md +0 -4
- package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/typedef.md +1 -5
- package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/unbound-method.md +0 -4
- package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/unified-signatures.md +0 -4
- package/node_modules/@typescript-eslint/eslint-plugin/package.json +5 -5
- package/node_modules/@typescript-eslint/parser/_ts3.4/dist/index.d.ts +4 -0
- package/node_modules/@typescript-eslint/parser/_ts3.4/dist/parser.d.ts +20 -0
- package/node_modules/@typescript-eslint/parser/package.json +6 -5
- package/node_modules/@typescript-eslint/scope-manager/dist/referencer/ClassVisitor.d.ts.map +1 -1
- package/node_modules/@typescript-eslint/scope-manager/dist/referencer/ClassVisitor.js +6 -4
- package/node_modules/@typescript-eslint/scope-manager/dist/referencer/ClassVisitor.js.map +1 -1
- package/node_modules/@typescript-eslint/scope-manager/dist/referencer/TypeVisitor.d.ts.map +1 -1
- package/node_modules/@typescript-eslint/scope-manager/dist/referencer/TypeVisitor.js +13 -7
- package/node_modules/@typescript-eslint/scope-manager/dist/referencer/TypeVisitor.js.map +1 -1
- package/node_modules/@typescript-eslint/scope-manager/package.json +5 -5
- package/node_modules/@typescript-eslint/type-utils/package.json +4 -4
- package/node_modules/@typescript-eslint/types/_ts3.4/dist/generated/ast-spec.d.ts +1732 -0
- package/node_modules/@typescript-eslint/types/_ts3.4/dist/index.d.ts +5 -0
- package/node_modules/@typescript-eslint/types/_ts3.4/dist/lib.d.ts +3 -0
- package/node_modules/@typescript-eslint/types/_ts3.4/dist/parser-options.d.ts +35 -0
- package/node_modules/@typescript-eslint/types/_ts3.4/dist/ts-estree.d.ts +9 -0
- package/node_modules/@typescript-eslint/types/dist/generated/ast-spec.d.ts +21 -19
- package/node_modules/@typescript-eslint/types/dist/generated/ast-spec.d.ts.map +1 -1
- package/node_modules/@typescript-eslint/types/dist/generated/ast-spec.js.map +1 -1
- package/node_modules/@typescript-eslint/types/package.json +3 -2
- package/node_modules/@typescript-eslint/typescript-estree/_ts3.4/dist/ast-converter.d.ts +9 -0
- package/node_modules/@typescript-eslint/typescript-estree/_ts3.4/dist/convert-comments.d.ts +11 -0
- package/node_modules/@typescript-eslint/typescript-estree/_ts3.4/dist/convert.d.ts +157 -0
- package/node_modules/@typescript-eslint/typescript-estree/_ts3.4/dist/create-program/WatchCompilerHostOfConfigFile.d.ts +13 -0
- package/node_modules/@typescript-eslint/typescript-estree/_ts3.4/dist/create-program/createDefaultProgram.d.ts +12 -0
- package/node_modules/@typescript-eslint/typescript-estree/_ts3.4/dist/create-program/createIsolatedProgram.d.ts +9 -0
- package/node_modules/@typescript-eslint/typescript-estree/_ts3.4/dist/create-program/createProjectProgram.d.ts +11 -0
- package/node_modules/@typescript-eslint/typescript-estree/_ts3.4/dist/create-program/createSourceFile.d.ts +5 -0
- package/node_modules/@typescript-eslint/typescript-estree/_ts3.4/dist/create-program/createWatchProgram.d.ts +19 -0
- package/node_modules/@typescript-eslint/typescript-estree/_ts3.4/dist/create-program/getScriptKind.d.ts +5 -0
- package/node_modules/@typescript-eslint/typescript-estree/_ts3.4/dist/create-program/shared.d.ts +22 -0
- package/node_modules/@typescript-eslint/typescript-estree/_ts3.4/dist/create-program/useProvidedPrograms.d.ts +13 -0
- package/node_modules/@typescript-eslint/typescript-estree/_ts3.4/dist/index.d.ts +10 -0
- package/node_modules/@typescript-eslint/typescript-estree/_ts3.4/dist/jsx/xhtml-entities.d.ts +2 -0
- package/node_modules/@typescript-eslint/typescript-estree/_ts3.4/dist/node-utils.d.ts +230 -0
- package/node_modules/@typescript-eslint/typescript-estree/_ts3.4/dist/parser-options.d.ts +188 -0
- package/node_modules/@typescript-eslint/typescript-estree/_ts3.4/dist/parser.d.ts +25 -0
- package/node_modules/@typescript-eslint/typescript-estree/_ts3.4/dist/semantic-or-syntactic-errors.d.ts +13 -0
- package/node_modules/@typescript-eslint/typescript-estree/_ts3.4/dist/simple-traverse.d.ts +9 -0
- package/node_modules/@typescript-eslint/typescript-estree/_ts3.4/dist/ts-estree/estree-to-ts-node-types.d.ts +175 -0
- package/node_modules/@typescript-eslint/typescript-estree/_ts3.4/dist/ts-estree/index.d.ts +4 -0
- package/node_modules/@typescript-eslint/typescript-estree/_ts3.4/dist/ts-estree/ts-nodes.d.ts +18 -0
- package/node_modules/@typescript-eslint/typescript-estree/_ts3.4/dist/version-check.d.ts +3 -0
- package/node_modules/@typescript-eslint/typescript-estree/dist/convert.d.ts.map +1 -1
- package/node_modules/@typescript-eslint/typescript-estree/dist/convert.js +7 -0
- package/node_modules/@typescript-eslint/typescript-estree/dist/convert.js.map +1 -1
- package/node_modules/@typescript-eslint/typescript-estree/dist/node-utils.d.ts +3 -0
- package/node_modules/@typescript-eslint/typescript-estree/dist/node-utils.d.ts.map +1 -1
- package/node_modules/@typescript-eslint/typescript-estree/dist/node-utils.js +21 -1
- package/node_modules/@typescript-eslint/typescript-estree/dist/node-utils.js.map +1 -1
- package/node_modules/@typescript-eslint/typescript-estree/dist/ts-estree/estree-to-ts-node-types.d.ts +1 -1
- package/node_modules/@typescript-eslint/typescript-estree/dist/ts-estree/estree-to-ts-node-types.d.ts.map +1 -1
- package/node_modules/@typescript-eslint/typescript-estree/package.json +6 -5
- package/node_modules/@typescript-eslint/utils/_ts3.4/dist/ts-eslint/SourceCode.d.ts +1 -1
- package/node_modules/@typescript-eslint/utils/dist/ts-eslint/SourceCode.d.ts +1 -1
- package/node_modules/@typescript-eslint/utils/dist/ts-eslint/SourceCode.d.ts.map +1 -1
- package/node_modules/@typescript-eslint/utils/package.json +5 -5
- package/node_modules/@typescript-eslint/visitor-keys/_ts3.4/dist/get-keys.d.ts +4 -0
- package/node_modules/@typescript-eslint/visitor-keys/_ts3.4/dist/index.d.ts +3 -0
- package/node_modules/@typescript-eslint/visitor-keys/_ts3.4/dist/visitor-keys.d.ts +6 -0
- package/node_modules/@typescript-eslint/visitor-keys/dist/visitor-keys.js +1 -1
- package/node_modules/@typescript-eslint/visitor-keys/dist/visitor-keys.js.map +1 -1
- package/node_modules/@typescript-eslint/visitor-keys/package.json +4 -3
- package/package.json +1 -1
package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/consistent-generic-constructors.md
ADDED
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
# `consistent-generic-constructors`
|
|
2
|
+
|
|
3
|
+
Enforces specifying generic type arguments on type annotation or constructor name of a constructor call.
|
|
4
|
+
|
|
5
|
+
When constructing a generic class, you can specify the type arguments on either the left-hand side (as a type annotation) or the right-hand side (as part of the constructor call):
|
|
6
|
+
|
|
7
|
+
```ts
|
|
8
|
+
// Left-hand side
|
|
9
|
+
const map: Map<string, number> = new Map();
|
|
10
|
+
|
|
11
|
+
// Right-hand side
|
|
12
|
+
const map = new Map<string, number>();
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
This rule ensures that type arguments appear consistently on one side of the declaration.
|
|
16
|
+
|
|
17
|
+
## Options
|
|
18
|
+
|
|
19
|
+
```jsonc
|
|
20
|
+
{
|
|
21
|
+
"rules": {
|
|
22
|
+
"@typescript-eslint/consistent-generic-constructors": [
|
|
23
|
+
"error",
|
|
24
|
+
"constructor"
|
|
25
|
+
]
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
This rule takes a string option:
|
|
31
|
+
|
|
32
|
+
- If it's set to `constructor` (default), type arguments that **only** appear on the type annotation are disallowed.
|
|
33
|
+
- If it's set to `type-annotation`, type arguments that **only** appear on the constructor are disallowed.
|
|
34
|
+
|
|
35
|
+
## Rule Details
|
|
36
|
+
|
|
37
|
+
The rule never reports when there are type parameters on both sides, or neither sides of the declaration. It also doesn't report if the names of the type annotation and the constructor don't match.
|
|
38
|
+
|
|
39
|
+
### `constructor`
|
|
40
|
+
|
|
41
|
+
<!--tabs-->
|
|
42
|
+
|
|
43
|
+
#### ❌ Incorrect
|
|
44
|
+
|
|
45
|
+
```ts
|
|
46
|
+
const map: Map<string, number> = new Map();
|
|
47
|
+
const set: Set<string> = new Set();
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
#### ✅ Correct
|
|
51
|
+
|
|
52
|
+
```ts
|
|
53
|
+
const map = new Map<string, number>();
|
|
54
|
+
const map: Map<string, number> = new MyMap();
|
|
55
|
+
const set = new Set<string>();
|
|
56
|
+
const set = new Set();
|
|
57
|
+
const set: Set<string> = new Set<string>();
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
### `type-annotation`
|
|
61
|
+
|
|
62
|
+
<!--tabs-->
|
|
63
|
+
|
|
64
|
+
#### ❌ Incorrect
|
|
65
|
+
|
|
66
|
+
```ts
|
|
67
|
+
const map = new Map<string, number>();
|
|
68
|
+
const set = new Set<string>();
|
|
69
|
+
```
|
|
70
|
+
|
|
71
|
+
#### ✅ Correct
|
|
72
|
+
|
|
73
|
+
```ts
|
|
74
|
+
const map: Map<string, number> = new Map();
|
|
75
|
+
const set: Set<string> = new Set();
|
|
76
|
+
const set = new Set();
|
|
77
|
+
const set: Set<string> = new Set<string>();
|
|
78
|
+
```
|
|
79
|
+
|
|
80
|
+
## When Not To Use It
|
|
81
|
+
|
|
82
|
+
You can turn this rule off if you don't want to enforce one kind of generic constructor style over the other.
|
package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/consistent-type-assertions.md
CHANGED
|
@@ -111,8 +111,3 @@ const foo = <Foo props={{ ... } as Bar}/>;
|
|
|
111
111
|
## When Not To Use It
|
|
112
112
|
|
|
113
113
|
If you do not want to enforce consistent type assertions.
|
|
114
|
-
|
|
115
|
-
## Related To
|
|
116
|
-
|
|
117
|
-
- TSLint: [no-angle-bracket-type-assertion](https://palantir.github.io/tslint/rules/no-angle-bracket-type-assertion/)
|
|
118
|
-
- TSLint: [no-object-literal-type-assertion](https://palantir.github.io/tslint/rules/no-object-literal-type-assertion/)
|
package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/consistent-type-definitions.md
CHANGED
|
@@ -80,7 +80,3 @@ type T = { x: number };
|
|
|
80
80
|
## When Not To Use It
|
|
81
81
|
|
|
82
82
|
If you specifically want to use an interface or type literal for stylistic reasons, you can disable this rule.
|
|
83
|
-
|
|
84
|
-
## Related To
|
|
85
|
-
|
|
86
|
-
- TSLint: [interface-over-type-literal](https://palantir.github.io/tslint/rules/interface-over-type-literal/)
|
package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/explicit-member-accessibility.md
CHANGED
|
@@ -344,7 +344,3 @@ If you think defaulting to public is a good default, then you should consider us
|
|
|
344
344
|
## Further Reading
|
|
345
345
|
|
|
346
346
|
- TypeScript [Accessibility Modifiers](https://www.typescriptlang.org/docs/handbook/classes.html#public-private-and-protected-modifiers)
|
|
347
|
-
|
|
348
|
-
## Related To
|
|
349
|
-
|
|
350
|
-
- TSLint: [member-access](http://palantir.github.io/tslint/rules/member-access/)
|
package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/explicit-module-boundary-types.md
CHANGED
|
@@ -158,10 +158,9 @@ Examples of code for this rule with `{ allowDirectConstAssertionInArrowFunctions
|
|
|
158
158
|
|
|
159
159
|
```ts
|
|
160
160
|
export const func = (value: number) => ({ type: 'X', value });
|
|
161
|
-
export const foo = () =>
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
} as const);
|
|
161
|
+
export const foo = () => ({
|
|
162
|
+
bar: true,
|
|
163
|
+
});
|
|
165
164
|
export const bar = () => 1;
|
|
166
165
|
```
|
|
167
166
|
|
|
@@ -1159,7 +1159,3 @@ It is also possible to group different member types at the same rank.
|
|
|
1159
1159
|
## When Not To Use It
|
|
1160
1160
|
|
|
1161
1161
|
If you don't care about the general order of your members, then you will not need this rule.
|
|
1162
|
-
|
|
1163
|
-
## Related To
|
|
1164
|
-
|
|
1165
|
-
- TSLint: [member-ordering](https://palantir.github.io/tslint/rules/member-ordering/)
|
package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/no-confusing-void-expression.md
CHANGED
|
@@ -147,7 +147,3 @@ console.log(void alert('Hello, world!'));
|
|
|
147
147
|
The return type of a function can be inspected by going to its definition or hovering over it in an IDE.
|
|
148
148
|
If you don't care about being explicit about the void type in actual code then don't use this rule.
|
|
149
149
|
Also, if you prefer concise coding style then also don't use it.
|
|
150
|
-
|
|
151
|
-
## Related To
|
|
152
|
-
|
|
153
|
-
- TSLint: ['no-void-expression'](https://palantir.github.io/tslint/rules/no-void-expression/)
|
|
@@ -60,7 +60,3 @@ Some environments such as older browsers might not support `Map` and `Set`.
|
|
|
60
60
|
|
|
61
61
|
Do not consider this rule as performance advice before profiling your code's bottlenecks.
|
|
62
62
|
Even repeated minor performance slowdowns likely do not significantly affect your application's general perceived speed.
|
|
63
|
-
|
|
64
|
-
## Related To
|
|
65
|
-
|
|
66
|
-
- TSLint: [no-dynamic-delete](https://palantir.github.io/tslint/rules/no-dynamic-delete)
|
|
@@ -64,7 +64,3 @@ This rule accepts a single object option with the following default configuratio
|
|
|
64
64
|
## When Not To Use It
|
|
65
65
|
|
|
66
66
|
If you don't care about having empty/meaningless interfaces, then you will not need this rule.
|
|
67
|
-
|
|
68
|
-
## Related To
|
|
69
|
-
|
|
70
|
-
- TSLint: [no-empty-interface](https://palantir.github.io/tslint/rules/no-empty-interface/)
|
|
@@ -179,7 +179,3 @@ and you want to be able to specify `any`.
|
|
|
179
179
|
## Further Reading
|
|
180
180
|
|
|
181
181
|
- TypeScript [any type](https://www.typescriptlang.org/docs/handbook/basic-types.html#any)
|
|
182
|
-
|
|
183
|
-
## Related To
|
|
184
|
-
|
|
185
|
-
- TSLint: [no-any](https://palantir.github.io/tslint/rules/no-any/)
|
|
@@ -312,7 +312,3 @@ class Constants {
|
|
|
312
312
|
## When Not To Use It
|
|
313
313
|
|
|
314
314
|
You can disable this rule if you are unable -or unwilling- to switch off using classes as namespaces.
|
|
315
|
-
|
|
316
|
-
## Related To
|
|
317
|
-
|
|
318
|
-
[`no-unnecessary-class`](https://palantir.github.io/tslint/rules/no-unnecessary-class/) from TSLint
|
|
@@ -6,8 +6,6 @@ This rule prohibits iterating over an array with a for-in loop.
|
|
|
6
6
|
|
|
7
7
|
## Rule Details
|
|
8
8
|
|
|
9
|
-
Rationale from TSLint:
|
|
10
|
-
|
|
11
9
|
A for-in loop (`for (var k in o)`) iterates over the properties of an Object.
|
|
12
10
|
While it is legal to use for-in loops with array types, it is not common.
|
|
13
11
|
for-in will iterate over the indices of the array as strings, omitting any "holes" in
|
|
@@ -57,7 +55,3 @@ This rule is not configurable.
|
|
|
57
55
|
## When Not To Use It
|
|
58
56
|
|
|
59
57
|
If you want to iterate through a loop using the indices in an array as strings, you can turn off this rule.
|
|
60
|
-
|
|
61
|
-
## Related To
|
|
62
|
-
|
|
63
|
-
- TSLint: ['no-for-in-array'](https://palantir.github.io/tslint/rules/no-for-in-array/)
|
|
@@ -148,7 +148,3 @@ If you do not want to enforce inferred types.
|
|
|
148
148
|
## Further Reading
|
|
149
149
|
|
|
150
150
|
TypeScript [Inference](https://www.typescriptlang.org/docs/handbook/type-inference.html)
|
|
151
|
-
|
|
152
|
-
## Related To
|
|
153
|
-
|
|
154
|
-
TSLint: [no-inferrable-types](https://palantir.github.io/tslint/rules/no-inferrable-types/)
|
|
@@ -131,7 +131,3 @@ If you are using the ES2015 module syntax, then you will not need this rule.
|
|
|
131
131
|
- [Modules](https://www.typescriptlang.org/docs/handbook/modules.html)
|
|
132
132
|
- [Namespaces](https://www.typescriptlang.org/docs/handbook/namespaces.html)
|
|
133
133
|
- [Namespaces and Modules](https://www.typescriptlang.org/docs/handbook/namespaces-and-modules.html)
|
|
134
|
-
|
|
135
|
-
## Related To
|
|
136
|
-
|
|
137
|
-
- TSLint: [no-namespace](https://palantir.github.io/tslint/rules/no-namespace/)
|
|
@@ -48,7 +48,3 @@ This rule is not configurable.
|
|
|
48
48
|
## When Not To Use It
|
|
49
49
|
|
|
50
50
|
If you don't care about strict null-checking, then you will not need this rule.
|
|
51
|
-
|
|
52
|
-
## Further Reading
|
|
53
|
-
|
|
54
|
-
- [`no-non-null-assertion`](https://palantir.github.io/tslint/rules/no-non-null-assertion/) in [TSLint](https://palantir.github.io/tslint/)
|
|
@@ -395,7 +395,3 @@ class Foo {
|
|
|
395
395
|
## When Not To Use It
|
|
396
396
|
|
|
397
397
|
If you don't care about the using parameter properties in constructors, then you will not need this rule.
|
|
398
|
-
|
|
399
|
-
## Related To
|
|
400
|
-
|
|
401
|
-
- TSLint: [no-parameter-properties](https://palantir.github.io/tslint/rules/no-parameter-properties/)
|
|
@@ -6,28 +6,26 @@ This rule prohibits assigning variables to `this`.
|
|
|
6
6
|
|
|
7
7
|
## Rule Details
|
|
8
8
|
|
|
9
|
-
|
|
9
|
+
Assigning a variable to `this` instead of properly using arrow lambdas may be a symptom of pre-ES6 practices
|
|
10
|
+
or not managing scope well.
|
|
10
11
|
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
>
|
|
16
|
-
> ```js
|
|
17
|
-
> const self = this;
|
|
18
|
-
>
|
|
19
|
-
> setTimeout(function () {
|
|
20
|
-
> self.doWork();
|
|
21
|
-
> });
|
|
22
|
-
> ```
|
|
23
|
-
>
|
|
24
|
-
> Use `() =>` arrow lambdas, as they preserve `this` scope for you:
|
|
12
|
+
Instead of storing a reference to `this` and using it inside a `function () {`:
|
|
13
|
+
|
|
14
|
+
```js
|
|
15
|
+
const self = this;
|
|
25
16
|
>
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
17
|
+
setTimeout(function () {
|
|
18
|
+
self.doWork();
|
|
19
|
+
});
|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
Use `() =>` arrow lambdas, as they preserve `this` scope for you:
|
|
23
|
+
|
|
24
|
+
```js
|
|
25
|
+
setTimeout(() => {
|
|
26
|
+
this.doWork();
|
|
27
|
+
});
|
|
28
|
+
```
|
|
31
29
|
|
|
32
30
|
Examples of **incorrect** code for this rule:
|
|
33
31
|
|
|
@@ -56,7 +54,3 @@ You can pass an object option:
|
|
|
56
54
|
## When Not To Use It
|
|
57
55
|
|
|
58
56
|
If you need to assign `this` to variables, you shouldn’t use this rule.
|
|
59
|
-
|
|
60
|
-
## Related To
|
|
61
|
-
|
|
62
|
-
- TSLint: [`no-this-assignment`](https://palantir.github.io/tslint/rules/no-this-assignment/)
|
|
@@ -608,7 +608,3 @@ callback, etc. that would cause the code to be unreadable or impractical.
|
|
|
608
608
|
## Further Reading
|
|
609
609
|
|
|
610
610
|
- [Advanced Types](https://www.typescriptlang.org/docs/handbook/advanced-types.html)
|
|
611
|
-
|
|
612
|
-
## Related To
|
|
613
|
-
|
|
614
|
-
- TSLint: [interface-over-type-literal](https://palantir.github.io/tslint/rules/interface-over-type-literal/)
|
|
@@ -146,7 +146,3 @@ if (!(someNullCondition ?? true)) {
|
|
|
146
146
|
| `nullableBooleanVar !== true` | `!nullableBooleanVar` | Only checked/fixed if the `allowComparingNullableBooleansToTrue` option is `false` |
|
|
147
147
|
| `nullableBooleanVar === false` | `nullableBooleanVar ?? true` | Only checked/fixed if the `allowComparingNullableBooleansToFalse` option is `false` |
|
|
148
148
|
| `nullableBooleanVar !== false` | `!(nullableBooleanVar ?? true)` | Only checked/fixed if the `allowComparingNullableBooleansToFalse` option is `false` |
|
|
149
|
-
|
|
150
|
-
## Related To
|
|
151
|
-
|
|
152
|
-
- TSLint: [no-boolean-literal-compare](https://palantir.github.io/tslint/rules/no-boolean-literal-compare)
|
package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/no-unnecessary-qualifier.md
CHANGED
|
@@ -92,7 +92,3 @@ This rule is not configurable.
|
|
|
92
92
|
## When Not To Use It
|
|
93
93
|
|
|
94
94
|
If you don't care about having unneeded namespace or enum qualifiers, then you don't need to use this rule.
|
|
95
|
-
|
|
96
|
-
## Related To
|
|
97
|
-
|
|
98
|
-
- TSLint: [no-unnecessary-qualifier](https://palantir.github.io/tslint/rules/no-unnecessary-qualifier/)
|
package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/no-unnecessary-type-assertion.md
CHANGED
|
@@ -73,7 +73,3 @@ const foo: Foo = 3;
|
|
|
73
73
|
## When Not To Use It
|
|
74
74
|
|
|
75
75
|
If you don't care about having no-op type assertions in your code, then you can turn off this rule.
|
|
76
|
-
|
|
77
|
-
## Related To
|
|
78
|
-
|
|
79
|
-
- TSLint: [`no-unnecessary-type-assertion`](https://palantir.github.io/tslint/rules/no-unnecessary-type-assertion/)
|
|
@@ -482,7 +482,3 @@ class Foo {
|
|
|
482
482
|
## When Not To Use It
|
|
483
483
|
|
|
484
484
|
If you don't care about the using parameter properties in constructors, then you will not need this rule.
|
|
485
|
-
|
|
486
|
-
## Related To
|
|
487
|
-
|
|
488
|
-
- TSLint: [no-parameter-properties](https://palantir.github.io/tslint/rules/no-parameter-properties/)
|
|
@@ -54,7 +54,3 @@ This rule is not configurable.
|
|
|
54
54
|
## When Not To Use It
|
|
55
55
|
|
|
56
56
|
If you transpile for browsers that do not support for-of loops, you may wish to use traditional for loops that produce more compact code.
|
|
57
|
-
|
|
58
|
-
## Related To
|
|
59
|
-
|
|
60
|
-
- TSLint: ['prefer-for-of'](https://palantir.github.io/tslint/rules/prefer-for-of/)
|
|
@@ -94,7 +94,3 @@ This rule is not configurable.
|
|
|
94
94
|
## When Not To Use It
|
|
95
95
|
|
|
96
96
|
If you specifically want to use an interface or type literal with a single call signature for stylistic reasons, you can disable this rule.
|
|
97
|
-
|
|
98
|
-
## Further Reading
|
|
99
|
-
|
|
100
|
-
- TSLint: [`callable-types`](https://palantir.github.io/tslint/rules/callable-types/)
|
package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/prefer-namespace-keyword.md
CHANGED
|
@@ -31,7 +31,3 @@ This rule is not configurable.
|
|
|
31
31
|
- [Modules](https://www.typescriptlang.org/docs/handbook/modules.html)
|
|
32
32
|
- [Namespaces](https://www.typescriptlang.org/docs/handbook/namespaces.html)
|
|
33
33
|
- [Namespaces and Modules](https://www.typescriptlang.org/docs/handbook/namespaces-and-modules.html)
|
|
34
|
-
|
|
35
|
-
## Related To
|
|
36
|
-
|
|
37
|
-
- TSLint: [no-internal-module](https://palantir.github.io/tslint/rules/no-internal-module/)
|
|
@@ -61,8 +61,8 @@ foo && foo.a && foo.a.b && foo.a.b.c;
|
|
|
61
61
|
foo && foo['a'] && foo['a'].b && foo['a'].b.c;
|
|
62
62
|
foo && foo.a && foo.a.b && foo.a.b.method && foo.a.b.method();
|
|
63
63
|
|
|
64
|
-
(((foo || {}).a || {}).b {}).c;
|
|
65
|
-
(((foo || {})['a'] || {}).b {}).c;
|
|
64
|
+
(((foo || {}).a || {}).b || {}).c;
|
|
65
|
+
(((foo || {})['a'] || {}).b || {}).c;
|
|
66
66
|
|
|
67
67
|
// this rule also supports converting chained strict nullish checks:
|
|
68
68
|
foo &&
|
package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/strict-boolean-expressions.md
CHANGED
|
@@ -195,5 +195,4 @@ This rule provides following fixes and suggestions for particular types in boole
|
|
|
195
195
|
|
|
196
196
|
## Related To
|
|
197
197
|
|
|
198
|
-
- TSLint: [strict-boolean-expressions](https://palantir.github.io/tslint/rules/strict-boolean-expressions)
|
|
199
198
|
- [no-unnecessary-condition](./no-unnecessary-condition.md) - Similar rule which reports always-truthy and always-falsy values in conditions
|
|
@@ -67,8 +67,3 @@ If you want to ban use of one or all of the triple slash reference directives, o
|
|
|
67
67
|
## When Not To Use It
|
|
68
68
|
|
|
69
69
|
If you want to use all flavors of triple slash reference directives.
|
|
70
|
-
|
|
71
|
-
## Related To
|
|
72
|
-
|
|
73
|
-
- TSLint: [no-reference](http://palantir.github.io/tslint/rules/no-reference/)
|
|
74
|
-
- TSLint: [no-reference-import](https://palantir.github.io/tslint/rules/no-reference-import/)
|
|
@@ -307,7 +307,3 @@ If you don't want to enforce spacing for your type annotations, you can safely t
|
|
|
307
307
|
|
|
308
308
|
- [TypeScript Type System](https://basarat.gitbooks.io/typescript/docs/types/type-system.html)
|
|
309
309
|
- [Type Inference](https://www.typescriptlang.org/docs/handbook/type-inference.html)
|
|
310
|
-
|
|
311
|
-
## Related To
|
|
312
|
-
|
|
313
|
-
- TSLint: [`typedef-whitespace`](https://palantir.github.io/tslint/rules/typedef-whitespace/)
|
|
@@ -28,7 +28,7 @@ TypeScript is often better at inferring types than easily written type annotatio
|
|
|
28
28
|
This rule can enforce type annotations in locations regardless of whether they're required.
|
|
29
29
|
This is typically used to maintain consistency for element types that sometimes require them.
|
|
30
30
|
|
|
31
|
-
> To enforce type definitions existing on call signatures
|
|
31
|
+
> To enforce type definitions existing on call signatures, use `explicit-function-return-type`, or `explicit-module-boundary-types`.
|
|
32
32
|
|
|
33
33
|
## Options
|
|
34
34
|
|
|
@@ -336,7 +336,3 @@ In general, if you do not consider the cost of writing unnecessary type annotati
|
|
|
336
336
|
|
|
337
337
|
- [TypeScript Type System](https://basarat.gitbooks.io/typescript/docs/types/type-system.html)
|
|
338
338
|
- [Type Inference](https://www.typescriptlang.org/docs/handbook/type-inference.html)
|
|
339
|
-
|
|
340
|
-
## Related To
|
|
341
|
-
|
|
342
|
-
- TSLint: [`typedef`](https://palantir.github.io/tslint/rules/typedef)
|
|
@@ -114,7 +114,3 @@ log();
|
|
|
114
114
|
If your code intentionally waits to bind methods after use, such as by passing a `scope: this` along with the method, you can disable this rule.
|
|
115
115
|
|
|
116
116
|
If you're wanting to use `toBeCalled` and similar matches in `jest` tests, you can disable this rule for your test files in favor of [`eslint-plugin-jest`'s version of this rule](https://github.com/jest-community/eslint-plugin-jest/blob/main/docs/rules/unbound-method.md).
|
|
117
|
-
|
|
118
|
-
## Related To
|
|
119
|
-
|
|
120
|
-
- TSLint: [no-unbound-method](https://palantir.github.io/tslint/rules/no-unbound-method/)
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@typescript-eslint/eslint-plugin",
|
|
3
|
-
"version": "5.
|
|
3
|
+
"version": "5.30.7",
|
|
4
4
|
"description": "TypeScript plugin for ESLint",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"eslint",
|
|
@@ -44,9 +44,9 @@
|
|
|
44
44
|
"typecheck": "tsc -p tsconfig.json --noEmit"
|
|
45
45
|
},
|
|
46
46
|
"dependencies": {
|
|
47
|
-
"@typescript-eslint/scope-manager": "5.
|
|
48
|
-
"@typescript-eslint/type-utils": "5.
|
|
49
|
-
"@typescript-eslint/utils": "5.
|
|
47
|
+
"@typescript-eslint/scope-manager": "5.30.7",
|
|
48
|
+
"@typescript-eslint/type-utils": "5.30.7",
|
|
49
|
+
"@typescript-eslint/utils": "5.30.7",
|
|
50
50
|
"debug": "^4.3.4",
|
|
51
51
|
"functional-red-black-tree": "^1.0.1",
|
|
52
52
|
"ignore": "^5.2.0",
|
|
@@ -79,5 +79,5 @@
|
|
|
79
79
|
"type": "opencollective",
|
|
80
80
|
"url": "https://opencollective.com/typescript-eslint"
|
|
81
81
|
},
|
|
82
|
-
"gitHead": "
|
|
82
|
+
"gitHead": "557ce041be53443a35a933549fe38660a9a770c5"
|
|
83
83
|
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { ParserOptions, TSESTree } from '@typescript-eslint/types';
|
|
2
|
+
import { ParserServices, visitorKeys } from '@typescript-eslint/typescript-estree';
|
|
3
|
+
import { ScopeManager } from '@typescript-eslint/scope-manager';
|
|
4
|
+
interface ParseForESLintResult {
|
|
5
|
+
ast: TSESTree.Program & {
|
|
6
|
+
range?: [
|
|
7
|
+
number,
|
|
8
|
+
number
|
|
9
|
+
];
|
|
10
|
+
tokens?: TSESTree.Token[];
|
|
11
|
+
comments?: TSESTree.Comment[];
|
|
12
|
+
};
|
|
13
|
+
services: ParserServices;
|
|
14
|
+
visitorKeys: typeof visitorKeys;
|
|
15
|
+
scopeManager: ScopeManager;
|
|
16
|
+
}
|
|
17
|
+
declare function parse(code: string, options?: ParserOptions): ParseForESLintResult['ast'];
|
|
18
|
+
declare function parseForESLint(code: string, options?: ParserOptions | null): ParseForESLintResult;
|
|
19
|
+
export { parse, parseForESLint, ParserOptions };
|
|
20
|
+
//# sourceMappingURL=parser.d.ts.map
|