eslint-plugin-react-debug 5.12.1 → 5.13.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/dist/index.js +7 -165
- package/package.json +7 -7
package/dist/index.js
CHANGED
|
@@ -29,7 +29,7 @@ var __exportAll = (all, no_symbols) => {
|
|
|
29
29
|
//#endregion
|
|
30
30
|
//#region package.json
|
|
31
31
|
var name$1 = "eslint-plugin-react-debug";
|
|
32
|
-
var version = "5.
|
|
32
|
+
var version = "5.13.0";
|
|
33
33
|
|
|
34
34
|
//#endregion
|
|
35
35
|
//#region src/utils/create-rule.ts
|
|
@@ -224,167 +224,6 @@ function create$1(context) {
|
|
|
224
224
|
};
|
|
225
225
|
}
|
|
226
226
|
|
|
227
|
-
//#endregion
|
|
228
|
-
//#region ../../.pkgs/eff/dist/index.js
|
|
229
|
-
/**
|
|
230
|
-
* Creates a function that can be used in a data-last (aka `pipe`able) or
|
|
231
|
-
* data-first style.
|
|
232
|
-
*
|
|
233
|
-
* The first parameter to `dual` is either the arity of the uncurried function
|
|
234
|
-
* or a predicate that determines if the function is being used in a data-first
|
|
235
|
-
* or data-last style.
|
|
236
|
-
*
|
|
237
|
-
* Using the arity is the most common use case, but there are some cases where
|
|
238
|
-
* you may want to use a predicate. For example, if you have a function that
|
|
239
|
-
* takes an optional argument, you can use a predicate to determine if the
|
|
240
|
-
* function is being used in a data-first or data-last style.
|
|
241
|
-
*
|
|
242
|
-
* You can pass either the arity of the uncurried function or a predicate
|
|
243
|
-
* which determines if the function is being used in a data-first or
|
|
244
|
-
* data-last style.
|
|
245
|
-
*
|
|
246
|
-
* **Example** (Using arity to determine data-first or data-last style)
|
|
247
|
-
*
|
|
248
|
-
* ```ts
|
|
249
|
-
* import { dual, pipe } from "effect/Function"
|
|
250
|
-
*
|
|
251
|
-
* const sum = dual<
|
|
252
|
-
* (that: number) => (self: number) => number,
|
|
253
|
-
* (self: number, that: number) => number
|
|
254
|
-
* >(2, (self, that) => self + that)
|
|
255
|
-
*
|
|
256
|
-
* console.log(sum(2, 3)) // 5
|
|
257
|
-
* console.log(pipe(2, sum(3))) // 5
|
|
258
|
-
* ```
|
|
259
|
-
*
|
|
260
|
-
* **Example** (Using call signatures to define the overloads)
|
|
261
|
-
*
|
|
262
|
-
* ```ts
|
|
263
|
-
* import { dual, pipe } from "effect/Function"
|
|
264
|
-
*
|
|
265
|
-
* const sum: {
|
|
266
|
-
* (that: number): (self: number) => number
|
|
267
|
-
* (self: number, that: number): number
|
|
268
|
-
* } = dual(2, (self: number, that: number): number => self + that)
|
|
269
|
-
*
|
|
270
|
-
* console.log(sum(2, 3)) // 5
|
|
271
|
-
* console.log(pipe(2, sum(3))) // 5
|
|
272
|
-
* ```
|
|
273
|
-
*
|
|
274
|
-
* **Example** (Using a predicate to determine data-first or data-last style)
|
|
275
|
-
*
|
|
276
|
-
* ```ts
|
|
277
|
-
* import { dual, pipe } from "effect/Function"
|
|
278
|
-
*
|
|
279
|
-
* const sum = dual<
|
|
280
|
-
* (that: number) => (self: number) => number,
|
|
281
|
-
* (self: number, that: number) => number
|
|
282
|
-
* >(
|
|
283
|
-
* (args) => args.length === 2,
|
|
284
|
-
* (self, that) => self + that
|
|
285
|
-
* )
|
|
286
|
-
*
|
|
287
|
-
* console.log(sum(2, 3)) // 5
|
|
288
|
-
* console.log(pipe(2, sum(3))) // 5
|
|
289
|
-
* ```
|
|
290
|
-
*
|
|
291
|
-
* @param arity - The arity of the uncurried function or a predicate that determines if the function is being used in a data-first or data-last style.
|
|
292
|
-
* @param body - The function to be curried.
|
|
293
|
-
* @since 1.0.0
|
|
294
|
-
*/
|
|
295
|
-
const dual = function(arity, body) {
|
|
296
|
-
if (typeof arity === "function") return function() {
|
|
297
|
-
return arity(arguments) ? body.apply(this, arguments) : ((self) => body(self, ...arguments));
|
|
298
|
-
};
|
|
299
|
-
switch (arity) {
|
|
300
|
-
case 0:
|
|
301
|
-
case 1: throw new RangeError(`Invalid arity ${arity}`);
|
|
302
|
-
case 2: return function(a, b) {
|
|
303
|
-
if (arguments.length >= 2) return body(a, b);
|
|
304
|
-
return function(self) {
|
|
305
|
-
return body(self, a);
|
|
306
|
-
};
|
|
307
|
-
};
|
|
308
|
-
case 3: return function(a, b, c) {
|
|
309
|
-
if (arguments.length >= 3) return body(a, b, c);
|
|
310
|
-
return function(self) {
|
|
311
|
-
return body(self, a, b);
|
|
312
|
-
};
|
|
313
|
-
};
|
|
314
|
-
default: return function() {
|
|
315
|
-
if (arguments.length >= arity) return body.apply(this, arguments);
|
|
316
|
-
const args = arguments;
|
|
317
|
-
return function(self) {
|
|
318
|
-
return body(self, ...args);
|
|
319
|
-
};
|
|
320
|
-
};
|
|
321
|
-
}
|
|
322
|
-
};
|
|
323
|
-
/**
|
|
324
|
-
* 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`.
|
|
325
|
-
* The result is obtained by first applying the `ab` function to `a` and then applying the `bc` function to the result of `ab`.
|
|
326
|
-
*
|
|
327
|
-
* @param self - The first function to apply (or the composed function in data-last style).
|
|
328
|
-
* @param bc - The second function to apply.
|
|
329
|
-
* @returns A composed function that applies both functions in sequence.
|
|
330
|
-
* @example
|
|
331
|
-
* ```ts
|
|
332
|
-
* import * as assert from "node:assert"
|
|
333
|
-
* import { compose } from "effect/Function"
|
|
334
|
-
*
|
|
335
|
-
* const increment = (n: number) => n + 1;
|
|
336
|
-
* const square = (n: number) => n * n;
|
|
337
|
-
*
|
|
338
|
-
* assert.strictEqual(compose(increment, square)(2), 9);
|
|
339
|
-
* ```
|
|
340
|
-
*
|
|
341
|
-
* @since 1.0.0
|
|
342
|
-
*/
|
|
343
|
-
const compose = dual(2, (ab, bc) => (a) => bc(ab(a)));
|
|
344
|
-
function flow(ab, bc, cd, de, ef, fg, gh, hi, ij) {
|
|
345
|
-
switch (arguments.length) {
|
|
346
|
-
case 1: return ab;
|
|
347
|
-
case 2: return function() {
|
|
348
|
-
return bc(ab.apply(this, arguments));
|
|
349
|
-
};
|
|
350
|
-
case 3: return function() {
|
|
351
|
-
return cd(bc(ab.apply(this, arguments)));
|
|
352
|
-
};
|
|
353
|
-
case 4: return function() {
|
|
354
|
-
return de(cd(bc(ab.apply(this, arguments))));
|
|
355
|
-
};
|
|
356
|
-
case 5: return function() {
|
|
357
|
-
return ef(de(cd(bc(ab.apply(this, arguments)))));
|
|
358
|
-
};
|
|
359
|
-
case 6: return function() {
|
|
360
|
-
return fg(ef(de(cd(bc(ab.apply(this, arguments))))));
|
|
361
|
-
};
|
|
362
|
-
case 7: return function() {
|
|
363
|
-
return gh(fg(ef(de(cd(bc(ab.apply(this, arguments)))))));
|
|
364
|
-
};
|
|
365
|
-
case 8: return function() {
|
|
366
|
-
return hi(gh(fg(ef(de(cd(bc(ab.apply(this, arguments))))))));
|
|
367
|
-
};
|
|
368
|
-
case 9: return function() {
|
|
369
|
-
return ij(hi(gh(fg(ef(de(cd(bc(ab.apply(this, arguments)))))))));
|
|
370
|
-
};
|
|
371
|
-
}
|
|
372
|
-
}
|
|
373
|
-
|
|
374
|
-
//#endregion
|
|
375
|
-
//#region src/rules/jsx/lib.ts
|
|
376
|
-
/**
|
|
377
|
-
* Creates a report function for the given rule context.
|
|
378
|
-
* @param context The ESLint rule context.
|
|
379
|
-
* @returns A function that can be used to report violations.
|
|
380
|
-
*/
|
|
381
|
-
function report(context) {
|
|
382
|
-
return (descriptor) => {
|
|
383
|
-
if (descriptor == null) return;
|
|
384
|
-
context.report(descriptor);
|
|
385
|
-
};
|
|
386
|
-
}
|
|
387
|
-
|
|
388
227
|
//#endregion
|
|
389
228
|
//#region src/rules/jsx/jsx.ts
|
|
390
229
|
const RULE_NAME = "jsx";
|
|
@@ -402,7 +241,7 @@ var jsx_default = createRule({
|
|
|
402
241
|
function create(context) {
|
|
403
242
|
const jsxConfig = core.getJsxConfig(context);
|
|
404
243
|
function visit(node) {
|
|
405
|
-
|
|
244
|
+
context.report({
|
|
406
245
|
data: { json: stringify({
|
|
407
246
|
kind: match(node).with({ type: AST_NODE_TYPES.JSXElement }, (n) => isFragmentElement(n, jsxConfig.jsxFragmentFactory) ? "fragment" : "element").with({ type: AST_NODE_TYPES.JSXFragment }, () => "fragment").exhaustive(),
|
|
408
247
|
type: getElementFullType(node),
|
|
@@ -414,9 +253,12 @@ function create(context) {
|
|
|
414
253
|
}) },
|
|
415
254
|
messageId: "default",
|
|
416
255
|
node
|
|
417
|
-
};
|
|
256
|
+
});
|
|
418
257
|
}
|
|
419
|
-
return {
|
|
258
|
+
return {
|
|
259
|
+
JSXElement: visit,
|
|
260
|
+
JSXFragment: visit
|
|
261
|
+
};
|
|
420
262
|
}
|
|
421
263
|
|
|
422
264
|
//#endregion
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "eslint-plugin-react-debug",
|
|
3
|
-
"version": "5.
|
|
3
|
+
"version": "5.13.0",
|
|
4
4
|
"description": "ESLint React's ESLint plugin for debugging related rules.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"react",
|
|
@@ -41,12 +41,12 @@
|
|
|
41
41
|
"@typescript-eslint/types": "^8.63.0",
|
|
42
42
|
"@typescript-eslint/utils": "^8.63.0",
|
|
43
43
|
"ts-pattern": "^5.9.0",
|
|
44
|
-
"@eslint-react/ast": "5.
|
|
45
|
-
"@eslint-react/eslint": "5.
|
|
46
|
-
"@eslint-react/
|
|
47
|
-
"@eslint-react/
|
|
48
|
-
"@eslint-react/
|
|
49
|
-
"@eslint-react/
|
|
44
|
+
"@eslint-react/ast": "5.13.0",
|
|
45
|
+
"@eslint-react/eslint": "5.13.0",
|
|
46
|
+
"@eslint-react/shared": "5.13.0",
|
|
47
|
+
"@eslint-react/core": "5.13.0",
|
|
48
|
+
"@eslint-react/jsx": "5.13.0",
|
|
49
|
+
"@eslint-react/var": "5.13.0"
|
|
50
50
|
},
|
|
51
51
|
"devDependencies": {
|
|
52
52
|
"@types/react": "^19.2.17",
|