react-doctor 0.0.45 → 0.0.46

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 (3) hide show
  1. package/dist/cli.js +31 -28
  2. package/dist/index.js +30 -27
  3. package/package.json +1 -1
package/dist/cli.js CHANGED
@@ -1761,14 +1761,14 @@ const REACT_COMPILER_RULES = {
1761
1761
  "react-hooks-js/todo": "warn"
1762
1762
  };
1763
1763
  const resolveReactHooksJsPlugin = (hasReactCompiler, customRulesOnly) => {
1764
- if (!hasReactCompiler || customRulesOnly) return [];
1764
+ if (!hasReactCompiler || customRulesOnly) return null;
1765
1765
  try {
1766
- return [{
1766
+ return {
1767
1767
  name: "react-hooks-js",
1768
1768
  specifier: esmRequire$1.resolve("eslint-plugin-react-hooks")
1769
- }];
1769
+ };
1770
1770
  } catch {
1771
- return [];
1771
+ return null;
1772
1772
  }
1773
1773
  };
1774
1774
  const TANSTACK_QUERY_RULES = {
@@ -1915,29 +1915,32 @@ const ALL_REACT_DOCTOR_RULE_KEYS = new Set([
1915
1915
  ...Object.keys(TANSTACK_START_RULES),
1916
1916
  ...Object.keys(TANSTACK_QUERY_RULES)
1917
1917
  ]);
1918
- const createOxlintConfig = ({ pluginPath, framework, hasReactCompiler, hasTanStackQuery, customRulesOnly = false }) => ({
1919
- categories: {
1920
- correctness: "off",
1921
- suspicious: "off",
1922
- pedantic: "off",
1923
- perf: "off",
1924
- restriction: "off",
1925
- style: "off",
1926
- nursery: "off"
1927
- },
1928
- plugins: customRulesOnly ? [] : ["react", "jsx-a11y"],
1929
- jsPlugins: [...resolveReactHooksJsPlugin(hasReactCompiler, customRulesOnly), pluginPath],
1930
- rules: {
1931
- ...customRulesOnly ? {} : BUILTIN_REACT_RULES,
1932
- ...customRulesOnly ? {} : BUILTIN_A11Y_RULES,
1933
- ...hasReactCompiler && !customRulesOnly ? REACT_COMPILER_RULES : {},
1934
- ...GLOBAL_REACT_DOCTOR_RULES,
1935
- ...framework === "nextjs" ? NEXTJS_RULES : {},
1936
- ...framework === "expo" || framework === "react-native" ? REACT_NATIVE_RULES : {},
1937
- ...framework === "tanstack-start" ? TANSTACK_START_RULES : {},
1938
- ...hasTanStackQuery ? TANSTACK_QUERY_RULES : {}
1939
- }
1940
- });
1918
+ const createOxlintConfig = ({ pluginPath, framework, hasReactCompiler, hasTanStackQuery, customRulesOnly = false }) => {
1919
+ const reactHooksJsPlugin = resolveReactHooksJsPlugin(hasReactCompiler, customRulesOnly);
1920
+ return {
1921
+ categories: {
1922
+ correctness: "off",
1923
+ suspicious: "off",
1924
+ pedantic: "off",
1925
+ perf: "off",
1926
+ restriction: "off",
1927
+ style: "off",
1928
+ nursery: "off"
1929
+ },
1930
+ plugins: customRulesOnly ? [] : ["react", "jsx-a11y"],
1931
+ jsPlugins: reactHooksJsPlugin ? [reactHooksJsPlugin, pluginPath] : [pluginPath],
1932
+ rules: {
1933
+ ...customRulesOnly ? {} : BUILTIN_REACT_RULES,
1934
+ ...customRulesOnly ? {} : BUILTIN_A11Y_RULES,
1935
+ ...reactHooksJsPlugin ? REACT_COMPILER_RULES : {},
1936
+ ...GLOBAL_REACT_DOCTOR_RULES,
1937
+ ...framework === "nextjs" ? NEXTJS_RULES : {},
1938
+ ...framework === "expo" || framework === "react-native" ? REACT_NATIVE_RULES : {},
1939
+ ...framework === "tanstack-start" ? TANSTACK_START_RULES : {},
1940
+ ...hasTanStackQuery ? TANSTACK_QUERY_RULES : {}
1941
+ }
1942
+ };
1943
+ };
1941
1944
  //#endregion
1942
1945
  //#region src/utils/neutralize-disable-directives.ts
1943
1946
  const DISABLE_DIRECTIVE_PATTERN = /(eslint|oxlint)-disable/;
@@ -3330,7 +3333,7 @@ const promptProjectSelection = async (workspacePackages, rootDirectory) => {
3330
3333
  };
3331
3334
  //#endregion
3332
3335
  //#region src/cli.ts
3333
- const VERSION = "0.0.45";
3336
+ const VERSION = "0.0.46";
3334
3337
  const VALID_FAIL_ON_LEVELS = new Set([
3335
3338
  "error",
3336
3339
  "warning",
package/dist/index.js CHANGED
@@ -1513,14 +1513,14 @@ const REACT_COMPILER_RULES = {
1513
1513
  "react-hooks-js/todo": "warn"
1514
1514
  };
1515
1515
  const resolveReactHooksJsPlugin = (hasReactCompiler, customRulesOnly) => {
1516
- if (!hasReactCompiler || customRulesOnly) return [];
1516
+ if (!hasReactCompiler || customRulesOnly) return null;
1517
1517
  try {
1518
- return [{
1518
+ return {
1519
1519
  name: "react-hooks-js",
1520
1520
  specifier: esmRequire$1.resolve("eslint-plugin-react-hooks")
1521
- }];
1521
+ };
1522
1522
  } catch {
1523
- return [];
1523
+ return null;
1524
1524
  }
1525
1525
  };
1526
1526
  const TANSTACK_QUERY_RULES = {
@@ -1667,29 +1667,32 @@ const ALL_REACT_DOCTOR_RULE_KEYS = new Set([
1667
1667
  ...Object.keys(TANSTACK_START_RULES),
1668
1668
  ...Object.keys(TANSTACK_QUERY_RULES)
1669
1669
  ]);
1670
- const createOxlintConfig = ({ pluginPath, framework, hasReactCompiler, hasTanStackQuery, customRulesOnly = false }) => ({
1671
- categories: {
1672
- correctness: "off",
1673
- suspicious: "off",
1674
- pedantic: "off",
1675
- perf: "off",
1676
- restriction: "off",
1677
- style: "off",
1678
- nursery: "off"
1679
- },
1680
- plugins: customRulesOnly ? [] : ["react", "jsx-a11y"],
1681
- jsPlugins: [...resolveReactHooksJsPlugin(hasReactCompiler, customRulesOnly), pluginPath],
1682
- rules: {
1683
- ...customRulesOnly ? {} : BUILTIN_REACT_RULES,
1684
- ...customRulesOnly ? {} : BUILTIN_A11Y_RULES,
1685
- ...hasReactCompiler && !customRulesOnly ? REACT_COMPILER_RULES : {},
1686
- ...GLOBAL_REACT_DOCTOR_RULES,
1687
- ...framework === "nextjs" ? NEXTJS_RULES : {},
1688
- ...framework === "expo" || framework === "react-native" ? REACT_NATIVE_RULES : {},
1689
- ...framework === "tanstack-start" ? TANSTACK_START_RULES : {},
1690
- ...hasTanStackQuery ? TANSTACK_QUERY_RULES : {}
1691
- }
1692
- });
1670
+ const createOxlintConfig = ({ pluginPath, framework, hasReactCompiler, hasTanStackQuery, customRulesOnly = false }) => {
1671
+ const reactHooksJsPlugin = resolveReactHooksJsPlugin(hasReactCompiler, customRulesOnly);
1672
+ return {
1673
+ categories: {
1674
+ correctness: "off",
1675
+ suspicious: "off",
1676
+ pedantic: "off",
1677
+ perf: "off",
1678
+ restriction: "off",
1679
+ style: "off",
1680
+ nursery: "off"
1681
+ },
1682
+ plugins: customRulesOnly ? [] : ["react", "jsx-a11y"],
1683
+ jsPlugins: reactHooksJsPlugin ? [reactHooksJsPlugin, pluginPath] : [pluginPath],
1684
+ rules: {
1685
+ ...customRulesOnly ? {} : BUILTIN_REACT_RULES,
1686
+ ...customRulesOnly ? {} : BUILTIN_A11Y_RULES,
1687
+ ...reactHooksJsPlugin ? REACT_COMPILER_RULES : {},
1688
+ ...GLOBAL_REACT_DOCTOR_RULES,
1689
+ ...framework === "nextjs" ? NEXTJS_RULES : {},
1690
+ ...framework === "expo" || framework === "react-native" ? REACT_NATIVE_RULES : {},
1691
+ ...framework === "tanstack-start" ? TANSTACK_START_RULES : {},
1692
+ ...hasTanStackQuery ? TANSTACK_QUERY_RULES : {}
1693
+ }
1694
+ };
1695
+ };
1693
1696
  //#endregion
1694
1697
  //#region src/utils/neutralize-disable-directives.ts
1695
1698
  const DISABLE_DIRECTIVE_PATTERN = /(eslint|oxlint)-disable/;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "react-doctor",
3
- "version": "0.0.45",
3
+ "version": "0.0.46",
4
4
  "description": "Diagnose and fix React codebases for security, performance, correctness, accessibility, bundle-size, and architecture issues",
5
5
  "keywords": [
6
6
  "accessibility",