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.
Files changed (142) hide show
  1. package/cli.js +1 -1
  2. package/index.js +7 -2
  3. package/lib/report.js +3 -1
  4. package/node_modules/@typescript-eslint/eslint-plugin/README.md +1 -145
  5. package/node_modules/@typescript-eslint/eslint-plugin/dist/configs/all.js +1 -0
  6. package/node_modules/@typescript-eslint/eslint-plugin/dist/configs/all.js.map +1 -1
  7. package/node_modules/@typescript-eslint/eslint-plugin/dist/configs/strict.js +1 -0
  8. package/node_modules/@typescript-eslint/eslint-plugin/dist/configs/strict.js.map +1 -1
  9. package/node_modules/@typescript-eslint/eslint-plugin/dist/rules/consistent-generic-constructors.js +87 -0
  10. package/node_modules/@typescript-eslint/eslint-plugin/dist/rules/consistent-generic-constructors.js.map +1 -0
  11. package/node_modules/@typescript-eslint/eslint-plugin/dist/rules/consistent-indexed-object-style.js +1 -1
  12. package/node_modules/@typescript-eslint/eslint-plugin/dist/rules/consistent-indexed-object-style.js.map +1 -1
  13. package/node_modules/@typescript-eslint/eslint-plugin/dist/rules/index.js +2 -0
  14. package/node_modules/@typescript-eslint/eslint-plugin/dist/rules/index.js.map +1 -1
  15. package/node_modules/@typescript-eslint/eslint-plugin/dist/rules/no-base-to-string.js +1 -1
  16. package/node_modules/@typescript-eslint/eslint-plugin/dist/rules/no-base-to-string.js.map +1 -1
  17. package/node_modules/@typescript-eslint/eslint-plugin/dist/rules/no-inferrable-types.js +9 -1
  18. package/node_modules/@typescript-eslint/eslint-plugin/dist/rules/no-inferrable-types.js.map +1 -1
  19. package/node_modules/@typescript-eslint/eslint-plugin/dist/rules/no-shadow.js +38 -8
  20. package/node_modules/@typescript-eslint/eslint-plugin/dist/rules/no-shadow.js.map +1 -1
  21. package/node_modules/@typescript-eslint/eslint-plugin/dist/rules/no-unused-vars.js +4 -3
  22. package/node_modules/@typescript-eslint/eslint-plugin/dist/rules/no-unused-vars.js.map +1 -1
  23. package/node_modules/@typescript-eslint/eslint-plugin/dist/rules/space-infix-ops.js +16 -30
  24. package/node_modules/@typescript-eslint/eslint-plugin/dist/rules/space-infix-ops.js.map +1 -1
  25. package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/README.md +3 -138
  26. package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/adjacent-overload-signatures.md +0 -4
  27. package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/array-type.md +0 -4
  28. package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/await-thenable.md +0 -4
  29. package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/ban-ts-comment.md +31 -8
  30. package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/ban-types.md +0 -4
  31. package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/comma-dangle.md +1 -1
  32. package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/consistent-generic-constructors.md +82 -0
  33. package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/consistent-type-assertions.md +0 -5
  34. package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/consistent-type-definitions.md +0 -4
  35. package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/explicit-member-accessibility.md +0 -4
  36. package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/explicit-module-boundary-types.md +3 -4
  37. package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/member-ordering.md +0 -4
  38. package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/no-confusing-void-expression.md +0 -4
  39. package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/no-dynamic-delete.md +0 -4
  40. package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/no-empty-interface.md +0 -4
  41. package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/no-explicit-any.md +0 -4
  42. package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/no-extraneous-class.md +0 -4
  43. package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/no-floating-promises.md +0 -1
  44. package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/no-for-in-array.md +0 -6
  45. package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/no-inferrable-types.md +0 -4
  46. package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/no-invalid-void-type.md +0 -4
  47. package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/no-misused-new.md +0 -4
  48. package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/no-namespace.md +0 -4
  49. package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/no-non-null-assertion.md +0 -4
  50. package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/no-parameter-properties.md +0 -4
  51. package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/no-require-imports.md +0 -4
  52. package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/no-this-alias.md +18 -24
  53. package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/no-type-alias.md +0 -4
  54. package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/no-unnecessary-boolean-literal-compare.md +0 -4
  55. package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/no-unnecessary-qualifier.md +0 -4
  56. package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/no-unnecessary-type-arguments.md +0 -4
  57. package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/no-unnecessary-type-assertion.md +0 -4
  58. package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/no-unsafe-argument.md +0 -1
  59. package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/no-unsafe-assignment.md +0 -1
  60. package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/no-unsafe-call.md +0 -1
  61. package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/no-unsafe-member-access.md +0 -1
  62. package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/no-unsafe-return.md +0 -1
  63. package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/no-var-requires.md +0 -4
  64. package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/parameter-properties.md +0 -4
  65. package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/prefer-for-of.md +0 -4
  66. package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/prefer-function-type.md +0 -4
  67. package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/prefer-namespace-keyword.md +0 -4
  68. package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/prefer-optional-chain.md +2 -2
  69. package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/prefer-readonly.md +0 -4
  70. package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/promise-function-async.md +0 -4
  71. package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/restrict-plus-operands.md +0 -4
  72. package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/strict-boolean-expressions.md +0 -1
  73. package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/triple-slash-reference.md +0 -5
  74. package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/type-annotation-spacing.md +0 -4
  75. package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/typedef.md +1 -5
  76. package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/unbound-method.md +0 -4
  77. package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/unified-signatures.md +0 -4
  78. package/node_modules/@typescript-eslint/eslint-plugin/package.json +5 -5
  79. package/node_modules/@typescript-eslint/parser/_ts3.4/dist/index.d.ts +4 -0
  80. package/node_modules/@typescript-eslint/parser/_ts3.4/dist/parser.d.ts +20 -0
  81. package/node_modules/@typescript-eslint/parser/package.json +6 -5
  82. package/node_modules/@typescript-eslint/scope-manager/dist/referencer/ClassVisitor.d.ts.map +1 -1
  83. package/node_modules/@typescript-eslint/scope-manager/dist/referencer/ClassVisitor.js +6 -4
  84. package/node_modules/@typescript-eslint/scope-manager/dist/referencer/ClassVisitor.js.map +1 -1
  85. package/node_modules/@typescript-eslint/scope-manager/dist/referencer/TypeVisitor.d.ts.map +1 -1
  86. package/node_modules/@typescript-eslint/scope-manager/dist/referencer/TypeVisitor.js +13 -7
  87. package/node_modules/@typescript-eslint/scope-manager/dist/referencer/TypeVisitor.js.map +1 -1
  88. package/node_modules/@typescript-eslint/scope-manager/package.json +5 -5
  89. package/node_modules/@typescript-eslint/type-utils/package.json +4 -4
  90. package/node_modules/@typescript-eslint/types/_ts3.4/dist/generated/ast-spec.d.ts +1732 -0
  91. package/node_modules/@typescript-eslint/types/_ts3.4/dist/index.d.ts +5 -0
  92. package/node_modules/@typescript-eslint/types/_ts3.4/dist/lib.d.ts +3 -0
  93. package/node_modules/@typescript-eslint/types/_ts3.4/dist/parser-options.d.ts +35 -0
  94. package/node_modules/@typescript-eslint/types/_ts3.4/dist/ts-estree.d.ts +9 -0
  95. package/node_modules/@typescript-eslint/types/dist/generated/ast-spec.d.ts +21 -19
  96. package/node_modules/@typescript-eslint/types/dist/generated/ast-spec.d.ts.map +1 -1
  97. package/node_modules/@typescript-eslint/types/dist/generated/ast-spec.js.map +1 -1
  98. package/node_modules/@typescript-eslint/types/package.json +3 -2
  99. package/node_modules/@typescript-eslint/typescript-estree/_ts3.4/dist/ast-converter.d.ts +9 -0
  100. package/node_modules/@typescript-eslint/typescript-estree/_ts3.4/dist/convert-comments.d.ts +11 -0
  101. package/node_modules/@typescript-eslint/typescript-estree/_ts3.4/dist/convert.d.ts +157 -0
  102. package/node_modules/@typescript-eslint/typescript-estree/_ts3.4/dist/create-program/WatchCompilerHostOfConfigFile.d.ts +13 -0
  103. package/node_modules/@typescript-eslint/typescript-estree/_ts3.4/dist/create-program/createDefaultProgram.d.ts +12 -0
  104. package/node_modules/@typescript-eslint/typescript-estree/_ts3.4/dist/create-program/createIsolatedProgram.d.ts +9 -0
  105. package/node_modules/@typescript-eslint/typescript-estree/_ts3.4/dist/create-program/createProjectProgram.d.ts +11 -0
  106. package/node_modules/@typescript-eslint/typescript-estree/_ts3.4/dist/create-program/createSourceFile.d.ts +5 -0
  107. package/node_modules/@typescript-eslint/typescript-estree/_ts3.4/dist/create-program/createWatchProgram.d.ts +19 -0
  108. package/node_modules/@typescript-eslint/typescript-estree/_ts3.4/dist/create-program/getScriptKind.d.ts +5 -0
  109. package/node_modules/@typescript-eslint/typescript-estree/_ts3.4/dist/create-program/shared.d.ts +22 -0
  110. package/node_modules/@typescript-eslint/typescript-estree/_ts3.4/dist/create-program/useProvidedPrograms.d.ts +13 -0
  111. package/node_modules/@typescript-eslint/typescript-estree/_ts3.4/dist/index.d.ts +10 -0
  112. package/node_modules/@typescript-eslint/typescript-estree/_ts3.4/dist/jsx/xhtml-entities.d.ts +2 -0
  113. package/node_modules/@typescript-eslint/typescript-estree/_ts3.4/dist/node-utils.d.ts +230 -0
  114. package/node_modules/@typescript-eslint/typescript-estree/_ts3.4/dist/parser-options.d.ts +188 -0
  115. package/node_modules/@typescript-eslint/typescript-estree/_ts3.4/dist/parser.d.ts +25 -0
  116. package/node_modules/@typescript-eslint/typescript-estree/_ts3.4/dist/semantic-or-syntactic-errors.d.ts +13 -0
  117. package/node_modules/@typescript-eslint/typescript-estree/_ts3.4/dist/simple-traverse.d.ts +9 -0
  118. package/node_modules/@typescript-eslint/typescript-estree/_ts3.4/dist/ts-estree/estree-to-ts-node-types.d.ts +175 -0
  119. package/node_modules/@typescript-eslint/typescript-estree/_ts3.4/dist/ts-estree/index.d.ts +4 -0
  120. package/node_modules/@typescript-eslint/typescript-estree/_ts3.4/dist/ts-estree/ts-nodes.d.ts +18 -0
  121. package/node_modules/@typescript-eslint/typescript-estree/_ts3.4/dist/version-check.d.ts +3 -0
  122. package/node_modules/@typescript-eslint/typescript-estree/dist/convert.d.ts.map +1 -1
  123. package/node_modules/@typescript-eslint/typescript-estree/dist/convert.js +7 -0
  124. package/node_modules/@typescript-eslint/typescript-estree/dist/convert.js.map +1 -1
  125. package/node_modules/@typescript-eslint/typescript-estree/dist/node-utils.d.ts +3 -0
  126. package/node_modules/@typescript-eslint/typescript-estree/dist/node-utils.d.ts.map +1 -1
  127. package/node_modules/@typescript-eslint/typescript-estree/dist/node-utils.js +21 -1
  128. package/node_modules/@typescript-eslint/typescript-estree/dist/node-utils.js.map +1 -1
  129. package/node_modules/@typescript-eslint/typescript-estree/dist/ts-estree/estree-to-ts-node-types.d.ts +1 -1
  130. package/node_modules/@typescript-eslint/typescript-estree/dist/ts-estree/estree-to-ts-node-types.d.ts.map +1 -1
  131. package/node_modules/@typescript-eslint/typescript-estree/package.json +6 -5
  132. package/node_modules/@typescript-eslint/utils/_ts3.4/dist/ts-eslint/SourceCode.d.ts +1 -1
  133. package/node_modules/@typescript-eslint/utils/dist/ts-eslint/SourceCode.d.ts +1 -1
  134. package/node_modules/@typescript-eslint/utils/dist/ts-eslint/SourceCode.d.ts.map +1 -1
  135. package/node_modules/@typescript-eslint/utils/package.json +5 -5
  136. package/node_modules/@typescript-eslint/visitor-keys/_ts3.4/dist/get-keys.d.ts +4 -0
  137. package/node_modules/@typescript-eslint/visitor-keys/_ts3.4/dist/index.d.ts +3 -0
  138. package/node_modules/@typescript-eslint/visitor-keys/_ts3.4/dist/visitor-keys.d.ts +6 -0
  139. package/node_modules/@typescript-eslint/visitor-keys/dist/visitor-keys.js +1 -1
  140. package/node_modules/@typescript-eslint/visitor-keys/dist/visitor-keys.js.map +1 -1
  141. package/node_modules/@typescript-eslint/visitor-keys/package.json +4 -3
  142. package/package.json +1 -1
@@ -9,7 +9,7 @@ It adds support for TypeScript syntax.
9
9
 
10
10
  See the [ESLint documentation](https://eslint.org/docs/rules/comma-dangle) for more details on the `comma-dangle` rule.
11
11
 
12
- ## Rule Changes
12
+ ## How to Use
13
13
 
14
14
  ```jsonc
15
15
  {
@@ -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.
@@ -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/)
@@ -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/)
@@ -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/)
@@ -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
- bar: true,
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/)
@@ -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
@@ -118,4 +118,3 @@ If you do not use Promise-like values in your codebase, or want to allow them to
118
118
  ## Related To
119
119
 
120
120
  - [`no-misused-promises`](./no-misused-promises.md)
121
- - TSLint: ['no-floating-promises'](https://palantir.github.io/tslint/rules/no-floating-promises/)
@@ -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/)
@@ -126,7 +126,3 @@ class Example {
126
126
 
127
127
  If you don't care about if `void` is used with other types,
128
128
  or in invalid places, then you don't need this rule.
129
-
130
- ## Related To
131
-
132
- - TSLint: [invalid-void](https://palantir.github.io/tslint/rules/invalid-void/)
@@ -46,7 +46,3 @@ interface I {
46
46
  ```
47
47
 
48
48
  This rule is not configurable.
49
-
50
- ## Related To
51
-
52
- - TSLint: [no-misused-new](https://palantir.github.io/tslint/rules/no-misused-new/)
@@ -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/)
@@ -47,7 +47,3 @@ This rule is not configurable.
47
47
  ## When Not To Use It
48
48
 
49
49
  If you don't care about TypeScript module syntax, then you will not need this rule.
50
-
51
- ## Related To
52
-
53
- - TSLint: [no-require-imports](https://palantir.github.io/tslint/rules/no-require-imports/)
@@ -6,28 +6,26 @@ This rule prohibits assigning variables to `this`.
6
6
 
7
7
  ## Rule Details
8
8
 
9
- Rationale from TSLint:
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
- > Assigning a variable to `this` instead of properly using arrow lambdas may be a symptom of pre-ES6 practices
12
- > or not managing scope well.
13
- >
14
- > Instead of storing a reference to `this` and using it inside a `function () {`:
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
- > ```js
27
- > setTimeout(() => {
28
- > this.doWork();
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)
@@ -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/)
@@ -66,7 +66,3 @@ class Impl implements I<string> {}
66
66
  ```
67
67
 
68
68
  This rule is not configurable.
69
-
70
- ## Related To
71
-
72
- - TSLint: [use-default-type-parameter](https://palantir.github.io/tslint/rules/use-default-type-parameter)
@@ -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/)
@@ -87,4 +87,3 @@ This rule is not configurable.
87
87
  ## Related To
88
88
 
89
89
  - [`no-explicit-any`](./no-explicit-any.md)
90
- - TSLint: [`no-unsafe-any`](https://palantir.github.io/tslint/rules/no-unsafe-any/)
@@ -90,4 +90,3 @@ This rule is not configurable.
90
90
  ## Related To
91
91
 
92
92
  - [`no-explicit-any`](./no-explicit-any.md)
93
- - TSLint: [`no-unsafe-any`](https://palantir.github.io/tslint/rules/no-unsafe-any/)
@@ -64,4 +64,3 @@ This rule is not configurable.
64
64
  ## Related To
65
65
 
66
66
  - [`no-explicit-any`](./no-explicit-any.md)
67
- - TSLint: [`no-unsafe-any`](https://palantir.github.io/tslint/rules/no-unsafe-any/)
@@ -70,4 +70,3 @@ This rule is not configurable.
70
70
  ## Related To
71
71
 
72
72
  - [`no-explicit-any`](./no-explicit-any.md)
73
- - TSLint: [`no-unsafe-any`](https://palantir.github.io/tslint/rules/no-unsafe-any/)
@@ -107,4 +107,3 @@ This rule is not configurable.
107
107
  ## Related To
108
108
 
109
109
  - [`no-explicit-any`](./no-explicit-any.md)
110
- - TSLint: [`no-unsafe-any`](https://palantir.github.io/tslint/rules/no-unsafe-any/)
@@ -42,7 +42,3 @@ This rule is not configurable.
42
42
  ## When Not To Use It
43
43
 
44
44
  If you don't care about TypeScript module syntax, then you will not need this rule.
45
-
46
- ## Related To
47
-
48
- - TSLint: [no-var-requires](https://palantir.github.io/tslint/rules/no-var-requires/)
@@ -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/)
@@ -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 &&
@@ -85,7 +85,3 @@ class Container {
85
85
  private neverModifiedPrivate = 'unchanged';
86
86
  }
87
87
  ```
88
-
89
- ## Related To
90
-
91
- - TSLint: ['prefer-readonly'](https://palantir.github.io/tslint/rules/prefer-readonly)
@@ -65,7 +65,3 @@ In addition, each of the following properties may be provided, and default to `t
65
65
  ]
66
66
  }
67
67
  ```
68
-
69
- ## Related To
70
-
71
- - TSLint: [promise-function-async](https://palantir.github.io/tslint/rules/promise-function-async)
@@ -100,7 +100,3 @@ var fn = (a: any, b: number) => a + b;
100
100
  "@typescript-eslint/restrict-plus-operands": "error"
101
101
  }
102
102
  ```
103
-
104
- ## Related To
105
-
106
- - TSLint: [restrict-plus-operands](https://palantir.github.io/tslint/rules/restrict-plus-operands/)
@@ -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 as per TSLint's `arrow-call-signature` and `call-signature` options, use `explicit-function-return-type`, or `explicit-module-boundary-types`.
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/)
@@ -75,7 +75,3 @@ function f(b: string): void;
75
75
  function f(...a: number[]): void;
76
76
  function f(...a: string[]): void;
77
77
  ```
78
-
79
- ## Related To
80
-
81
- - TSLint: [`unified-signatures`](https://palantir.github.io/tslint/rules/unified-signatures/)
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@typescript-eslint/eslint-plugin",
3
- "version": "5.27.1",
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.27.1",
48
- "@typescript-eslint/type-utils": "5.27.1",
49
- "@typescript-eslint/utils": "5.27.1",
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": "4e79ad260b60085ccb9761aba887cc159701c7d4"
82
+ "gitHead": "557ce041be53443a35a933549fe38660a9a770c5"
83
83
  }
@@ -0,0 +1,4 @@
1
+ export { parse, parseForESLint, ParserOptions } from './parser';
2
+ export { ParserServices, clearCaches, createProgram, } from '@typescript-eslint/typescript-estree';
3
+ export declare const version: string;
4
+ //# sourceMappingURL=index.d.ts.map
@@ -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