@eslint-react/shared 3.0.0-next.71 → 3.0.0-next.76

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.d.ts CHANGED
@@ -110,6 +110,14 @@ declare const IMPURE_FUNCS: ReadonlyMap<string, ReadonlySet<string>>;
110
110
  * Known impure global constructors used with `new`
111
111
  */
112
112
  declare const IMPURE_CTORS: ReadonlySet<string>;
113
+ /**
114
+ * Known pure functions
115
+ */
116
+ declare const PURE_FUNCS: ReadonlyMap<string, ReadonlySet<string>>;
117
+ /**
118
+ Known pure global constructors used with `new`
119
+ */
120
+ declare const PURE_CTORS: ReadonlySet<string>;
113
121
  //#endregion
114
122
  //#region src/define-rule-listener.d.ts
115
123
  /**
@@ -289,4 +297,4 @@ declare module "@typescript-eslint/utils/ts-eslint" {
289
297
  }
290
298
  }
291
299
  //#endregion
292
- export { DEFAULT_ESLINT_REACT_SETTINGS, DEFAULT_ESLINT_SETTINGS, ESLintReactSettings, ESLintReactSettingsNormalized, ESLintReactSettingsSchema, ESLintSettings, ESLintSettingsSchema, GITHUB_URL, IMPURE_CTORS, IMPURE_FUNCS, IdGenerator, NPM_SCOPE, RE_ANNOTATION_JSX, RE_ANNOTATION_JSX_FRAG, RE_ANNOTATION_JSX_IMPORT_SOURCE, RE_ANNOTATION_JSX_RUNTIME, RE_CAMEL_CASE, RE_COMPONENT_NAME, RE_COMPONENT_NAME_LOOSE, RE_CONSTANT_CASE, RE_HOOK_NAME, RE_HTML_TAG, RE_JAVASCRIPT_PROTOCOL, RE_JS_EXT, RE_JS_IDENTIFIER, RE_KEBAB_CASE, RE_PASCAL_CASE, RE_REGEXP_STR, RE_SNAKE_CASE, RE_TS_EXT, RegExpLike, type ReportFixFunction, RuleConfig, RuleContext, RuleFeature, type RuleFix, type RuleFixer, RuleSuggest, SettingsConfig, Severity, SeverityLevel, SeverityName, WEBSITE_URL, decodeESLintSettings, decodeSettings, defineRuleListener, getReactVersion, getSettingsFromContext, isESLintReactSettings, isESLintSettings, isRegExp, normalizeSettings, report, toRegExp };
300
+ export { DEFAULT_ESLINT_REACT_SETTINGS, DEFAULT_ESLINT_SETTINGS, ESLintReactSettings, ESLintReactSettingsNormalized, ESLintReactSettingsSchema, ESLintSettings, ESLintSettingsSchema, GITHUB_URL, IMPURE_CTORS, IMPURE_FUNCS, IdGenerator, NPM_SCOPE, PURE_CTORS, PURE_FUNCS, RE_ANNOTATION_JSX, RE_ANNOTATION_JSX_FRAG, RE_ANNOTATION_JSX_IMPORT_SOURCE, RE_ANNOTATION_JSX_RUNTIME, RE_CAMEL_CASE, RE_COMPONENT_NAME, RE_COMPONENT_NAME_LOOSE, RE_CONSTANT_CASE, RE_HOOK_NAME, RE_HTML_TAG, RE_JAVASCRIPT_PROTOCOL, RE_JS_EXT, RE_JS_IDENTIFIER, RE_KEBAB_CASE, RE_PASCAL_CASE, RE_REGEXP_STR, RE_SNAKE_CASE, RE_TS_EXT, RegExpLike, type ReportFixFunction, RuleConfig, RuleContext, RuleFeature, type RuleFix, type RuleFixer, RuleSuggest, SettingsConfig, Severity, SeverityLevel, SeverityName, WEBSITE_URL, decodeESLintSettings, decodeSettings, defineRuleListener, getReactVersion, getSettingsFromContext, isESLintReactSettings, isESLintSettings, isRegExp, normalizeSettings, report, toRegExp };
package/dist/index.js CHANGED
@@ -1,6 +1,5 @@
1
1
  import module from "node:module";
2
2
  import path from "node:path";
3
- import { constFalse, getOrElseUpdate, identity } from "@eslint-react/eff";
4
3
  import { P, match } from "ts-pattern";
5
4
  import { z } from "zod/v4";
6
5
 
@@ -217,6 +216,53 @@ const IMPURE_FUNCS = new Map([
217
216
  "write",
218
217
  "writeln"
219
218
  ])],
219
+ ["globalThis", new Set([
220
+ "addEventListener",
221
+ "alert",
222
+ "alert",
223
+ "blur",
224
+ "cancelAnimationFrame",
225
+ "cancelIdleCallback",
226
+ "clearInterval",
227
+ "clearInterval",
228
+ "clearTimeout",
229
+ "clearTimeout",
230
+ "close",
231
+ "confirm",
232
+ "confirm",
233
+ "dispatchEvent",
234
+ "fetch",
235
+ "fetch",
236
+ "focus",
237
+ "getComputedStyle",
238
+ "getSelection",
239
+ "matchMedia",
240
+ "moveBy",
241
+ "moveTo",
242
+ "open",
243
+ "postMessage",
244
+ "postMessage",
245
+ "print",
246
+ "prompt",
247
+ "prompt",
248
+ "queueMicrotask",
249
+ "queueMicrotask",
250
+ "removeEventListener",
251
+ "reportError",
252
+ "requestAnimationFrame",
253
+ "requestIdleCallback",
254
+ "resizeBy",
255
+ "resizeTo",
256
+ "scroll",
257
+ "scrollBy",
258
+ "scrollTo",
259
+ "setInterval",
260
+ "setInterval",
261
+ "setTimeout",
262
+ "setTimeout",
263
+ "stop",
264
+ "structuredClone"
265
+ ])],
220
266
  ["history", new Set([
221
267
  "back",
222
268
  "forward",
@@ -316,15 +362,20 @@ const IMPURE_FUNCS = new Map([
316
362
  ["window", new Set([
317
363
  "addEventListener",
318
364
  "alert",
365
+ "alert",
319
366
  "blur",
320
367
  "cancelAnimationFrame",
321
368
  "cancelIdleCallback",
322
369
  "clearInterval",
370
+ "clearInterval",
371
+ "clearTimeout",
323
372
  "clearTimeout",
324
373
  "close",
325
374
  "confirm",
375
+ "confirm",
326
376
  "dispatchEvent",
327
377
  "fetch",
378
+ "fetch",
328
379
  "focus",
329
380
  "getComputedStyle",
330
381
  "getSelection",
@@ -333,10 +384,14 @@ const IMPURE_FUNCS = new Map([
333
384
  "moveTo",
334
385
  "open",
335
386
  "postMessage",
387
+ "postMessage",
336
388
  "print",
337
389
  "prompt",
390
+ "prompt",
391
+ "queueMicrotask",
338
392
  "queueMicrotask",
339
393
  "removeEventListener",
394
+ "reportError",
340
395
  "requestAnimationFrame",
341
396
  "requestIdleCallback",
342
397
  "resizeBy",
@@ -345,8 +400,11 @@ const IMPURE_FUNCS = new Map([
345
400
  "scrollBy",
346
401
  "scrollTo",
347
402
  "setInterval",
403
+ "setInterval",
404
+ "setTimeout",
348
405
  "setTimeout",
349
- "stop"
406
+ "stop",
407
+ "structuredClone"
350
408
  ])]
351
409
  ]);
352
410
  /**
@@ -378,6 +436,148 @@ const IMPURE_CTORS = new Set([
378
436
  "Worker",
379
437
  "XMLHttpRequest"
380
438
  ]);
439
+ /**
440
+ * Known pure functions
441
+ */
442
+ const PURE_FUNCS = new Map([
443
+ ["Array", new Set([
444
+ "from",
445
+ "isArray",
446
+ "of"
447
+ ])],
448
+ ["Atomics", new Set(["isLockFree"])],
449
+ ["BigInt", new Set(["asIntN", "asUintN"])],
450
+ ["Date", new Set(["parse", "UTC"])],
451
+ ["globalThis", new Set([
452
+ "atob",
453
+ "Boolean",
454
+ "btoa",
455
+ "decodeURI",
456
+ "decodeURIComponent",
457
+ "encodeURI",
458
+ "encodeURIComponent",
459
+ "escape",
460
+ "isFinite",
461
+ "isNaN",
462
+ "Number",
463
+ "parseFloat",
464
+ "parseInt",
465
+ "String",
466
+ "unescape"
467
+ ])],
468
+ ["JSON", new Set(["parse", "stringify"])],
469
+ ["Math", new Set([
470
+ "abs",
471
+ "acos",
472
+ "acosh",
473
+ "asin",
474
+ "asinh",
475
+ "atan",
476
+ "atan2",
477
+ "atanh",
478
+ "cbrt",
479
+ "ceil",
480
+ "clz32",
481
+ "cos",
482
+ "cosh",
483
+ "exp",
484
+ "expm1",
485
+ "floor",
486
+ "fround",
487
+ "hypot",
488
+ "imul",
489
+ "log",
490
+ "log1p",
491
+ "log2",
492
+ "log10",
493
+ "max",
494
+ "min",
495
+ "pow",
496
+ "round",
497
+ "sign",
498
+ "sin",
499
+ "sinh",
500
+ "sqrt",
501
+ "tan",
502
+ "tanh",
503
+ "trunc"
504
+ ])],
505
+ ["Number", new Set([
506
+ "isFinite",
507
+ "isInteger",
508
+ "isNaN",
509
+ "isSafeInteger",
510
+ "parseFloat",
511
+ "parseInt"
512
+ ])],
513
+ ["Object", new Set([
514
+ "entries",
515
+ "fromEntries",
516
+ "getOwnPropertyDescriptor",
517
+ "getOwnPropertyDescriptors",
518
+ "getOwnPropertyNames",
519
+ "getOwnPropertySymbols",
520
+ "getPrototypeOf",
521
+ "groupBy",
522
+ "hasOwn",
523
+ "is",
524
+ "isExtensible",
525
+ "isFrozen",
526
+ "isSealed",
527
+ "keys",
528
+ "values"
529
+ ])],
530
+ ["Reflect", new Set([
531
+ "apply",
532
+ "construct",
533
+ "get",
534
+ "getOwnPropertyDescriptor",
535
+ "getPrototypeOf",
536
+ "has",
537
+ "isExtensible",
538
+ "ownKeys"
539
+ ])],
540
+ ["String", new Set([
541
+ "fromCharCode",
542
+ "fromCodePoint",
543
+ "raw"
544
+ ])]
545
+ ]);
546
+ /**
547
+ Known pure global constructors used with `new`
548
+ */
549
+ const PURE_CTORS = new Set([
550
+ "Array",
551
+ "ArrayBuffer",
552
+ "BigInt64Array",
553
+ "BigUint64Array",
554
+ "DataView",
555
+ "Error",
556
+ "EvalError",
557
+ "FinalizationRegistry",
558
+ "Float32Array",
559
+ "Float64Array",
560
+ "Int8Array",
561
+ "Int16Array",
562
+ "Int32Array",
563
+ "Map",
564
+ "RangeError",
565
+ "ReferenceError",
566
+ "RegExp",
567
+ "Set",
568
+ "SyntaxError",
569
+ "TypeError",
570
+ "Uint8Array",
571
+ "Uint8ClampedArray",
572
+ "Uint16Array",
573
+ "Uint32Array",
574
+ "URIError",
575
+ "URL",
576
+ "URLSearchParams",
577
+ "WeakMap",
578
+ "WeakRef",
579
+ "WeakSet"
580
+ ]);
381
581
 
382
582
  //#endregion
383
583
  //#region src/define-rule-listener.ts
@@ -407,6 +607,147 @@ function defineRuleListener(base, ...rest) {
407
607
  return base;
408
608
  }
409
609
 
610
+ //#endregion
611
+ //#region ../../.pkgs/eff/dist/index.js
612
+ /**
613
+ * Returns its argument.
614
+ *
615
+ * @param x - The value to return.
616
+ * @returns The input value unchanged.
617
+ */
618
+ function identity(x) {
619
+ return x;
620
+ }
621
+ /**
622
+ * Creates a function that can be used in a data-last (aka `pipe`able) or
623
+ * data-first style.
624
+ *
625
+ * The first parameter to `dual` is either the arity of the uncurried function
626
+ * or a predicate that determines if the function is being used in a data-first
627
+ * or data-last style.
628
+ *
629
+ * Using the arity is the most common use case, but there are some cases where
630
+ * you may want to use a predicate. For example, if you have a function that
631
+ * takes an optional argument, you can use a predicate to determine if the
632
+ * function is being used in a data-first or data-last style.
633
+ *
634
+ * You can pass either the arity of the uncurried function or a predicate
635
+ * which determines if the function is being used in a data-first or
636
+ * data-last style.
637
+ *
638
+ * **Example** (Using arity to determine data-first or data-last style)
639
+ *
640
+ * ```ts
641
+ * import { dual, pipe } from "effect/Function"
642
+ *
643
+ * const sum = dual<
644
+ * (that: number) => (self: number) => number,
645
+ * (self: number, that: number) => number
646
+ * >(2, (self, that) => self + that)
647
+ *
648
+ * console.log(sum(2, 3)) // 5
649
+ * console.log(pipe(2, sum(3))) // 5
650
+ * ```
651
+ *
652
+ * **Example** (Using call signatures to define the overloads)
653
+ *
654
+ * ```ts
655
+ * import { dual, pipe } from "effect/Function"
656
+ *
657
+ * const sum: {
658
+ * (that: number): (self: number) => number
659
+ * (self: number, that: number): number
660
+ * } = dual(2, (self: number, that: number): number => self + that)
661
+ *
662
+ * console.log(sum(2, 3)) // 5
663
+ * console.log(pipe(2, sum(3))) // 5
664
+ * ```
665
+ *
666
+ * **Example** (Using a predicate to determine data-first or data-last style)
667
+ *
668
+ * ```ts
669
+ * import { dual, pipe } from "effect/Function"
670
+ *
671
+ * const sum = dual<
672
+ * (that: number) => (self: number) => number,
673
+ * (self: number, that: number) => number
674
+ * >(
675
+ * (args) => args.length === 2,
676
+ * (self, that) => self + that
677
+ * )
678
+ *
679
+ * console.log(sum(2, 3)) // 5
680
+ * console.log(pipe(2, sum(3))) // 5
681
+ * ```
682
+ *
683
+ * @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.
684
+ * @param body - The function to be curried.
685
+ * @since 1.0.0
686
+ */
687
+ const dual = function(arity, body) {
688
+ if (typeof arity === "function") return function() {
689
+ return arity(arguments) ? body.apply(this, arguments) : ((self) => body(self, ...arguments));
690
+ };
691
+ switch (arity) {
692
+ case 0:
693
+ case 1: throw new RangeError(`Invalid arity ${arity}`);
694
+ case 2: return function(a, b) {
695
+ if (arguments.length >= 2) return body(a, b);
696
+ return function(self) {
697
+ return body(self, a);
698
+ };
699
+ };
700
+ case 3: return function(a, b, c) {
701
+ if (arguments.length >= 3) return body(a, b, c);
702
+ return function(self) {
703
+ return body(self, a, b);
704
+ };
705
+ };
706
+ default: return function() {
707
+ if (arguments.length >= arity) return body.apply(this, arguments);
708
+ const args = arguments;
709
+ return function(self) {
710
+ return body(self, ...args);
711
+ };
712
+ };
713
+ }
714
+ };
715
+ /**
716
+ * Do nothing and return `false`.
717
+ *
718
+ * @returns false
719
+ */
720
+ function constFalse() {
721
+ return false;
722
+ }
723
+ /**
724
+ * 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`.
725
+ * The result is obtained by first applying the `ab` function to `a` and then applying the `bc` function to the result of `ab`.
726
+ *
727
+ * @param self - The first function to apply (or the composed function in data-last style).
728
+ * @param bc - The second function to apply.
729
+ * @returns A composed function that applies both functions in sequence.
730
+ * @example
731
+ * ```ts
732
+ * import * as assert from "node:assert"
733
+ * import { compose } from "effect/Function"
734
+ *
735
+ * const increment = (n: number) => n + 1;
736
+ * const square = (n: number) => n * n;
737
+ *
738
+ * assert.strictEqual(compose(increment, square)(2), 9);
739
+ * ```
740
+ *
741
+ * @since 1.0.0
742
+ */
743
+ const compose = dual(2, (ab, bc) => (a) => bc(ab(a)));
744
+ function getOrElseUpdate(map, key, callback) {
745
+ if (map.has(key)) return map.get(key);
746
+ const value = callback();
747
+ map.set(key, value);
748
+ return value;
749
+ }
750
+
410
751
  //#endregion
411
752
  //#region src/react-version.ts
412
753
  const _require = module.createRequire(process.cwd() + path.sep);
@@ -522,4 +863,4 @@ function getSettingsFromContext(context) {
522
863
  }
523
864
 
524
865
  //#endregion
525
- export { DEFAULT_ESLINT_REACT_SETTINGS, DEFAULT_ESLINT_SETTINGS, ESLintReactSettingsSchema, ESLintSettingsSchema, GITHUB_URL, IMPURE_CTORS, IMPURE_FUNCS, IdGenerator, NPM_SCOPE, RE_ANNOTATION_JSX, RE_ANNOTATION_JSX_FRAG, RE_ANNOTATION_JSX_IMPORT_SOURCE, RE_ANNOTATION_JSX_RUNTIME, RE_CAMEL_CASE, RE_COMPONENT_NAME, RE_COMPONENT_NAME_LOOSE, RE_CONSTANT_CASE, RE_HOOK_NAME, RE_HTML_TAG, RE_JAVASCRIPT_PROTOCOL, RE_JS_EXT, RE_JS_IDENTIFIER, RE_KEBAB_CASE, RE_PASCAL_CASE, RE_REGEXP_STR, RE_SNAKE_CASE, RE_TS_EXT, WEBSITE_URL, decodeESLintSettings, decodeSettings, defineRuleListener, getReactVersion, getSettingsFromContext, isESLintReactSettings, isESLintSettings, isRegExp, normalizeSettings, report, toRegExp };
866
+ export { DEFAULT_ESLINT_REACT_SETTINGS, DEFAULT_ESLINT_SETTINGS, ESLintReactSettingsSchema, ESLintSettingsSchema, GITHUB_URL, IMPURE_CTORS, IMPURE_FUNCS, IdGenerator, NPM_SCOPE, PURE_CTORS, PURE_FUNCS, RE_ANNOTATION_JSX, RE_ANNOTATION_JSX_FRAG, RE_ANNOTATION_JSX_IMPORT_SOURCE, RE_ANNOTATION_JSX_RUNTIME, RE_CAMEL_CASE, RE_COMPONENT_NAME, RE_COMPONENT_NAME_LOOSE, RE_CONSTANT_CASE, RE_HOOK_NAME, RE_HTML_TAG, RE_JAVASCRIPT_PROTOCOL, RE_JS_EXT, RE_JS_IDENTIFIER, RE_KEBAB_CASE, RE_PASCAL_CASE, RE_REGEXP_STR, RE_SNAKE_CASE, RE_TS_EXT, WEBSITE_URL, decodeESLintSettings, decodeSettings, defineRuleListener, getReactVersion, getSettingsFromContext, isESLintReactSettings, isESLintSettings, isRegExp, normalizeSettings, report, toRegExp };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@eslint-react/shared",
3
- "version": "3.0.0-next.71",
3
+ "version": "3.0.0-next.76",
4
4
  "description": "ESLint React's Shared constants and functions.",
5
5
  "homepage": "https://github.com/Rel1cx/eslint-react",
6
6
  "bugs": {
@@ -33,7 +33,7 @@
33
33
  "@typescript-eslint/utils": "canary",
34
34
  "ts-pattern": "^5.9.0",
35
35
  "zod": "^4.3.6",
36
- "@eslint-react/eff": "3.0.0-next.71"
36
+ "@local/eff": "3.0.0-beta.72"
37
37
  },
38
38
  "devDependencies": {
39
39
  "@tsconfig/node24": "^24.0.4",
@@ -43,8 +43,8 @@
43
43
  "@local/configs": "0.0.0"
44
44
  },
45
45
  "peerDependencies": {
46
- "eslint": "^8.57.0 || ^9.0.0 || ^10.0.0",
47
- "typescript": ">=4.8.4 <6.0.0"
46
+ "eslint": "^10.0.0",
47
+ "typescript": "*"
48
48
  },
49
49
  "engines": {
50
50
  "node": ">=22.0.0"