eslint-plugin-react-debug 3.0.0-next.70 → 3.0.0-next.74

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 (2) hide show
  1. package/dist/index.js +148 -2
  2. package/package.json +8 -8
package/dist/index.js CHANGED
@@ -2,7 +2,6 @@ import { DEFAULT_ESLINT_REACT_SETTINGS, WEBSITE_URL, defineRuleListener, getSett
2
2
  import * as core from "@eslint-react/core";
3
3
  import { JsxEmit, JsxInspector } from "@eslint-react/core";
4
4
  import { AST_NODE_TYPES, ESLintUtils } from "@typescript-eslint/utils";
5
- import { flow } from "@eslint-react/eff";
6
5
  import { AST_NODE_TYPES as AST_NODE_TYPES$1 } from "@typescript-eslint/types";
7
6
  import { P, match } from "ts-pattern";
8
7
 
@@ -25,7 +24,7 @@ var __exportAll = (all, no_symbols) => {
25
24
  //#endregion
26
25
  //#region package.json
27
26
  var name$1 = "eslint-plugin-react-debug";
28
- var version = "3.0.0-next.70";
27
+ var version = "3.0.0-next.74";
29
28
 
30
29
  //#endregion
31
30
  //#region src/utils/create-rule.ts
@@ -220,6 +219,153 @@ function getRefInitNode(node, initialScope) {
220
219
  }
221
220
  }
222
221
 
222
+ //#endregion
223
+ //#region ../../../.pkgs/eff/dist/index.js
224
+ /**
225
+ * Creates a function that can be used in a data-last (aka `pipe`able) or
226
+ * data-first style.
227
+ *
228
+ * The first parameter to `dual` is either the arity of the uncurried function
229
+ * or a predicate that determines if the function is being used in a data-first
230
+ * or data-last style.
231
+ *
232
+ * Using the arity is the most common use case, but there are some cases where
233
+ * you may want to use a predicate. For example, if you have a function that
234
+ * takes an optional argument, you can use a predicate to determine if the
235
+ * function is being used in a data-first or data-last style.
236
+ *
237
+ * You can pass either the arity of the uncurried function or a predicate
238
+ * which determines if the function is being used in a data-first or
239
+ * data-last style.
240
+ *
241
+ * **Example** (Using arity to determine data-first or data-last style)
242
+ *
243
+ * ```ts
244
+ * import { dual, pipe } from "effect/Function"
245
+ *
246
+ * const sum = dual<
247
+ * (that: number) => (self: number) => number,
248
+ * (self: number, that: number) => number
249
+ * >(2, (self, that) => self + that)
250
+ *
251
+ * console.log(sum(2, 3)) // 5
252
+ * console.log(pipe(2, sum(3))) // 5
253
+ * ```
254
+ *
255
+ * **Example** (Using call signatures to define the overloads)
256
+ *
257
+ * ```ts
258
+ * import { dual, pipe } from "effect/Function"
259
+ *
260
+ * const sum: {
261
+ * (that: number): (self: number) => number
262
+ * (self: number, that: number): number
263
+ * } = dual(2, (self: number, that: number): number => self + that)
264
+ *
265
+ * console.log(sum(2, 3)) // 5
266
+ * console.log(pipe(2, sum(3))) // 5
267
+ * ```
268
+ *
269
+ * **Example** (Using a predicate to determine data-first or data-last style)
270
+ *
271
+ * ```ts
272
+ * import { dual, pipe } from "effect/Function"
273
+ *
274
+ * const sum = dual<
275
+ * (that: number) => (self: number) => number,
276
+ * (self: number, that: number) => number
277
+ * >(
278
+ * (args) => args.length === 2,
279
+ * (self, that) => self + that
280
+ * )
281
+ *
282
+ * console.log(sum(2, 3)) // 5
283
+ * console.log(pipe(2, sum(3))) // 5
284
+ * ```
285
+ *
286
+ * @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.
287
+ * @param body - The function to be curried.
288
+ * @since 1.0.0
289
+ */
290
+ const dual = function(arity, body) {
291
+ if (typeof arity === "function") return function() {
292
+ return arity(arguments) ? body.apply(this, arguments) : ((self) => body(self, ...arguments));
293
+ };
294
+ switch (arity) {
295
+ case 0:
296
+ case 1: throw new RangeError(`Invalid arity ${arity}`);
297
+ case 2: return function(a, b) {
298
+ if (arguments.length >= 2) return body(a, b);
299
+ return function(self) {
300
+ return body(self, a);
301
+ };
302
+ };
303
+ case 3: return function(a, b, c) {
304
+ if (arguments.length >= 3) return body(a, b, c);
305
+ return function(self) {
306
+ return body(self, a, b);
307
+ };
308
+ };
309
+ default: return function() {
310
+ if (arguments.length >= arity) return body.apply(this, arguments);
311
+ const args = arguments;
312
+ return function(self) {
313
+ return body(self, ...args);
314
+ };
315
+ };
316
+ }
317
+ };
318
+ /**
319
+ * 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`.
320
+ * The result is obtained by first applying the `ab` function to `a` and then applying the `bc` function to the result of `ab`.
321
+ *
322
+ * @param self - The first function to apply (or the composed function in data-last style).
323
+ * @param bc - The second function to apply.
324
+ * @returns A composed function that applies both functions in sequence.
325
+ * @example
326
+ * ```ts
327
+ * import * as assert from "node:assert"
328
+ * import { compose } from "effect/Function"
329
+ *
330
+ * const increment = (n: number) => n + 1;
331
+ * const square = (n: number) => n * n;
332
+ *
333
+ * assert.strictEqual(compose(increment, square)(2), 9);
334
+ * ```
335
+ *
336
+ * @since 1.0.0
337
+ */
338
+ const compose = dual(2, (ab, bc) => (a) => bc(ab(a)));
339
+ function flow(ab, bc, cd, de, ef, fg, gh, hi, ij) {
340
+ switch (arguments.length) {
341
+ case 1: return ab;
342
+ case 2: return function() {
343
+ return bc(ab.apply(this, arguments));
344
+ };
345
+ case 3: return function() {
346
+ return cd(bc(ab.apply(this, arguments)));
347
+ };
348
+ case 4: return function() {
349
+ return de(cd(bc(ab.apply(this, arguments))));
350
+ };
351
+ case 5: return function() {
352
+ return ef(de(cd(bc(ab.apply(this, arguments)))));
353
+ };
354
+ case 6: return function() {
355
+ return fg(ef(de(cd(bc(ab.apply(this, arguments))))));
356
+ };
357
+ case 7: return function() {
358
+ return gh(fg(ef(de(cd(bc(ab.apply(this, arguments)))))));
359
+ };
360
+ case 8: return function() {
361
+ return hi(gh(fg(ef(de(cd(bc(ab.apply(this, arguments))))))));
362
+ };
363
+ case 9: return function() {
364
+ return ij(hi(gh(fg(ef(de(cd(bc(ab.apply(this, arguments)))))))));
365
+ };
366
+ }
367
+ }
368
+
223
369
  //#endregion
224
370
  //#region src/rules/jsx/jsx.ts
225
371
  const RULE_NAME = "jsx";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "eslint-plugin-react-debug",
3
- "version": "3.0.0-next.70",
3
+ "version": "3.0.0-next.74",
4
4
  "description": "ESLint React's ESLint plugin for debugging related rules.",
5
5
  "keywords": [
6
6
  "react",
@@ -43,11 +43,11 @@
43
43
  "@typescript-eslint/types": "canary",
44
44
  "@typescript-eslint/utils": "canary",
45
45
  "ts-pattern": "^5.9.0",
46
- "@eslint-react/ast": "3.0.0-next.70",
47
- "@eslint-react/core": "3.0.0-next.70",
48
- "@eslint-react/eff": "3.0.0-next.70",
49
- "@eslint-react/shared": "3.0.0-next.70",
50
- "@eslint-react/var": "3.0.0-next.70"
46
+ "@eslint-react/shared": "3.0.0-next.74",
47
+ "@eslint-react/var": "3.0.0-next.74",
48
+ "@eslint-react/ast": "3.0.0-next.74",
49
+ "@eslint-react/core": "3.0.0-next.74",
50
+ "@local/eff": "3.0.0-beta.72"
51
51
  },
52
52
  "devDependencies": {
53
53
  "@types/react": "^19.2.14",
@@ -57,8 +57,8 @@
57
57
  "@local/configs": "0.0.0"
58
58
  },
59
59
  "peerDependencies": {
60
- "eslint": "^8.57.0 || ^9.0.0 || ^10.0.0",
61
- "typescript": ">=4.8.4 <6.0.0"
60
+ "eslint": "^10.0.0",
61
+ "typescript": "*"
62
62
  },
63
63
  "engines": {
64
64
  "node": ">=22.0.0"