@coderwyd/eslint-config 3.3.0 → 3.4.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,31 +37,31 @@ 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.3.0";
40
+ var version = "3.4.0";
41
41
  var devDependencies = {
42
42
  "@antfu/ni": "^0.23.1",
43
- "@eslint-react/eslint-plugin": "^1.17.3",
44
- "@eslint/config-inspector": "^0.5.6",
43
+ "@eslint-react/eslint-plugin": "^1.19.0",
44
+ "@eslint/config-inspector": "^0.6.0",
45
45
  "@types/eslint-config-prettier": "^6.11.3",
46
46
  "@types/fs-extra": "^11.0.4",
47
- "@types/node": "^22.10.1",
47
+ "@types/node": "^22.10.2",
48
48
  "@types/prompts": "^2.4.9",
49
49
  "@types/yargs": "^17.0.33",
50
- "@unocss/eslint-plugin": "^0.65.0",
51
- bumpp: "^9.8.1",
52
- eslint: "^9.16.0",
53
- "eslint-plugin-react-hooks": "^5.0.0",
50
+ "@unocss/eslint-plugin": "^0.65.1",
51
+ bumpp: "^9.9.1",
52
+ eslint: "^9.17.0",
53
+ "eslint-plugin-react-hooks": "^5.1.0",
54
54
  "eslint-plugin-react-refresh": "^0.4.16",
55
55
  "eslint-plugin-svelte": "^2.46.1",
56
56
  "eslint-plugin-tailwindcss": "^3.17.5",
57
- execa: "^9.5.1",
57
+ execa: "^9.5.2",
58
58
  "fast-glob": "^3.3.2",
59
59
  "fs-extra": "^11.2.0",
60
60
  jiti: "^2.4.1",
61
- "lint-staged": "^15.2.10",
61
+ "lint-staged": "^15.2.11",
62
62
  rimraf: "^6.0.1",
63
63
  "simple-git-hooks": "^2.11.1",
64
- svelte: "^5.5.3",
64
+ svelte: "^5.14.0",
65
65
  "svelte-eslint-parser": "^0.43.0",
66
66
  tsup: "^8.3.5",
67
67
  tsx: "^4.19.2",
package/dist/cli.js CHANGED
@@ -8,31 +8,31 @@ import { hideBin } from "yargs/helpers";
8
8
  import c from "picocolors";
9
9
 
10
10
  // package.json
11
- var version = "3.3.0";
11
+ var version = "3.4.0";
12
12
  var devDependencies = {
13
13
  "@antfu/ni": "^0.23.1",
14
- "@eslint-react/eslint-plugin": "^1.17.3",
15
- "@eslint/config-inspector": "^0.5.6",
14
+ "@eslint-react/eslint-plugin": "^1.19.0",
15
+ "@eslint/config-inspector": "^0.6.0",
16
16
  "@types/eslint-config-prettier": "^6.11.3",
17
17
  "@types/fs-extra": "^11.0.4",
18
- "@types/node": "^22.10.1",
18
+ "@types/node": "^22.10.2",
19
19
  "@types/prompts": "^2.4.9",
20
20
  "@types/yargs": "^17.0.33",
21
- "@unocss/eslint-plugin": "^0.65.0",
22
- bumpp: "^9.8.1",
23
- eslint: "^9.16.0",
24
- "eslint-plugin-react-hooks": "^5.0.0",
21
+ "@unocss/eslint-plugin": "^0.65.1",
22
+ bumpp: "^9.9.1",
23
+ eslint: "^9.17.0",
24
+ "eslint-plugin-react-hooks": "^5.1.0",
25
25
  "eslint-plugin-react-refresh": "^0.4.16",
26
26
  "eslint-plugin-svelte": "^2.46.1",
27
27
  "eslint-plugin-tailwindcss": "^3.17.5",
28
- execa: "^9.5.1",
28
+ execa: "^9.5.2",
29
29
  "fast-glob": "^3.3.2",
30
30
  "fs-extra": "^11.2.0",
31
31
  jiti: "^2.4.1",
32
- "lint-staged": "^15.2.10",
32
+ "lint-staged": "^15.2.11",
33
33
  rimraf: "^6.0.1",
34
34
  "simple-git-hooks": "^2.11.1",
35
- svelte: "^5.5.3",
35
+ svelte: "^5.14.0",
36
36
  "svelte-eslint-parser": "^0.43.0",
37
37
  tsup: "^8.3.5",
38
38
  tsx: "^4.19.2",
package/dist/index.cjs CHANGED
@@ -48,7 +48,7 @@ __export(src_exports, {
48
48
  });
49
49
  module.exports = __toCommonJS(src_exports);
50
50
 
51
- // node_modules/.pnpm/tsup@8.3.5_jiti@2.4.1_postcss@8.4.47_tsx@4.19.2_typescript@5.7.2_yaml@2.5.0/node_modules/tsup/assets/cjs_shims.js
51
+ // node_modules/.pnpm/tsup@8.3.5_jiti@2.4.1_postcss@8.4.47_tsx@4.19.2_typescript@5.7.2_yaml@2.6.1/node_modules/tsup/assets/cjs_shims.js
52
52
  var getImportMetaUrl = () => typeof document === "undefined" ? new URL(`file:${__filename}`).href : document.currentScript && document.currentScript.src || new URL("main.js", document.baseURI).href;
53
53
  var importMetaUrl = /* @__PURE__ */ getImportMetaUrl();
54
54
 
@@ -681,27 +681,19 @@ function perfectionist() {
681
681
  // src/configs/prettier.ts
682
682
  var import_eslint_config_prettier = __toESM(require("eslint-config-prettier"), 1);
683
683
  var { rules: eslintRules } = import_eslint_config_prettier.default;
684
- async function prettier() {
685
- const pluginPrettier = await interopDefault(import("eslint-plugin-prettier"));
684
+ function prettier() {
686
685
  return [
687
686
  {
688
687
  name: "coderwyd/prettier/rules",
689
- plugins: {
690
- prettier: pluginPrettier
691
- },
692
688
  rules: {
693
689
  ...eslintRules,
694
690
  "arrow-body-style": "off",
695
- "prefer-arrow-callback": "off",
696
- "prettier/prettier": "warn"
691
+ "prefer-arrow-callback": "off"
697
692
  }
698
693
  }
699
694
  ];
700
695
  }
701
696
 
702
- // src/configs/react.ts
703
- var import_local_pkg3 = require("local-pkg");
704
-
705
697
  // src/env.ts
706
698
  var import_node_process2 = __toESM(require("process"), 1);
707
699
  var import_local_pkg2 = require("local-pkg");
@@ -716,31 +708,40 @@ var RemixPackages = [
716
708
  "@remix-run/dev"
717
709
  ];
718
710
  var NextJsPackages = ["next"];
711
+ var ReactRefreshAllowConstantExportPackages = ["vite"];
719
712
  var isUsingRemix = hasPackages(RemixPackages);
720
713
  var isUsingNext = hasPackages(NextJsPackages);
714
+ var isAllowConstantExport = hasPackages(
715
+ ReactRefreshAllowConstantExportPackages
716
+ );
721
717
  function hasPackages(packages) {
722
718
  return packages.some((name) => (0, import_local_pkg2.isPackageExists)(name));
723
719
  }
724
720
 
725
721
  // src/configs/react.ts
726
- var ReactRefreshAllowConstantExportPackages = ["vite"];
727
722
  async function react(options = {}) {
728
- const { files = [GLOB_SRC], overrides = {} } = options;
723
+ const {
724
+ files = [GLOB_SRC],
725
+ filesTypeAware = [GLOB_TS, GLOB_TSX],
726
+ ignoresTypeAware = [`${GLOB_MARKDOWN}/**`, GLOB_ASTRO_TS],
727
+ overrides = {},
728
+ tsconfigPath
729
+ } = options;
729
730
  await ensurePackages([
730
731
  "@eslint-react/eslint-plugin",
731
732
  "eslint-plugin-react-hooks",
732
733
  "eslint-plugin-react-refresh"
733
734
  ]);
734
- const tsconfigPath = options?.tsconfigPath ? toArray(options.tsconfigPath) : void 0;
735
735
  const isTypeAware = !!tsconfigPath;
736
- const [pluginReact, pluginReactHooks, pluginReactRefresh, parserTs] = await Promise.all([
737
- interopDefault(import("@eslint-react/eslint-plugin")),
738
- interopDefault(import("eslint-plugin-react-hooks")),
739
- interopDefault(import("eslint-plugin-react-refresh")),
740
- interopDefault(import("@typescript-eslint/parser"))
741
- ]);
742
- const isAllowConstantExport = ReactRefreshAllowConstantExportPackages.some(
743
- (i) => (0, import_local_pkg3.isPackageExists)(i)
736
+ const typeAwareRules = {
737
+ "react/no-leaked-conditional-rendering": "warn"
738
+ };
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
+ ]
744
745
  );
745
746
  const plugins = pluginReact.configs.all.plugins;
746
747
  return [
@@ -758,12 +759,10 @@ async function react(options = {}) {
758
759
  {
759
760
  files,
760
761
  languageOptions: {
761
- parser: parserTs,
762
762
  parserOptions: {
763
763
  ecmaFeatures: {
764
764
  jsx: true
765
- },
766
- ...isTypeAware ? { project: tsconfigPath } : {}
765
+ }
767
766
  },
768
767
  sourceType: "module"
769
768
  },
@@ -811,25 +810,30 @@ async function react(options = {}) {
811
810
  ],
812
811
  // recommended rules from @eslint-react
813
812
  "react/ensure-forward-ref-using-ref": "warn",
813
+ "react/jsx-no-duplicate-props": "warn",
814
+ "react/jsx-uses-vars": "warn",
814
815
  "react/no-access-state-in-setstate": "error",
815
816
  "react/no-array-index-key": "warn",
816
817
  "react/no-children-count": "warn",
817
818
  "react/no-children-for-each": "warn",
818
819
  "react/no-children-map": "warn",
819
820
  "react/no-children-only": "warn",
820
- "react/no-children-prop": "warn",
821
821
  "react/no-children-to-array": "warn",
822
822
  "react/no-clone-element": "warn",
823
823
  "react/no-comment-textnodes": "warn",
824
824
  "react/no-component-will-mount": "error",
825
825
  "react/no-component-will-receive-props": "error",
826
826
  "react/no-component-will-update": "error",
827
+ "react/no-context-provider": "warn",
827
828
  "react/no-create-ref": "error",
829
+ "react/no-default-props": "error",
828
830
  "react/no-direct-mutation-state": "error",
829
831
  "react/no-duplicate-key": "error",
830
- "react/no-implicit-key": "error",
832
+ "react/no-forward-ref": "warn",
833
+ "react/no-implicit-key": "warn",
831
834
  "react/no-missing-key": "error",
832
- "react/no-nested-components": "warn",
835
+ "react/no-nested-components": "error",
836
+ "react/no-prop-types": "error",
833
837
  "react/no-redundant-should-component-update": "error",
834
838
  "react/no-set-state-in-component-did-mount": "warn",
835
839
  "react/no-set-state-in-component-did-update": "warn",
@@ -838,21 +842,27 @@ async function react(options = {}) {
838
842
  "react/no-unsafe-component-will-mount": "warn",
839
843
  "react/no-unsafe-component-will-receive-props": "warn",
840
844
  "react/no-unsafe-component-will-update": "warn",
841
- "react/no-unstable-context-value": "error",
842
- "react/no-unstable-default-props": "error",
845
+ "react/no-unstable-context-value": "warn",
846
+ "react/no-unstable-default-props": "warn",
843
847
  "react/no-unused-class-component-members": "warn",
844
848
  "react/no-unused-state": "warn",
845
- "react/no-useless-fragment": "warn",
846
849
  "react/prefer-destructuring-assignment": "warn",
847
850
  "react/prefer-shorthand-boolean": "warn",
848
851
  "react/prefer-shorthand-fragment": "warn",
849
- ...isTypeAware ? {
850
- "react/no-leaked-conditional-rendering": "warn"
851
- } : {},
852
852
  // overrides
853
853
  ...overrides
854
854
  }
855
- }
855
+ },
856
+ ...isTypeAware ? [
857
+ {
858
+ files: filesTypeAware,
859
+ ignores: ignoresTypeAware,
860
+ name: "coderwyd/react/type-aware-rules",
861
+ rules: {
862
+ ...typeAwareRules
863
+ }
864
+ }
865
+ ] : []
856
866
  ];
857
867
  }
858
868