eslint-plugin-react-web-api 5.24.0 → 5.24.2
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/index.js +28 -428
- package/package.json +7 -7
package/dist/index.js
CHANGED
|
@@ -27,7 +27,7 @@ var __exportAll = (all, no_symbols) => {
|
|
|
27
27
|
//#endregion
|
|
28
28
|
//#region package.json
|
|
29
29
|
var name$1 = "eslint-plugin-react-web-api";
|
|
30
|
-
var version = "5.24.
|
|
30
|
+
var version = "5.24.2";
|
|
31
31
|
|
|
32
32
|
//#endregion
|
|
33
33
|
//#region src/utils/create-rule.ts
|
|
@@ -38,60 +38,6 @@ const createRule = ESLintUtils.RuleCreator(getDocsUrl);
|
|
|
38
38
|
|
|
39
39
|
//#endregion
|
|
40
40
|
//#region ../../.pkgs/eff/dist/index.js
|
|
41
|
-
function and(a, b) {
|
|
42
|
-
return (data) => a(data) && b(data);
|
|
43
|
-
}
|
|
44
|
-
function or(a, b) {
|
|
45
|
-
return (data) => a(data) || b(data);
|
|
46
|
-
}
|
|
47
|
-
/**
|
|
48
|
-
* A function that checks if the passed parameter is a string and narrows its type accordingly.
|
|
49
|
-
*
|
|
50
|
-
* @param data - The variable to check.
|
|
51
|
-
* @returns True if the passed input is a string, false otherwise.
|
|
52
|
-
* @category guards
|
|
53
|
-
*/
|
|
54
|
-
function isString(data) {
|
|
55
|
-
return typeof data === "string";
|
|
56
|
-
}
|
|
57
|
-
/**
|
|
58
|
-
* Applies a `pipe` method's variadic arguments to an initial value from left
|
|
59
|
-
* to right.
|
|
60
|
-
*
|
|
61
|
-
* **When to use**
|
|
62
|
-
*
|
|
63
|
-
* Use to implement a custom `.pipe(...)` method from JavaScript's `arguments`
|
|
64
|
-
* object.
|
|
65
|
-
*
|
|
66
|
-
* **Details**
|
|
67
|
-
*
|
|
68
|
-
* This helper is intended for implementing `Pipeable.pipe` methods that
|
|
69
|
-
* receive JavaScript's `arguments` object. With no functions it returns the
|
|
70
|
-
* original value; otherwise it feeds each result into the next function.
|
|
71
|
-
*
|
|
72
|
-
* **Example** (Implementing a pipe method)
|
|
73
|
-
*
|
|
74
|
-
* ```ts
|
|
75
|
-
* import { Pipeable } from "effect"
|
|
76
|
-
*
|
|
77
|
-
* class NumberBox {
|
|
78
|
-
* constructor(readonly value: number) {}
|
|
79
|
-
*
|
|
80
|
-
* pipe(..._fns: ReadonlyArray<(value: number) => number>): number {
|
|
81
|
-
* return Pipeable.pipeArguments(this.value, arguments) as number
|
|
82
|
-
* }
|
|
83
|
-
* }
|
|
84
|
-
*
|
|
85
|
-
* const result = new NumberBox(5).pipe(
|
|
86
|
-
* (n) => n + 2,
|
|
87
|
-
* (n) => n * 3
|
|
88
|
-
* )
|
|
89
|
-
* console.log(result) // 21
|
|
90
|
-
* ```
|
|
91
|
-
*
|
|
92
|
-
* @category combinators
|
|
93
|
-
* @since 2.0.0
|
|
94
|
-
*/
|
|
95
41
|
const pipeArguments = (self, args) => {
|
|
96
42
|
switch (args.length) {
|
|
97
43
|
case 0: return self;
|
|
@@ -111,110 +57,14 @@ const pipeArguments = (self, args) => {
|
|
|
111
57
|
}
|
|
112
58
|
}
|
|
113
59
|
};
|
|
114
|
-
/**
|
|
115
|
-
* Reusable prototype that implements `Pipeable.pipe`.
|
|
116
|
-
*
|
|
117
|
-
* **When to use**
|
|
118
|
-
*
|
|
119
|
-
* Use when classes or object prototypes can reuse this value when they need the
|
|
120
|
-
* standard pipe implementation backed by `pipeArguments`.
|
|
121
|
-
*
|
|
122
|
-
* @category prototypes
|
|
123
|
-
* @since 3.15.0
|
|
124
|
-
*/
|
|
125
60
|
const Prototype = { pipe() {
|
|
126
61
|
return pipeArguments(this, arguments);
|
|
127
62
|
} };
|
|
128
|
-
/**
|
|
129
|
-
* Provides a base constructor whose instances implement the standard `Pipeable.pipe`
|
|
130
|
-
* method.
|
|
131
|
-
*
|
|
132
|
-
* **When to use**
|
|
133
|
-
*
|
|
134
|
-
* Use when you need to define a class that supports Effect-style method
|
|
135
|
-
* chaining through `.pipe(...)`.
|
|
136
|
-
*
|
|
137
|
-
* @category constructors
|
|
138
|
-
* @since 3.15.0
|
|
139
|
-
*/
|
|
140
63
|
const Class = (function() {
|
|
141
64
|
function PipeableBase() {}
|
|
142
65
|
PipeableBase.prototype = Prototype;
|
|
143
66
|
return PipeableBase;
|
|
144
67
|
})();
|
|
145
|
-
/**
|
|
146
|
-
* Provides small helpers for defining and reusing TypeScript functions.
|
|
147
|
-
*
|
|
148
|
-
* The main helpers are `pipe` and `flow` for left-to-right composition and
|
|
149
|
-
* `dual` for APIs that support both direct and pipe-friendly call styles. The
|
|
150
|
-
* module also contains small identity, constant, tuple, type-level, and
|
|
151
|
-
* memoization helpers used across the library.
|
|
152
|
-
*
|
|
153
|
-
* @since 2.0.0
|
|
154
|
-
*/
|
|
155
|
-
/**
|
|
156
|
-
* Creates a function that can be called in data-first style or data-last
|
|
157
|
-
* (`pipe`-friendly) style.
|
|
158
|
-
*
|
|
159
|
-
* **When to use**
|
|
160
|
-
*
|
|
161
|
-
* Use to expose one implementation through both direct and `pipe`-friendly
|
|
162
|
-
* call styles.
|
|
163
|
-
*
|
|
164
|
-
* **Details**
|
|
165
|
-
*
|
|
166
|
-
* Pass either the arity of the uncurried function or a predicate that decides
|
|
167
|
-
* whether the current call is data-first. Arity is the common case. Use a
|
|
168
|
-
* predicate when optional arguments make arity ambiguous.
|
|
169
|
-
*
|
|
170
|
-
* **Example** (Selecting data-first or data-last style by arity)
|
|
171
|
-
*
|
|
172
|
-
* ```ts
|
|
173
|
-
* import { Function, pipe } from "effect"
|
|
174
|
-
*
|
|
175
|
-
* const sum = Function.dual<
|
|
176
|
-
* (that: number) => (self: number) => number,
|
|
177
|
-
* (self: number, that: number) => number
|
|
178
|
-
* >(2, (self, that) => self + that)
|
|
179
|
-
*
|
|
180
|
-
* console.log(sum(2, 3)) // 5
|
|
181
|
-
* console.log(pipe(2, sum(3))) // 5
|
|
182
|
-
* ```
|
|
183
|
-
*
|
|
184
|
-
* **Example** (Defining overloads with call signatures)
|
|
185
|
-
*
|
|
186
|
-
* ```ts
|
|
187
|
-
* import { Function, pipe } from "effect"
|
|
188
|
-
*
|
|
189
|
-
* const sum: {
|
|
190
|
-
* (that: number): (self: number) => number
|
|
191
|
-
* (self: number, that: number): number
|
|
192
|
-
* } = Function.dual(2, (self: number, that: number): number => self + that)
|
|
193
|
-
*
|
|
194
|
-
* console.log(sum(2, 3)) // 5
|
|
195
|
-
* console.log(pipe(2, sum(3))) // 5
|
|
196
|
-
* ```
|
|
197
|
-
*
|
|
198
|
-
* **Example** (Selecting data-first or data-last style with a predicate)
|
|
199
|
-
*
|
|
200
|
-
* ```ts
|
|
201
|
-
* import { Function, pipe } from "effect"
|
|
202
|
-
*
|
|
203
|
-
* const sum = Function.dual<
|
|
204
|
-
* (that: number) => (self: number) => number,
|
|
205
|
-
* (self: number, that: number) => number
|
|
206
|
-
* >(
|
|
207
|
-
* (args) => args.length === 2,
|
|
208
|
-
* (self, that) => self + that
|
|
209
|
-
* )
|
|
210
|
-
*
|
|
211
|
-
* console.log(sum(2, 3)) // 5
|
|
212
|
-
* console.log(pipe(2, sum(3))) // 5
|
|
213
|
-
* ```
|
|
214
|
-
*
|
|
215
|
-
* @category combinators
|
|
216
|
-
* @since 2.0.0
|
|
217
|
-
*/
|
|
218
68
|
const dual = function(arity, body) {
|
|
219
69
|
if (typeof arity === "function") return function() {
|
|
220
70
|
return arity(arguments) ? body.apply(this, arguments) : ((self) => body(self, ...arguments));
|
|
@@ -243,293 +93,54 @@ const dual = function(arity, body) {
|
|
|
243
93
|
};
|
|
244
94
|
}
|
|
245
95
|
};
|
|
246
|
-
/**
|
|
247
|
-
* Returns its input argument unchanged.
|
|
248
|
-
*
|
|
249
|
-
* **When to use**
|
|
250
|
-
*
|
|
251
|
-
* Use to return a value unchanged where a function is required.
|
|
252
|
-
*
|
|
253
|
-
* **Example** (Returning the same value)
|
|
254
|
-
*
|
|
255
|
-
* ```ts
|
|
256
|
-
* import { identity } from "effect"
|
|
257
|
-
* import * as assert from "node:assert"
|
|
258
|
-
*
|
|
259
|
-
* assert.deepStrictEqual(identity(5), 5)
|
|
260
|
-
* ```
|
|
261
|
-
*
|
|
262
|
-
* @category combinators
|
|
263
|
-
* @since 2.0.0
|
|
264
|
-
*/
|
|
265
96
|
const identity = (a) => a;
|
|
266
|
-
/**
|
|
267
|
-
* Returns the input value with a different static type.
|
|
268
|
-
*
|
|
269
|
-
* **When to use**
|
|
270
|
-
*
|
|
271
|
-
* Use when you need an explicit type-level cast and accept that the value is
|
|
272
|
-
* returned unchanged at runtime.
|
|
273
|
-
*
|
|
274
|
-
* **Gotchas**
|
|
275
|
-
*
|
|
276
|
-
* This is a type-level cast only; it performs no runtime validation or
|
|
277
|
-
* conversion.
|
|
278
|
-
*
|
|
279
|
-
* @see {@link satisfies} for checking assignability without changing the resulting type
|
|
280
|
-
*
|
|
281
|
-
* @category utility types
|
|
282
|
-
* @since 4.0.0
|
|
283
|
-
*/
|
|
284
97
|
const cast = identity;
|
|
285
|
-
/**
|
|
286
|
-
* Creates a zero-argument function that always returns the provided value.
|
|
287
|
-
*
|
|
288
|
-
* **When to use**
|
|
289
|
-
*
|
|
290
|
-
* Use when you need a thunk or callback that returns the same value on every
|
|
291
|
-
* invocation.
|
|
292
|
-
*
|
|
293
|
-
* **Example** (Creating a constant thunk)
|
|
294
|
-
*
|
|
295
|
-
* ```ts
|
|
296
|
-
* import { Function } from "effect"
|
|
297
|
-
* import * as assert from "node:assert"
|
|
298
|
-
*
|
|
299
|
-
* const constNull = Function.constant(null)
|
|
300
|
-
*
|
|
301
|
-
* assert.deepStrictEqual(constNull(), null)
|
|
302
|
-
* assert.deepStrictEqual(constNull(), null)
|
|
303
|
-
* ```
|
|
304
|
-
*
|
|
305
|
-
* @category constructors
|
|
306
|
-
* @since 2.0.0
|
|
307
|
-
*/
|
|
308
98
|
const constant = (value) => () => value;
|
|
309
|
-
/**
|
|
310
|
-
* Returns `true` when called.
|
|
311
|
-
*
|
|
312
|
-
* **When to use**
|
|
313
|
-
*
|
|
314
|
-
* Use when you need a thunk that returns `true` on every invocation.
|
|
315
|
-
*
|
|
316
|
-
* **Example** (Returning true from a thunk)
|
|
317
|
-
*
|
|
318
|
-
* ```ts
|
|
319
|
-
* import { Function } from "effect"
|
|
320
|
-
* import * as assert from "node:assert"
|
|
321
|
-
*
|
|
322
|
-
* assert.deepStrictEqual(Function.constTrue(), true)
|
|
323
|
-
* ```
|
|
324
|
-
*
|
|
325
|
-
* @category constants
|
|
326
|
-
* @since 2.0.0
|
|
327
|
-
*/
|
|
328
99
|
const constTrue = constant(true);
|
|
329
|
-
/**
|
|
330
|
-
* Returns `false` when called.
|
|
331
|
-
*
|
|
332
|
-
* **When to use**
|
|
333
|
-
*
|
|
334
|
-
* Use when you need a thunk that returns `false` on every invocation.
|
|
335
|
-
*
|
|
336
|
-
* **Example** (Returning false from a thunk)
|
|
337
|
-
*
|
|
338
|
-
* ```ts
|
|
339
|
-
* import { Function } from "effect"
|
|
340
|
-
* import * as assert from "node:assert"
|
|
341
|
-
*
|
|
342
|
-
* assert.deepStrictEqual(Function.constFalse(), false)
|
|
343
|
-
* ```
|
|
344
|
-
*
|
|
345
|
-
* @category constants
|
|
346
|
-
* @since 2.0.0
|
|
347
|
-
*/
|
|
348
100
|
const constFalse = constant(false);
|
|
349
|
-
/**
|
|
350
|
-
* Returns `null` when called.
|
|
351
|
-
*
|
|
352
|
-
* **When to use**
|
|
353
|
-
*
|
|
354
|
-
* Use when you need a thunk that returns `null` on every invocation.
|
|
355
|
-
*
|
|
356
|
-
* **Example** (Returning null from a thunk)
|
|
357
|
-
*
|
|
358
|
-
* ```ts
|
|
359
|
-
* import { Function } from "effect"
|
|
360
|
-
* import * as assert from "node:assert"
|
|
361
|
-
*
|
|
362
|
-
* assert.deepStrictEqual(Function.constNull(), null)
|
|
363
|
-
* ```
|
|
364
|
-
*
|
|
365
|
-
* @category constants
|
|
366
|
-
* @since 2.0.0
|
|
367
|
-
*/
|
|
368
101
|
const constNull = constant(null);
|
|
369
|
-
/**
|
|
370
|
-
* Returns `undefined` when called.
|
|
371
|
-
*
|
|
372
|
-
* **When to use**
|
|
373
|
-
*
|
|
374
|
-
* Use when you need a thunk that returns `undefined` on every invocation.
|
|
375
|
-
*
|
|
376
|
-
* **Example** (Returning undefined from a thunk)
|
|
377
|
-
*
|
|
378
|
-
* ```ts
|
|
379
|
-
* import { Function } from "effect"
|
|
380
|
-
* import * as assert from "node:assert"
|
|
381
|
-
*
|
|
382
|
-
* assert.deepStrictEqual(Function.constUndefined(), undefined)
|
|
383
|
-
* ```
|
|
384
|
-
*
|
|
385
|
-
* @category constants
|
|
386
|
-
* @since 2.0.0
|
|
387
|
-
*/
|
|
388
102
|
const constUndefined = constant(void 0);
|
|
389
|
-
/**
|
|
390
|
-
* Composes two functions, `ab` and `bc` into a single function that takes in an argument `a` of type `A` and returns a result of type `C`.
|
|
391
|
-
* The result is obtained by first applying the `ab` function to `a` and then applying the `bc` function to the result of `ab`.
|
|
392
|
-
*
|
|
393
|
-
* **When to use**
|
|
394
|
-
*
|
|
395
|
-
* Use to compose exactly two unary functions into a reusable unary function.
|
|
396
|
-
*
|
|
397
|
-
* **Example** (Composing two functions)
|
|
398
|
-
*
|
|
399
|
-
* ```ts
|
|
400
|
-
* import { Function } from "effect"
|
|
401
|
-
* import * as assert from "node:assert"
|
|
402
|
-
*
|
|
403
|
-
* const increment = (n: number) => n + 1
|
|
404
|
-
* const square = (n: number) => n * n
|
|
405
|
-
*
|
|
406
|
-
* assert.strictEqual(Function.compose(increment, square)(2), 9)
|
|
407
|
-
* ```
|
|
408
|
-
*
|
|
409
|
-
* @see {@link flow} for composing a left-to-right sequence of functions
|
|
410
|
-
* @see {@link pipe} for applying a value through a left-to-right sequence immediately
|
|
411
|
-
*
|
|
412
|
-
* @category combinators
|
|
413
|
-
* @since 2.0.0
|
|
414
|
-
*/
|
|
415
103
|
const compose = dual(2, (ab, bc) => (a) => bc(ab(a)));
|
|
416
|
-
/**
|
|
417
|
-
* Marks an impossible branch by accepting a `never` value and returning any
|
|
418
|
-
* type.
|
|
419
|
-
*
|
|
420
|
-
* **When to use**
|
|
421
|
-
*
|
|
422
|
-
* Use when you need a return value in a branch that exhaustive checks prove
|
|
423
|
-
* cannot be reached.
|
|
424
|
-
*
|
|
425
|
-
* **Gotchas**
|
|
426
|
-
*
|
|
427
|
-
* Calling `absurd` throws, because a value of type `never` should be
|
|
428
|
-
* impossible at runtime.
|
|
429
|
-
*
|
|
430
|
-
* **Example** (Handling impossible values)
|
|
431
|
-
*
|
|
432
|
-
* ```ts
|
|
433
|
-
* import { absurd } from "effect"
|
|
434
|
-
*
|
|
435
|
-
* const handleNever = (value: never) => {
|
|
436
|
-
* return absurd(value) // This will throw an error if called
|
|
437
|
-
* }
|
|
438
|
-
* ```
|
|
439
|
-
*
|
|
440
|
-
* @category utility types
|
|
441
|
-
* @since 2.0.0
|
|
442
|
-
*/
|
|
443
104
|
const absurd = (_) => {
|
|
444
105
|
throw new Error("Called `absurd` function which should be uncallable");
|
|
445
106
|
};
|
|
446
|
-
/**
|
|
447
|
-
* Creates a compile-time placeholder for a value of any type.
|
|
448
|
-
*
|
|
449
|
-
* **When to use**
|
|
450
|
-
*
|
|
451
|
-
* Use as a temporary typed placeholder while developing incomplete code.
|
|
452
|
-
*
|
|
453
|
-
* **Gotchas**
|
|
454
|
-
*
|
|
455
|
-
* `hole` is intended for temporary development use. If the placeholder is
|
|
456
|
-
* evaluated at runtime, it throws.
|
|
457
|
-
*
|
|
458
|
-
* **Example** (Creating a development placeholder)
|
|
459
|
-
*
|
|
460
|
-
* ```ts
|
|
461
|
-
* import { hole } from "effect"
|
|
462
|
-
*
|
|
463
|
-
* // Intentionally not called: `hole` throws if the placeholder is evaluated.
|
|
464
|
-
* const buildUser = (id: number): { readonly id: number; readonly name: string } => ({
|
|
465
|
-
* id,
|
|
466
|
-
* name: hole<string>()
|
|
467
|
-
* })
|
|
468
|
-
*
|
|
469
|
-
* console.log(typeof buildUser) // "function"
|
|
470
|
-
* ```
|
|
471
|
-
*
|
|
472
|
-
* @category utility types
|
|
473
|
-
* @since 2.0.0
|
|
474
|
-
*/
|
|
475
107
|
const hole = cast(absurd);
|
|
108
|
+
const and = dual(2, (a, b) => (data) => a(data) && b(data));
|
|
109
|
+
const or = dual(2, (a, b) => (data) => a(data) || b(data));
|
|
110
|
+
const xor = dual(2, (a, b) => (data) => a(data) !== b(data));
|
|
111
|
+
const eqv = dual(2, (a, b) => (data) => a(data) === b(data));
|
|
112
|
+
const implies = dual(2, (antecedent, consequent) => (data) => !antecedent(data) || consequent(data));
|
|
113
|
+
const nor = dual(2, (a, b) => (data) => !a(data) && !b(data));
|
|
114
|
+
const nand = dual(2, (a, b) => (data) => !a(data) || !b(data));
|
|
115
|
+
function isString(input) {
|
|
116
|
+
return typeof input === "string";
|
|
117
|
+
}
|
|
118
|
+
function isFunction(input) {
|
|
119
|
+
return typeof input === "function";
|
|
120
|
+
}
|
|
121
|
+
function isObjectKeyword(input) {
|
|
122
|
+
return typeof input === "object" && input !== null || isFunction(input);
|
|
123
|
+
}
|
|
124
|
+
const hasProperty = dual(2, (data, property) => isObjectKeyword(data) && property in data);
|
|
476
125
|
function getOrInsertComputed(map, key, callback) {
|
|
477
126
|
if (map.has(key)) return map.get(key);
|
|
478
127
|
const value = callback(key);
|
|
479
128
|
map.set(key, value);
|
|
480
129
|
return value;
|
|
481
130
|
}
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
* Supports both data-first and data-last (`pipe`-friendly) call styles.
|
|
486
|
-
*
|
|
487
|
-
* @param pred - The predicate to test each element with.
|
|
488
|
-
* @returns A new array without the matching prefix.
|
|
489
|
-
* @example
|
|
490
|
-
* ```ts
|
|
491
|
-
* import * as assert from "node:assert"
|
|
492
|
-
* import { dropWhile, pipe } from "@local/eff"
|
|
493
|
-
*
|
|
494
|
-
* // data-first
|
|
495
|
-
* assert.deepStrictEqual(dropWhile([1, 2, 3, 2, 1], (n: number) => n < 3), [3, 2, 1])
|
|
496
|
-
*
|
|
497
|
-
* // data-last
|
|
498
|
-
* assert.deepStrictEqual(pipe([1, 2, 3, 2, 1], dropWhile((n: number) => n < 3)), [3, 2, 1])
|
|
499
|
-
* ```
|
|
500
|
-
* @category array
|
|
501
|
-
*/
|
|
502
|
-
const dropWhile = dual(2, (xs, pred) => {
|
|
503
|
-
const len = xs.length;
|
|
131
|
+
const dropWhile = dual(2, (self, predicate) => {
|
|
132
|
+
const input = Array.isArray(self) ? self : Array.from(self);
|
|
133
|
+
const len = input.length;
|
|
504
134
|
let idx = 0;
|
|
505
|
-
while (idx < len &&
|
|
506
|
-
return
|
|
135
|
+
while (idx < len && predicate(input[idx], idx)) idx++;
|
|
136
|
+
return input.slice(idx);
|
|
507
137
|
});
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
* Supports both data-first and data-last (`pipe`-friendly) call styles.
|
|
512
|
-
*
|
|
513
|
-
* @param pred - The predicate to test each element with.
|
|
514
|
-
* @returns A new array containing only the matching prefix.
|
|
515
|
-
* @example
|
|
516
|
-
* ```ts
|
|
517
|
-
* import * as assert from "node:assert"
|
|
518
|
-
* import { pipe, takeWhile } from "@local/eff"
|
|
519
|
-
*
|
|
520
|
-
* // data-first
|
|
521
|
-
* assert.deepStrictEqual(takeWhile([1, 2, 3, 2, 1], (n: number) => n < 3), [1, 2])
|
|
522
|
-
*
|
|
523
|
-
* // data-last
|
|
524
|
-
* assert.deepStrictEqual(pipe([1, 2, 3, 2, 1], takeWhile((n: number) => n < 3)), [1, 2])
|
|
525
|
-
* ```
|
|
526
|
-
* @category array
|
|
527
|
-
*/
|
|
528
|
-
const takeWhile = dual(2, (xs, pred) => {
|
|
529
|
-
const len = xs.length;
|
|
138
|
+
const takeWhile = dual(2, (self, predicate) => {
|
|
139
|
+
const input = Array.isArray(self) ? self : Array.from(self);
|
|
140
|
+
const len = input.length;
|
|
530
141
|
let idx = 0;
|
|
531
|
-
while (idx < len &&
|
|
532
|
-
return
|
|
142
|
+
while (idx < len && predicate(input[idx], idx)) idx++;
|
|
143
|
+
return input.slice(0, idx);
|
|
533
144
|
});
|
|
534
145
|
|
|
535
146
|
//#endregion
|
|
@@ -593,17 +204,6 @@ function getCallKind$5(node) {
|
|
|
593
204
|
if (name != null && isMatching(P.union("addEventListener", "removeEventListener"))(name)) return name;
|
|
594
205
|
return "other";
|
|
595
206
|
}
|
|
596
|
-
/**
|
|
597
|
-
* Resolve the callee of a call inside an effect cleanup to the function it refers to.
|
|
598
|
-
* A bare call (`stop()`) resolves through the scope to the local function; a member call
|
|
599
|
-
* (`handlers.stop()`) only counts when the receiver resolves to a local object literal
|
|
600
|
-
* whose matching property is a function — an unresolvable member call says nothing about
|
|
601
|
-
* a same-named local function. Falls back to the callee name when a bare call cannot be
|
|
602
|
-
* resolved locally.
|
|
603
|
-
* @param context The ESLint rule context
|
|
604
|
-
* @param node The call expression to resolve
|
|
605
|
-
* @returns The resolved function or the callee name, or null when neither applies
|
|
606
|
-
*/
|
|
607
207
|
function resolveCleanupCallee(context, node) {
|
|
608
208
|
const callee = Extract.unwrap(node.callee);
|
|
609
209
|
switch (callee.type) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "eslint-plugin-react-web-api",
|
|
3
|
-
"version": "5.24.
|
|
3
|
+
"version": "5.24.2",
|
|
4
4
|
"description": "ESLint React's ESLint plugin for interacting with Web APIs",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"react",
|
|
@@ -37,11 +37,11 @@
|
|
|
37
37
|
"dist"
|
|
38
38
|
],
|
|
39
39
|
"dependencies": {
|
|
40
|
-
"@eslint-react/ast": "5.24.
|
|
41
|
-
"@eslint-react/core": "5.24.
|
|
42
|
-
"@eslint-react/eslint": "5.24.
|
|
43
|
-
"@eslint-react/shared": "5.24.
|
|
44
|
-
"@eslint-react/var": "5.24.
|
|
40
|
+
"@eslint-react/ast": "5.24.2",
|
|
41
|
+
"@eslint-react/core": "5.24.2",
|
|
42
|
+
"@eslint-react/eslint": "5.24.2",
|
|
43
|
+
"@eslint-react/shared": "5.24.2",
|
|
44
|
+
"@eslint-react/var": "5.24.2",
|
|
45
45
|
"@typescript-eslint/types": "^8.71.0",
|
|
46
46
|
"@typescript-eslint/utils": "^8.71.0",
|
|
47
47
|
"ts-pattern": "^5.9.0"
|
|
@@ -53,7 +53,7 @@
|
|
|
53
53
|
"@types/react": "^19.3.0",
|
|
54
54
|
"@types/react-dom": "^19.3.0",
|
|
55
55
|
"dedent": "^1.7.2",
|
|
56
|
-
"eslint": "^10.
|
|
56
|
+
"eslint": "^10.12.0",
|
|
57
57
|
"tsdown": "^0.23.0",
|
|
58
58
|
"typescript": "6.0.3"
|
|
59
59
|
},
|