@typescript-eslint/eslint-plugin 8.3.1-alpha.6 → 8.3.1-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.
@@ -166,14 +166,9 @@ await (async function () {
166
166
 
167
167
  ### `allowForKnownSafePromises`
168
168
 
169
- This option allows marking specific types as "safe" to be floating. For example, you may need to do this in the case of libraries whose APIs return Promises whose rejections are safely handled by the library.
169
+ Specific types to be marked as "safe" to be floating. For example, you may need to do this in the case of libraries whose APIs return Promises whose rejections are safely handled by the library.
170
170
 
171
- This option takes an array of type specifiers to consider safe.
172
- Each item in the array must have one of the following forms:
173
-
174
- - A type defined in a file (`{ from: "file", name: "Foo", path: "src/foo-file.ts" }` with `path` being an optional path relative to the project root directory)
175
- - A type from the default library (`{ from: "lib", name: "PromiseLike" }`)
176
- - A type from a package (`{ from: "package", name: "Foo", package: "foo-lib" }`, this also works for types defined in a typings package).
171
+ This option takes the shared [`TypeOrValueSpecifier` format](/packages/type-utils/type-or-value-specifier).
177
172
 
178
173
  Examples of code for this rule with:
179
174
 
@@ -223,10 +218,10 @@ returnsSafePromise();
223
218
 
224
219
  ### `allowForKnownSafeCalls`
225
220
 
226
- This option allows marking specific functions as "safe" to be called to create floating Promises.
221
+ Specific functions to be marked as "safe" to be called to create floating Promises.
227
222
  For example, you may need to do this in the case of libraries whose APIs may be called without handling the resultant Promises.
228
223
 
229
- This option takes the same array format as [`allowForKnownSafePromises`](#allowForKnownSafePromises).
224
+ This option takes the shared [`TypeOrValueSpecifier` format](/packages/type-utils/type-or-value-specifier).
230
225
 
231
226
  Examples of code for this rule with:
232
227
 
@@ -143,20 +143,13 @@ interface Foo {
143
143
  An array of type specifiers to ignore.
144
144
  Some complex types cannot easily be made readonly, for example the `HTMLElement` type or the `JQueryStatic` type from `@types/jquery`. This option allows you to globally disable reporting of such types.
145
145
 
146
- Each item in the array must have one of the following forms:
147
-
148
- - A type defined in a file (`{ from: "file", name: "Foo", path: "src/foo-file.ts" }` with `path` being an optional path relative to the project root directory)
149
- - A type from the default library (`{ from: "lib", name: "Foo" }`)
150
- - A type from a package (`{ from: "package", name: "Foo", package: "foo-lib" }`, this also works for types defined in a typings package).
151
-
152
- Additionally, a type may be defined just as a simple string, which then matches the type independently of its origin.
146
+ This option takes the shared [`TypeOrValueSpecifier` format](/packages/type-utils/type-or-value-specifier).
153
147
 
154
148
  Examples of code for this rule with:
155
149
 
156
150
  ```json
157
151
  {
158
152
  "allow": [
159
- "$",
160
153
  { "from": "file", "name": "Foo" },
161
154
  { "from": "lib", "name": "HTMLElement" },
162
155
  { "from": "package", "name": "Bar", "package": "bar-lib" }
@@ -167,7 +160,7 @@ Examples of code for this rule with:
167
160
  <Tabs>
168
161
  <TabItem value="❌ Incorrect">
169
162
 
170
- ```ts option='{"allow":["$",{"from":"file","name":"Foo"},{"from":"lib","name":"HTMLElement"},{"from":"package","name":"Bar","package":"bar-lib"}]}'
163
+ ```ts option='{"allow":[{"from":"file","name":"Foo"},{"from":"lib","name":"HTMLElement"},{"from":"package","name":"Bar","package":"bar-lib"}]}'
171
164
  interface ThisIsMutable {
172
165
  prop: string;
173
166
  }
@@ -191,7 +184,7 @@ function fn2(arg: Wrapper) {}
191
184
  function fn3(arg: WrapperWithOther) {}
192
185
  ```
193
186
 
194
- ```ts option='{"allow":["$",{"from":"file","name":"Foo"},{"from":"lib","name":"HTMLElement"},{"from":"package","name":"Bar","package":"bar-lib"}]}'
187
+ ```ts option='{"allow":[{"from":"file","name":"Foo"},{"from":"lib","name":"HTMLElement"},{"from":"package","name":"Bar","package":"bar-lib"}]}'
195
188
  import { Foo } from 'some-lib';
196
189
  import { Bar } from 'incorrect-lib';
197
190
 
@@ -212,7 +205,7 @@ function fn3(arg: Bar) {}
212
205
  </TabItem>
213
206
  <TabItem value="✅ Correct">
214
207
 
215
- ```ts option='{"allow":["$",{"from":"file","name":"Foo"},{"from":"lib","name":"HTMLElement"},{"from":"package","name":"Bar","package":"bar-lib"}]}'
208
+ ```ts option='{"allow":[{"from":"file","name":"Foo"},{"from":"lib","name":"HTMLElement"},{"from":"package","name":"Bar","package":"bar-lib"}]}'
216
209
  interface Foo {
217
210
  prop: string;
218
211
  }
@@ -229,7 +222,7 @@ function fn1(arg: Foo) {}
229
222
  function fn2(arg: Wrapper) {}
230
223
  ```
231
224
 
232
- ```ts option='{"allow":["$",{"from":"file","name":"Foo"},{"from":"lib","name":"HTMLElement"},{"from":"package","name":"Bar","package":"bar-lib"}]}'
225
+ ```ts option='{"allow":[{"from":"file","name":"Foo"},{"from":"lib","name":"HTMLElement"},{"from":"package","name":"Bar","package":"bar-lib"}]}'
233
226
  import { Bar } from 'bar-lib';
234
227
 
235
228
  interface Foo {
@@ -246,7 +239,7 @@ function fn2(arg: HTMLElement) {}
246
239
  function fn3(arg: Bar) {}
247
240
  ```
248
241
 
249
- ```ts option='{"allow":["$",{"from":"file","name":"Foo"},{"from":"lib","name":"HTMLElement"},{"from":"package","name":"Bar","package":"bar-lib"}]}'
242
+ ```ts option='{"allow":[{"from":"file","name":"Foo"},{"from":"lib","name":"HTMLElement"},{"from":"package","name":"Bar","package":"bar-lib"}]}'
250
243
  import { Foo } from './foo';
251
244
 
252
245
  // Works because Foo is still a local type - it has to be in the same package
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@typescript-eslint/eslint-plugin",
3
- "version": "8.3.1-alpha.6",
3
+ "version": "8.3.1-alpha.8",
4
4
  "description": "TypeScript plugin for ESLint",
5
5
  "files": [
6
6
  "dist",
@@ -60,10 +60,10 @@
60
60
  },
61
61
  "dependencies": {
62
62
  "@eslint-community/regexpp": "^4.10.0",
63
- "@typescript-eslint/scope-manager": "8.3.1-alpha.6",
64
- "@typescript-eslint/type-utils": "8.3.1-alpha.6",
65
- "@typescript-eslint/utils": "8.3.1-alpha.6",
66
- "@typescript-eslint/visitor-keys": "8.3.1-alpha.6",
63
+ "@typescript-eslint/scope-manager": "8.3.1-alpha.8",
64
+ "@typescript-eslint/type-utils": "8.3.1-alpha.8",
65
+ "@typescript-eslint/utils": "8.3.1-alpha.8",
66
+ "@typescript-eslint/visitor-keys": "8.3.1-alpha.8",
67
67
  "graphemer": "^1.4.0",
68
68
  "ignore": "^5.3.1",
69
69
  "natural-compare": "^1.4.0",
@@ -74,8 +74,8 @@
74
74
  "@types/marked": "^5.0.2",
75
75
  "@types/mdast": "^4.0.3",
76
76
  "@types/natural-compare": "*",
77
- "@typescript-eslint/rule-schema-to-typescript-types": "8.3.1-alpha.6",
78
- "@typescript-eslint/rule-tester": "8.3.1-alpha.6",
77
+ "@typescript-eslint/rule-schema-to-typescript-types": "8.3.1-alpha.8",
78
+ "@typescript-eslint/rule-tester": "8.3.1-alpha.8",
79
79
  "ajv": "^6.12.6",
80
80
  "cross-env": "^7.0.3",
81
81
  "cross-fetch": "*",