@coderwyd/eslint-config 3.5.0 → 3.6.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/cli.cjs CHANGED
@@ -37,7 +37,7 @@ var import_helpers = require("yargs/helpers");
37
37
  var import_picocolors = __toESM(require("picocolors"), 1);
38
38
 
39
39
  // package.json
40
- var version = "3.5.0";
40
+ var version = "3.6.0";
41
41
  var devDependencies = {
42
42
  "@antfu/ni": "^23.2.0",
43
43
  "@eslint-react/eslint-plugin": "^1.23.2",
@@ -49,6 +49,7 @@ var devDependencies = {
49
49
  "@unocss/eslint-plugin": "^65.4.2",
50
50
  bumpp: "^9.10.1",
51
51
  eslint: "^9.18.0",
52
+ "eslint-plugin-react-compiler": "19.0.0-beta-decd7b8-20250118",
52
53
  "eslint-plugin-react-hooks": "^5.1.0",
53
54
  "eslint-plugin-react-refresh": "^0.4.18",
54
55
  "eslint-plugin-svelte": "^2.46.1",
package/dist/cli.js CHANGED
@@ -8,7 +8,7 @@ import { hideBin } from "yargs/helpers";
8
8
  import c from "picocolors";
9
9
 
10
10
  // package.json
11
- var version = "3.5.0";
11
+ var version = "3.6.0";
12
12
  var devDependencies = {
13
13
  "@antfu/ni": "^23.2.0",
14
14
  "@eslint-react/eslint-plugin": "^1.23.2",
@@ -20,6 +20,7 @@ var devDependencies = {
20
20
  "@unocss/eslint-plugin": "^65.4.2",
21
21
  bumpp: "^9.10.1",
22
22
  eslint: "^9.18.0",
23
+ "eslint-plugin-react-compiler": "19.0.0-beta-decd7b8-20250118",
23
24
  "eslint-plugin-react-hooks": "^5.1.0",
24
25
  "eslint-plugin-react-refresh": "^0.4.18",
25
26
  "eslint-plugin-svelte": "^2.46.1",
package/dist/index.cjs CHANGED
@@ -707,9 +707,16 @@ var RemixPackages = [
707
707
  "@remix-run/serve",
708
708
  "@remix-run/dev"
709
709
  ];
710
+ var ReactRouterPackages = [
711
+ "@react-router/node",
712
+ "@react-router/react",
713
+ "@react-router/serve",
714
+ "@react-router/dev"
715
+ ];
710
716
  var NextJsPackages = ["next"];
711
717
  var ReactRefreshAllowConstantExportPackages = ["vite"];
712
718
  var isUsingRemix = hasPackages(RemixPackages);
719
+ var isUsingReactRouter = hasPackages(ReactRouterPackages);
713
720
  var isUsingNext = hasPackages(NextJsPackages);
714
721
  var isAllowConstantExport = hasPackages(
715
722
  ReactRefreshAllowConstantExportPackages
@@ -736,24 +743,30 @@ async function react(options = {}) {
736
743
  const typeAwareRules = {
737
744
  "react/no-leaked-conditional-rendering": "warn"
738
745
  };
739
- const [pluginReact, pluginReactHooks, pluginReactRefresh] = await Promise.all(
740
- [
741
- interopDefault(import("@eslint-react/eslint-plugin")),
742
- interopDefault(import("eslint-plugin-react-hooks")),
743
- interopDefault(import("eslint-plugin-react-refresh"))
744
- ]
745
- );
746
+ const [
747
+ pluginReact,
748
+ pluginReactHooks,
749
+ pluginReactRefresh,
750
+ pluginReactCompiler
751
+ ] = await Promise.all([
752
+ interopDefault(import("@eslint-react/eslint-plugin")),
753
+ interopDefault(import("eslint-plugin-react-hooks")),
754
+ interopDefault(import("eslint-plugin-react-refresh")),
755
+ interopDefault(import("eslint-plugin-react-compiler"))
756
+ ]);
746
757
  const plugins = pluginReact.configs.all.plugins;
747
758
  return [
748
759
  {
749
760
  name: "coderwyd/react/setup",
750
761
  plugins: {
751
762
  react: plugins["@eslint-react"],
763
+ "react-compiler": pluginReactCompiler,
752
764
  "react-dom": plugins["@eslint-react/dom"],
753
765
  "react-hooks": pluginReactHooks,
754
766
  "react-hooks-extra": plugins["@eslint-react/hooks-extra"],
755
767
  "react-naming-convention": plugins["@eslint-react/naming-convention"],
756
- "react-refresh": pluginReactRefresh
768
+ "react-refresh": pluginReactRefresh,
769
+ "react-web-api": plugins["@eslint-react/web-api"]
757
770
  }
758
771
  },
759
772
  {
@@ -768,6 +781,7 @@ async function react(options = {}) {
768
781
  },
769
782
  name: "coderwyd/react/rules",
770
783
  rules: {
784
+ "react-compiler/react-compiler": "warn",
771
785
  // recommended rules from @eslint-react/dom
772
786
  "react-dom/no-children-in-void-dom-elements": "warn",
773
787
  "react-dom/no-dangerously-set-innerhtml": "warn",
@@ -804,10 +818,15 @@ async function react(options = {}) {
804
818
  "viewport",
805
819
  "generateViewport"
806
820
  ] : [],
807
- ...isUsingRemix ? ["meta", "links", "headers", "loader", "action"] : []
821
+ ...isUsingRemix || isUsingReactRouter ? ["meta", "links", "headers", "loader", "action"] : []
808
822
  ]
809
823
  }
810
824
  ],
825
+ // recommended rules from @eslint-react/web-api
826
+ "react-web-api/no-leaked-event-listener": "warn",
827
+ "react-web-api/no-leaked-interval": "warn",
828
+ "react-web-api/no-leaked-resize-observer": "warn",
829
+ "react-web-api/no-leaked-timeout": "warn",
811
830
  // recommended rules from @eslint-react
812
831
  "react/ensure-forward-ref-using-ref": "warn",
813
832
  "react/jsx-no-duplicate-props": "warn",
package/dist/index.d.cts CHANGED
@@ -2528,6 +2528,10 @@ interface RuleOptions {
2528
2528
  * @see https://eslint.org/docs/latest/rules/radix
2529
2529
  */
2530
2530
  'radix'?: Linter.RuleEntry<Radix>
2531
+ /**
2532
+ * Surfaces diagnostics from React Forget
2533
+ */
2534
+ 'react-compiler/react-compiler'?: Linter.RuleEntry<ReactCompilerReactCompiler>
2531
2535
  /**
2532
2536
  * disallow void elements (AKA self-closing elements) from having children
2533
2537
  * @see https://eslint-react.xyz/docs/rules/dom-no-void-elements-with-children
@@ -2674,6 +2678,26 @@ interface RuleOptions {
2674
2678
  */
2675
2679
  'react-naming-convention/use-state'?: Linter.RuleEntry<[]>
2676
2680
  'react-refresh/only-export-components'?: Linter.RuleEntry<ReactRefreshOnlyExportComponents>
2681
+ /**
2682
+ * enforce that every 'addEventListener' in a component or custom Hook has a corresponding 'removeEventListener'.
2683
+ * @see https://eslint-react.xyz/docs/rules/web-api-no-leaked-event-listener
2684
+ */
2685
+ 'react-web-api/no-leaked-event-listener'?: Linter.RuleEntry<[]>
2686
+ /**
2687
+ * enforce that every 'setInterval' in a component or custom Hook has a corresponding 'clearInterval'.
2688
+ * @see https://eslint-react.xyz/docs/rules/web-api-no-leaked-interval
2689
+ */
2690
+ 'react-web-api/no-leaked-interval'?: Linter.RuleEntry<[]>
2691
+ /**
2692
+ * enforce cleanup of 'ResizeObserver' instances in components and custom Hooks.
2693
+ * @see https://eslint-react.xyz/docs/rules/web-api-no-leaked-resize-observer
2694
+ */
2695
+ 'react-web-api/no-leaked-resize-observer'?: Linter.RuleEntry<[]>
2696
+ /**
2697
+ * enforce that every 'setTimeout' in a component or custom Hook has a corresponding 'clearTimeout'.
2698
+ * @see https://eslint-react.xyz/docs/rules/web-api-no-leaked-timeout
2699
+ */
2700
+ 'react-web-api/no-leaked-timeout'?: Linter.RuleEntry<[]>
2677
2701
  /**
2678
2702
  * disallow using shorthand boolean attributes
2679
2703
  * @see https://eslint-react.xyz/docs/rules/avoid-shorthand-boolean
@@ -10286,6 +10310,10 @@ type Quotes = []|[("single" | "double" | "backtick")]|[("single" | "double" | "b
10286
10310
  })]
10287
10311
  // ----- radix -----
10288
10312
  type Radix = []|[("always" | "as-needed")]
10313
+ // ----- react-compiler/react-compiler -----
10314
+ type ReactCompilerReactCompiler = []|[{
10315
+ [k: string]: unknown | undefined
10316
+ }]
10289
10317
  // ----- react-dom/no-unknown-property -----
10290
10318
  type ReactDomNoUnknownProperty = []|[{
10291
10319
  ignore?: string[]
@@ -14413,6 +14441,7 @@ declare function getOverrides<K extends keyof OptionsConfig>(options: OptionsCon
14413
14441
  'quote-props'?: eslint.Linter.RuleEntry<undefined> | undefined;
14414
14442
  quotes?: eslint.Linter.RuleEntry<undefined> | undefined;
14415
14443
  radix?: eslint.Linter.RuleEntry<undefined> | undefined;
14444
+ 'react-compiler/react-compiler'?: eslint.Linter.RuleEntry<undefined> | undefined;
14416
14445
  'react-dom/no-children-in-void-dom-elements'?: eslint.Linter.RuleEntry<[]> | undefined;
14417
14446
  'react-dom/no-dangerously-set-innerhtml'?: eslint.Linter.RuleEntry<[]> | undefined;
14418
14447
  'react-dom/no-dangerously-set-innerhtml-with-children'?: eslint.Linter.RuleEntry<[]> | undefined;
@@ -14443,6 +14472,10 @@ declare function getOverrides<K extends keyof OptionsConfig>(options: OptionsCon
14443
14472
  'react-naming-convention/filename-extension'?: eslint.Linter.RuleEntry<undefined> | undefined;
14444
14473
  'react-naming-convention/use-state'?: eslint.Linter.RuleEntry<[]> | undefined;
14445
14474
  'react-refresh/only-export-components'?: eslint.Linter.RuleEntry<undefined> | undefined;
14475
+ 'react-web-api/no-leaked-event-listener'?: eslint.Linter.RuleEntry<[]> | undefined;
14476
+ 'react-web-api/no-leaked-interval'?: eslint.Linter.RuleEntry<[]> | undefined;
14477
+ 'react-web-api/no-leaked-resize-observer'?: eslint.Linter.RuleEntry<[]> | undefined;
14478
+ 'react-web-api/no-leaked-timeout'?: eslint.Linter.RuleEntry<[]> | undefined;
14446
14479
  'react/avoid-shorthand-boolean'?: eslint.Linter.RuleEntry<[]> | undefined;
14447
14480
  'react/avoid-shorthand-fragment'?: eslint.Linter.RuleEntry<[]> | undefined;
14448
14481
  'react/ensure-forward-ref-using-ref'?: eslint.Linter.RuleEntry<[]> | undefined;
package/dist/index.d.ts CHANGED
@@ -2528,6 +2528,10 @@ interface RuleOptions {
2528
2528
  * @see https://eslint.org/docs/latest/rules/radix
2529
2529
  */
2530
2530
  'radix'?: Linter.RuleEntry<Radix>
2531
+ /**
2532
+ * Surfaces diagnostics from React Forget
2533
+ */
2534
+ 'react-compiler/react-compiler'?: Linter.RuleEntry<ReactCompilerReactCompiler>
2531
2535
  /**
2532
2536
  * disallow void elements (AKA self-closing elements) from having children
2533
2537
  * @see https://eslint-react.xyz/docs/rules/dom-no-void-elements-with-children
@@ -2674,6 +2678,26 @@ interface RuleOptions {
2674
2678
  */
2675
2679
  'react-naming-convention/use-state'?: Linter.RuleEntry<[]>
2676
2680
  'react-refresh/only-export-components'?: Linter.RuleEntry<ReactRefreshOnlyExportComponents>
2681
+ /**
2682
+ * enforce that every 'addEventListener' in a component or custom Hook has a corresponding 'removeEventListener'.
2683
+ * @see https://eslint-react.xyz/docs/rules/web-api-no-leaked-event-listener
2684
+ */
2685
+ 'react-web-api/no-leaked-event-listener'?: Linter.RuleEntry<[]>
2686
+ /**
2687
+ * enforce that every 'setInterval' in a component or custom Hook has a corresponding 'clearInterval'.
2688
+ * @see https://eslint-react.xyz/docs/rules/web-api-no-leaked-interval
2689
+ */
2690
+ 'react-web-api/no-leaked-interval'?: Linter.RuleEntry<[]>
2691
+ /**
2692
+ * enforce cleanup of 'ResizeObserver' instances in components and custom Hooks.
2693
+ * @see https://eslint-react.xyz/docs/rules/web-api-no-leaked-resize-observer
2694
+ */
2695
+ 'react-web-api/no-leaked-resize-observer'?: Linter.RuleEntry<[]>
2696
+ /**
2697
+ * enforce that every 'setTimeout' in a component or custom Hook has a corresponding 'clearTimeout'.
2698
+ * @see https://eslint-react.xyz/docs/rules/web-api-no-leaked-timeout
2699
+ */
2700
+ 'react-web-api/no-leaked-timeout'?: Linter.RuleEntry<[]>
2677
2701
  /**
2678
2702
  * disallow using shorthand boolean attributes
2679
2703
  * @see https://eslint-react.xyz/docs/rules/avoid-shorthand-boolean
@@ -10286,6 +10310,10 @@ type Quotes = []|[("single" | "double" | "backtick")]|[("single" | "double" | "b
10286
10310
  })]
10287
10311
  // ----- radix -----
10288
10312
  type Radix = []|[("always" | "as-needed")]
10313
+ // ----- react-compiler/react-compiler -----
10314
+ type ReactCompilerReactCompiler = []|[{
10315
+ [k: string]: unknown | undefined
10316
+ }]
10289
10317
  // ----- react-dom/no-unknown-property -----
10290
10318
  type ReactDomNoUnknownProperty = []|[{
10291
10319
  ignore?: string[]
@@ -14413,6 +14441,7 @@ declare function getOverrides<K extends keyof OptionsConfig>(options: OptionsCon
14413
14441
  'quote-props'?: eslint.Linter.RuleEntry<undefined> | undefined;
14414
14442
  quotes?: eslint.Linter.RuleEntry<undefined> | undefined;
14415
14443
  radix?: eslint.Linter.RuleEntry<undefined> | undefined;
14444
+ 'react-compiler/react-compiler'?: eslint.Linter.RuleEntry<undefined> | undefined;
14416
14445
  'react-dom/no-children-in-void-dom-elements'?: eslint.Linter.RuleEntry<[]> | undefined;
14417
14446
  'react-dom/no-dangerously-set-innerhtml'?: eslint.Linter.RuleEntry<[]> | undefined;
14418
14447
  'react-dom/no-dangerously-set-innerhtml-with-children'?: eslint.Linter.RuleEntry<[]> | undefined;
@@ -14443,6 +14472,10 @@ declare function getOverrides<K extends keyof OptionsConfig>(options: OptionsCon
14443
14472
  'react-naming-convention/filename-extension'?: eslint.Linter.RuleEntry<undefined> | undefined;
14444
14473
  'react-naming-convention/use-state'?: eslint.Linter.RuleEntry<[]> | undefined;
14445
14474
  'react-refresh/only-export-components'?: eslint.Linter.RuleEntry<undefined> | undefined;
14475
+ 'react-web-api/no-leaked-event-listener'?: eslint.Linter.RuleEntry<[]> | undefined;
14476
+ 'react-web-api/no-leaked-interval'?: eslint.Linter.RuleEntry<[]> | undefined;
14477
+ 'react-web-api/no-leaked-resize-observer'?: eslint.Linter.RuleEntry<[]> | undefined;
14478
+ 'react-web-api/no-leaked-timeout'?: eslint.Linter.RuleEntry<[]> | undefined;
14446
14479
  'react/avoid-shorthand-boolean'?: eslint.Linter.RuleEntry<[]> | undefined;
14447
14480
  'react/avoid-shorthand-fragment'?: eslint.Linter.RuleEntry<[]> | undefined;
14448
14481
  'react/ensure-forward-ref-using-ref'?: eslint.Linter.RuleEntry<[]> | undefined;
package/dist/index.js CHANGED
@@ -653,9 +653,16 @@ var RemixPackages = [
653
653
  "@remix-run/serve",
654
654
  "@remix-run/dev"
655
655
  ];
656
+ var ReactRouterPackages = [
657
+ "@react-router/node",
658
+ "@react-router/react",
659
+ "@react-router/serve",
660
+ "@react-router/dev"
661
+ ];
656
662
  var NextJsPackages = ["next"];
657
663
  var ReactRefreshAllowConstantExportPackages = ["vite"];
658
664
  var isUsingRemix = hasPackages(RemixPackages);
665
+ var isUsingReactRouter = hasPackages(ReactRouterPackages);
659
666
  var isUsingNext = hasPackages(NextJsPackages);
660
667
  var isAllowConstantExport = hasPackages(
661
668
  ReactRefreshAllowConstantExportPackages
@@ -682,24 +689,30 @@ async function react(options = {}) {
682
689
  const typeAwareRules = {
683
690
  "react/no-leaked-conditional-rendering": "warn"
684
691
  };
685
- const [pluginReact, pluginReactHooks, pluginReactRefresh] = await Promise.all(
686
- [
687
- interopDefault(import("@eslint-react/eslint-plugin")),
688
- interopDefault(import("eslint-plugin-react-hooks")),
689
- interopDefault(import("eslint-plugin-react-refresh"))
690
- ]
691
- );
692
+ const [
693
+ pluginReact,
694
+ pluginReactHooks,
695
+ pluginReactRefresh,
696
+ pluginReactCompiler
697
+ ] = await Promise.all([
698
+ interopDefault(import("@eslint-react/eslint-plugin")),
699
+ interopDefault(import("eslint-plugin-react-hooks")),
700
+ interopDefault(import("eslint-plugin-react-refresh")),
701
+ interopDefault(import("eslint-plugin-react-compiler"))
702
+ ]);
692
703
  const plugins = pluginReact.configs.all.plugins;
693
704
  return [
694
705
  {
695
706
  name: "coderwyd/react/setup",
696
707
  plugins: {
697
708
  react: plugins["@eslint-react"],
709
+ "react-compiler": pluginReactCompiler,
698
710
  "react-dom": plugins["@eslint-react/dom"],
699
711
  "react-hooks": pluginReactHooks,
700
712
  "react-hooks-extra": plugins["@eslint-react/hooks-extra"],
701
713
  "react-naming-convention": plugins["@eslint-react/naming-convention"],
702
- "react-refresh": pluginReactRefresh
714
+ "react-refresh": pluginReactRefresh,
715
+ "react-web-api": plugins["@eslint-react/web-api"]
703
716
  }
704
717
  },
705
718
  {
@@ -714,6 +727,7 @@ async function react(options = {}) {
714
727
  },
715
728
  name: "coderwyd/react/rules",
716
729
  rules: {
730
+ "react-compiler/react-compiler": "warn",
717
731
  // recommended rules from @eslint-react/dom
718
732
  "react-dom/no-children-in-void-dom-elements": "warn",
719
733
  "react-dom/no-dangerously-set-innerhtml": "warn",
@@ -750,10 +764,15 @@ async function react(options = {}) {
750
764
  "viewport",
751
765
  "generateViewport"
752
766
  ] : [],
753
- ...isUsingRemix ? ["meta", "links", "headers", "loader", "action"] : []
767
+ ...isUsingRemix || isUsingReactRouter ? ["meta", "links", "headers", "loader", "action"] : []
754
768
  ]
755
769
  }
756
770
  ],
771
+ // recommended rules from @eslint-react/web-api
772
+ "react-web-api/no-leaked-event-listener": "warn",
773
+ "react-web-api/no-leaked-interval": "warn",
774
+ "react-web-api/no-leaked-resize-observer": "warn",
775
+ "react-web-api/no-leaked-timeout": "warn",
757
776
  // recommended rules from @eslint-react
758
777
  "react/ensure-forward-ref-using-ref": "warn",
759
778
  "react/jsx-no-duplicate-props": "warn",
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@coderwyd/eslint-config",
3
3
  "type": "module",
4
- "version": "3.5.0",
4
+ "version": "3.6.0",
5
5
  "description": "Donny's ESLint config",
6
6
  "author": "Donny Wang <donny526@outlook.com> (https://github.com/coderwyd/)",
7
7
  "license": "MIT",
@@ -38,6 +38,7 @@
38
38
  "@eslint-react/eslint-plugin": "^1.5.8",
39
39
  "@unocss/eslint-plugin": ">=0.50.0",
40
40
  "eslint": "^9.5.0",
41
+ "eslint-plugin-react-compiler": "^19.0.0-beta-decd7b8-20250118",
41
42
  "eslint-plugin-react-hooks": "^4.6.0 || ^5.0.0",
42
43
  "eslint-plugin-react-refresh": "^0.4.4",
43
44
  "eslint-plugin-svelte": ">=2.35.1",
@@ -51,6 +52,9 @@
51
52
  "@unocss/eslint-plugin": {
52
53
  "optional": true
53
54
  },
55
+ "eslint-plugin-react-compiler": {
56
+ "optional": true
57
+ },
54
58
  "eslint-plugin-react-hooks": {
55
59
  "optional": true
56
60
  },
@@ -110,6 +114,7 @@
110
114
  "@unocss/eslint-plugin": "^65.4.2",
111
115
  "bumpp": "^9.10.1",
112
116
  "eslint": "^9.18.0",
117
+ "eslint-plugin-react-compiler": "19.0.0-beta-decd7b8-20250118",
113
118
  "eslint-plugin-react-hooks": "^5.1.0",
114
119
  "eslint-plugin-react-refresh": "^0.4.18",
115
120
  "eslint-plugin-svelte": "^2.46.1",