@vp-tw/eslint-config 0.0.25 → 0.0.27

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/README.md CHANGED
@@ -56,6 +56,46 @@ pnpm -w v:major
56
56
  pnpm -r publish
57
57
  ```
58
58
 
59
+ ## Known Issues
60
+
61
+ ### `eslint-plugin-unicorn@^57.0.0`
62
+
63
+ Getting the following error when call `typegen`:
64
+
65
+ <!-- cSpell:disable -->
66
+
67
+ ```
68
+ /eslint-config/node_modules/.pnpm/eslint-plugin-unicorn@57.0.0_eslint@9.21.0_jiti@2.4.2_/node_modules/eslint-plugin-unicorn/rules…
69
+ │ atisIdentifierName,
70
+ │ at^
71
+ │ TypeError: Cannot destructure property 'isIdentifierName' of 'import_helper_validator_identifier.default' as it is undefined.
72
+ │ at resolveVariableName (/eslint-config/node_modules/.pnpm/eslint-plugin-unicorn@57.0.0_eslint@9.21.0_jiti@2.4.2_/node_modules…
73
+ │ at Object.<anonymous> (/eslint-config/node_modules/.pnpm/eslint-plugin-unicorn@57.0.0_eslint@9.21.0_jiti@2.4.2_/node_modules/…
74
+ │ at Module._compile (node:internal/modules/cjs/loader:1739:14)
75
+ │ at Object.transformer (/eslint-config/node_modules/.pnpm/tsx@4.19.3/node_modules/tsx/dist/register-DCnOAxY2.cjs:2:1186)
76
+ │ at Module.load (node:internal/modules/cjs/loader:1473:32)
77
+ │ at Function._load (node:internal/modules/cjs/loader:1285:12)
78
+ │ at TracingChannel.traceSync (node:diagnostics_channel:322:14)
79
+ │ at wrapModuleLoad (node:internal/modules/cjs/loader:234:24)
80
+ │ at Module.require (node:internal/modules/cjs/loader:1495:12)
81
+ │ at require (node:internal/modules/helpers:135:16)
82
+ ```
83
+
84
+ <!-- cSpell:enable -->
85
+
86
+ Workaround: downgrade `eslint-plugin-unicorn` to `^56.0.1`.
87
+
88
+ ```jsonc
89
+ // package.json
90
+ {
91
+ "pnpm": {
92
+ "overrides": {
93
+ "eslint-plugin-unicorn": "^56.0.1",
94
+ },
95
+ },
96
+ }
97
+ ```
98
+
59
99
  ## License
60
100
 
61
101
  MIT © ViPro <vdustr@gmail.com> (<http://vdustr.dev>)
@@ -99,5 +99,5 @@ type StorybookNoUninstalledAddons = []|[{
99
99
  [k: string]: unknown | undefined
100
100
  }]
101
101
  // Names of all the configs
102
- export type ConfigNames = 'vdustr/mdx/setup' | 'vdustr/mdx/processor' | 'vdustr/mdx/rules' | 'vdustr/mdx/code-blocks' | 'vdustr/prettier/rules' | 'vdustr/react/react-compiler/setup' | 'vdustr/react/react-compiler/rules' | 'vdustr/stroybook/setup' | 'vdustr/storybook/stories/rules' | 'vdustr/storybook/main/rules' | 'vdustr/javascript/rules' | 'vdustr/imports/rules' | 'vdustr/imports/no-default-export/rules' | 'vdustr/typescript/rules' | 'vdustr/react/rules' | 'vdustr/react/react-compiler/setup' | 'vdustr/react/react-compiler/rules' | 'vdustr/jsonc/rules' | 'vdustr/sort/json-keys' | 'vdustr/sort/json-array-values' | 'vdustr/sort/tsconfig-json' | 'vdustr/yaml/rules' | 'vdustr/yaml/sort-keys/rules'
102
+ export type ConfigNames = 'vdustr/mdx/setup' | 'vdustr/mdx/processor' | 'vdustr/mdx/rules' | 'vdustr/mdx/code-blocks' | 'vdustr/prettier/rules' | 'vdustr/react/react-compiler/setup' | 'vdustr/react/react-compiler/rules' | 'vdustr/stroybook/setup' | 'vdustr/storybook/stories/rules' | 'vdustr/storybook/main/rules' | 'vdustr/imports/rules' | 'vdustr/imports/no-default-export/rules' | 'vdustr/javascript/rules' | 'vdustr/jsonc/rules' | 'vdustr/sort/json-keys' | 'vdustr/sort/json-array-values' | 'vdustr/react/rules' | 'vdustr/react/react-compiler/setup' | 'vdustr/react/react-compiler/rules' | 'vdustr/typescript/rules' | 'vdustr/yaml/rules' | 'vdustr/yaml/sort-keys/rules'
103
103
 
@@ -99,5 +99,5 @@ type StorybookNoUninstalledAddons = []|[{
99
99
  [k: string]: unknown | undefined
100
100
  }]
101
101
  // Names of all the configs
102
- export type ConfigNames = 'vdustr/mdx/setup' | 'vdustr/mdx/processor' | 'vdustr/mdx/rules' | 'vdustr/mdx/code-blocks' | 'vdustr/prettier/rules' | 'vdustr/react/react-compiler/setup' | 'vdustr/react/react-compiler/rules' | 'vdustr/stroybook/setup' | 'vdustr/storybook/stories/rules' | 'vdustr/storybook/main/rules' | 'vdustr/javascript/rules' | 'vdustr/imports/rules' | 'vdustr/imports/no-default-export/rules' | 'vdustr/typescript/rules' | 'vdustr/react/rules' | 'vdustr/react/react-compiler/setup' | 'vdustr/react/react-compiler/rules' | 'vdustr/jsonc/rules' | 'vdustr/sort/json-keys' | 'vdustr/sort/json-array-values' | 'vdustr/sort/tsconfig-json' | 'vdustr/yaml/rules' | 'vdustr/yaml/sort-keys/rules'
102
+ export type ConfigNames = 'vdustr/mdx/setup' | 'vdustr/mdx/processor' | 'vdustr/mdx/rules' | 'vdustr/mdx/code-blocks' | 'vdustr/prettier/rules' | 'vdustr/react/react-compiler/setup' | 'vdustr/react/react-compiler/rules' | 'vdustr/stroybook/setup' | 'vdustr/storybook/stories/rules' | 'vdustr/storybook/main/rules' | 'vdustr/imports/rules' | 'vdustr/imports/no-default-export/rules' | 'vdustr/javascript/rules' | 'vdustr/jsonc/rules' | 'vdustr/sort/json-keys' | 'vdustr/sort/json-array-values' | 'vdustr/react/rules' | 'vdustr/react/react-compiler/setup' | 'vdustr/react/react-compiler/rules' | 'vdustr/typescript/rules' | 'vdustr/yaml/rules' | 'vdustr/yaml/sort-keys/rules'
103
103
 
@@ -5,6 +5,7 @@ declare namespace react {
5
5
  react?: ConfigOverrides;
6
6
  reactCompiler?: reactCompiler.Options["reactCompiler"];
7
7
  reactCompilerSetup?: reactCompiler.Options["setup"];
8
+ md?: ConfigOverrides;
8
9
  }
9
10
  }
10
11
  declare const react: (composer: VpComposer, options?: react.Options) => void;
@@ -1,5 +1,6 @@
1
1
  import { omit, pick } from "es-toolkit";
2
2
  import { reactCompiler } from "../configs/reactCompiler.mjs";
3
+ import { GLOB_REACT_IN_MD } from "../globs.mjs";
3
4
  import { extendsConfig } from "../utils/extendsConfig.mjs";
4
5
  import { mergeConfig } from "../utils/mergeConfig.mjs";
5
6
  import { ignoreKeys } from "./_utils.mjs";
@@ -27,7 +28,22 @@ const react = (composer, options) => {
27
28
  pick(omittedConfig, ["files", "ignores"])
28
29
  )
29
30
  });
30
- return [modifiedConfig, rulesConfig, ...reactCompilerConfigs];
31
+ const mdConfig = mergeConfig(
32
+ {
33
+ ...options?.md ?? {}
34
+ },
35
+ {
36
+ ...modifiedConfig,
37
+ name: "vdustr/react/md/rules",
38
+ files: [GLOB_REACT_IN_MD],
39
+ rules: {
40
+ "react-compiler/react-compiler": "off",
41
+ "react-hooks/rules-of-hooks": "off",
42
+ "react-refresh/only-export-components": "off"
43
+ }
44
+ }
45
+ );
46
+ return [modifiedConfig, rulesConfig, ...reactCompilerConfigs, mdConfig];
31
47
  });
32
48
  };
33
49
  export { react };
@@ -3,5 +3,9 @@ declare const GLOB_PACKAGE_JSON: string;
3
3
  declare const GLOB_PNPM_WORKSPACE_YAML: string;
4
4
  declare const GLOB_CSPELL_JSON: string;
5
5
  declare const GLOB_CONFIG_JS: string;
6
+ /**
7
+ * Glob pattern for React files in Markdown files, including MDX.
8
+ */
9
+ declare const GLOB_REACT_IN_MD: string;
6
10
  declare const GLOB_VITEST_WORKSPACE: string;
7
- export { GLOB_CODE_WORKSPACE, GLOB_CONFIG_JS, GLOB_CSPELL_JSON, GLOB_PACKAGE_JSON, GLOB_PNPM_WORKSPACE_YAML, GLOB_VITEST_WORKSPACE, };
11
+ export { GLOB_CODE_WORKSPACE, GLOB_CONFIG_JS, GLOB_CSPELL_JSON, GLOB_PACKAGE_JSON, GLOB_PNPM_WORKSPACE_YAML, GLOB_REACT_IN_MD, GLOB_VITEST_WORKSPACE, };
@@ -3,6 +3,7 @@ const GLOB_PACKAGE_JSON = "**/package.json";
3
3
  const GLOB_PNPM_WORKSPACE_YAML = "**/pnpm-workspace.y?(a)ml";
4
4
  const GLOB_CSPELL_JSON = "**/cspell.json";
5
5
  const GLOB_CONFIG_JS = "**/*.config.?([cm])[jt]s";
6
+ const GLOB_REACT_IN_MD = "**/*.md?(x)/**/*.?([mc])[jt]s?(x)";
6
7
  const GLOB_VITEST_WORKSPACE = "**/vitest.workspace.?([cm])[jt]s";
7
8
  export {
8
9
  GLOB_CODE_WORKSPACE,
@@ -10,5 +11,6 @@ export {
10
11
  GLOB_CSPELL_JSON,
11
12
  GLOB_PACKAGE_JSON,
12
13
  GLOB_PNPM_WORKSPACE_YAML,
14
+ GLOB_REACT_IN_MD,
13
15
  GLOB_VITEST_WORKSPACE
14
16
  };
@@ -41,7 +41,9 @@ function extendsConfigInternal(composer, sourceOrIndex, config) {
41
41
  const awaited = typeof config === "function" ? await config(source) : await config;
42
42
  return Array.isArray(awaited) ? awaited : [awaited];
43
43
  })();
44
- return items.toSpliced(index, 1, ...newConfigs);
44
+ const updatedItems = [...items];
45
+ updatedItems.splice(index, 1, ...newConfigs);
46
+ return updatedItems;
45
47
  }
46
48
  ]);
47
49
  }
@@ -2,7 +2,7 @@ import { omit } from "es-toolkit";
2
2
  const objectMergeKeys = ["rules", "plugins"];
3
3
  const mutableMergeKeys = ["files", "ignores"];
4
4
  function mergeConfig(source, ...[def, ...defs]) {
5
- const reversedDefs = [def, ...defs].toReversed();
5
+ const reversedDefs = [def, ...defs].reverse();
6
6
  const mergedDef = {
7
7
  ...Object.fromEntries(reversedDefs.flatMap((def2) => Object.entries(def2))),
8
8
  ...Object.fromEntries(
@@ -5,6 +5,7 @@ declare namespace react {
5
5
  react?: ConfigOverrides;
6
6
  reactCompiler?: reactCompiler.Options["reactCompiler"];
7
7
  reactCompilerSetup?: reactCompiler.Options["setup"];
8
+ md?: ConfigOverrides;
8
9
  }
9
10
  }
10
11
  declare const react: (composer: VpComposer, options?: react.Options) => void;
@@ -6,6 +6,7 @@ Object.defineProperty(exports, "__esModule", {
6
6
  exports.react = void 0;
7
7
  var _esToolkit = require("es-toolkit");
8
8
  var _reactCompiler = require("../configs/reactCompiler");
9
+ var _globs = require("../globs");
9
10
  var _extendsConfig = require("../utils/extendsConfig");
10
11
  var _mergeConfig = require("../utils/mergeConfig");
11
12
  var _utils = require("./_utils");
@@ -23,7 +24,19 @@ const react = (composer, options) => {
23
24
  setup: options?.reactCompilerSetup ?? {},
24
25
  reactCompiler: (0, _mergeConfig.mergeConfig)(options?.reactCompiler, (0, _esToolkit.pick)(omittedConfig, ["files", "ignores"]))
25
26
  });
26
- return [modifiedConfig, rulesConfig, ...reactCompilerConfigs];
27
+ const mdConfig = (0, _mergeConfig.mergeConfig)({
28
+ ...(options?.md ?? {})
29
+ }, {
30
+ ...modifiedConfig,
31
+ name: "vdustr/react/md/rules",
32
+ files: [_globs.GLOB_REACT_IN_MD],
33
+ rules: {
34
+ "react-compiler/react-compiler": "off",
35
+ "react-hooks/rules-of-hooks": "off",
36
+ "react-refresh/only-export-components": "off"
37
+ }
38
+ });
39
+ return [modifiedConfig, rulesConfig, ...reactCompilerConfigs, mdConfig];
27
40
  });
28
41
  };
29
42
  exports.react = react;
package/dist/globs.d.ts CHANGED
@@ -3,5 +3,9 @@ declare const GLOB_PACKAGE_JSON: string;
3
3
  declare const GLOB_PNPM_WORKSPACE_YAML: string;
4
4
  declare const GLOB_CSPELL_JSON: string;
5
5
  declare const GLOB_CONFIG_JS: string;
6
+ /**
7
+ * Glob pattern for React files in Markdown files, including MDX.
8
+ */
9
+ declare const GLOB_REACT_IN_MD: string;
6
10
  declare const GLOB_VITEST_WORKSPACE: string;
7
- export { GLOB_CODE_WORKSPACE, GLOB_CONFIG_JS, GLOB_CSPELL_JSON, GLOB_PACKAGE_JSON, GLOB_PNPM_WORKSPACE_YAML, GLOB_VITEST_WORKSPACE, };
11
+ export { GLOB_CODE_WORKSPACE, GLOB_CONFIG_JS, GLOB_CSPELL_JSON, GLOB_PACKAGE_JSON, GLOB_PNPM_WORKSPACE_YAML, GLOB_REACT_IN_MD, GLOB_VITEST_WORKSPACE, };
package/dist/globs.js CHANGED
@@ -3,10 +3,11 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
- exports.GLOB_VITEST_WORKSPACE = exports.GLOB_PNPM_WORKSPACE_YAML = exports.GLOB_PACKAGE_JSON = exports.GLOB_CSPELL_JSON = exports.GLOB_CONFIG_JS = exports.GLOB_CODE_WORKSPACE = void 0;
6
+ exports.GLOB_VITEST_WORKSPACE = exports.GLOB_REACT_IN_MD = exports.GLOB_PNPM_WORKSPACE_YAML = exports.GLOB_PACKAGE_JSON = exports.GLOB_CSPELL_JSON = exports.GLOB_CONFIG_JS = exports.GLOB_CODE_WORKSPACE = void 0;
7
7
  const GLOB_CODE_WORKSPACE = exports.GLOB_CODE_WORKSPACE = "**/*.code-workspace";
8
8
  const GLOB_PACKAGE_JSON = exports.GLOB_PACKAGE_JSON = "**/package.json";
9
9
  const GLOB_PNPM_WORKSPACE_YAML = exports.GLOB_PNPM_WORKSPACE_YAML = "**/pnpm-workspace.y?(a)ml";
10
10
  const GLOB_CSPELL_JSON = exports.GLOB_CSPELL_JSON = "**/cspell.json";
11
11
  const GLOB_CONFIG_JS = exports.GLOB_CONFIG_JS = "**/*.config.?([cm])[jt]s";
12
+ const GLOB_REACT_IN_MD = exports.GLOB_REACT_IN_MD = "**/*.md?(x)/**/*.?([mc])[jt]s?(x)";
12
13
  const GLOB_VITEST_WORKSPACE = exports.GLOB_VITEST_WORKSPACE = "**/vitest.workspace.?([cm])[jt]s";
@@ -39,7 +39,9 @@ function extendsConfigInternal(composer, sourceOrIndex, config) {
39
39
  const awaited = typeof config === "function" ? await config(source) : await config;
40
40
  return Array.isArray(awaited) ? awaited : [awaited];
41
41
  })();
42
- return items.toSpliced(index, 1, ...newConfigs);
42
+ const updatedItems = [...items];
43
+ updatedItems.splice(index, 1, ...newConfigs);
44
+ return updatedItems;
43
45
  }]);
44
46
  }
45
47
  const extendsConfig = exports.extendsConfig = Object.assign(extendsConfigInternal, {
@@ -8,7 +8,7 @@ var _esToolkit = require("es-toolkit");
8
8
  const objectMergeKeys = ["rules", "plugins"];
9
9
  const mutableMergeKeys = ["files", "ignores"];
10
10
  function mergeConfig(source, ...[def, ...defs]) {
11
- const reversedDefs = [def, ...defs].toReversed();
11
+ const reversedDefs = [def, ...defs].reverse();
12
12
  const mergedDef = {
13
13
  ...Object.fromEntries(reversedDefs.flatMap(def2 => Object.entries(def2))),
14
14
  ...Object.fromEntries(objectMergeKeys.flatMap(key => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vp-tw/eslint-config",
3
- "version": "0.0.25",
3
+ "version": "0.0.27",
4
4
  "description": "ViPro's ESLint configuration",
5
5
  "homepage": "https://github.com/vdustr/eslint-config",
6
6
  "author": {
@@ -40,23 +40,23 @@
40
40
  ],
41
41
  "dependencies": {
42
42
  "@mui/types": "^7.2.21",
43
- "es-toolkit": "^1.31.0",
44
- "eslint-flat-config-utils": "^2.0.0",
45
- "local-pkg": "^1.0.0"
43
+ "es-toolkit": "^1.32.0",
44
+ "eslint-flat-config-utils": "^2.0.1",
45
+ "local-pkg": "^1.1.0"
46
46
  },
47
47
  "devDependencies": {
48
- "eslint-typegen": "^1.0.0",
48
+ "eslint-typegen": "^2.0.0",
49
49
  "unbuild": "^3.3.1"
50
50
  },
51
51
  "peerDependencies": {
52
- "@antfu/eslint-config": "^4.1.0",
52
+ "@antfu/eslint-config": "^4.3.0",
53
53
  "@types/eslint-config-prettier": "^6.11.3",
54
- "eslint": "^9.19.0",
55
- "eslint-config-prettier": "^10.0.1",
54
+ "eslint": "^9.21.0",
55
+ "eslint-config-prettier": "^10.0.2",
56
56
  "eslint-plugin-mdx": "^3.1.5",
57
- "eslint-plugin-package-json": "^0.21.1",
58
- "eslint-plugin-react-compiler": "^19.0.0-beta-27714ef-20250124",
59
- "eslint-plugin-storybook": "^0.11.2"
57
+ "eslint-plugin-package-json": "^0.26.0",
58
+ "eslint-plugin-react-compiler": "^19.0.0-beta-e1e972c-20250221",
59
+ "eslint-plugin-storybook": "^0.11.3"
60
60
  },
61
61
  "peerDependenciesMeta": {
62
62
  "@types/eslint-config-prettier": {