@vp-tw/eslint-config 0.0.27 → 0.0.29

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,46 +56,6 @@ 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
-
99
59
  ## License
100
60
 
101
61
  MIT © ViPro <vdustr@gmail.com> (<http://vdustr.dev>)
@@ -72,7 +72,7 @@ export interface RuleOptions {
72
72
  */
73
73
  'storybook/story-exports'?: Linter.RuleEntry<[]>
74
74
  /**
75
- * Use expect from `@storybook/test` or `@storybook/jest`
75
+ * Use expect from `@storybook/test`, `storybook/test` or `@storybook/jest`
76
76
  * @see https://github.com/storybookjs/eslint-plugin-storybook/blob/main/docs/rules/use-storybook-expect.md
77
77
  */
78
78
  'storybook/use-storybook-expect'?: Linter.RuleEntry<[]>
@@ -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/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'
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/react/md/rules' | 'vdustr/typescript/rules' | 'vdustr/yaml/rules' | 'vdustr/yaml/sort-keys/rules'
103
103
 
@@ -72,7 +72,7 @@ export interface RuleOptions {
72
72
  */
73
73
  'storybook/story-exports'?: Linter.RuleEntry<[]>
74
74
  /**
75
- * Use expect from `@storybook/test` or `@storybook/jest`
75
+ * Use expect from `@storybook/test`, `storybook/test` or `@storybook/jest`
76
76
  * @see https://github.com/storybookjs/eslint-plugin-storybook/blob/main/docs/rules/use-storybook-expect.md
77
77
  */
78
78
  'storybook/use-storybook-expect'?: Linter.RuleEntry<[]>
@@ -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/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'
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/react/md/rules' | 'vdustr/typescript/rules' | 'vdustr/yaml/rules' | 'vdustr/yaml/sort-keys/rules'
103
103
 
@@ -1,6 +1,7 @@
1
+ import { GLOB_MARKDOWN_CODE } from "@antfu/eslint-config";
1
2
  import { omit, pick } from "es-toolkit";
2
3
  import { reactCompiler } from "../configs/reactCompiler.mjs";
3
- import { GLOB_REACT_IN_MD } from "../globs.mjs";
4
+ import { GLOB_MDX_CODE } from "../globs.mjs";
4
5
  import { extendsConfig } from "../utils/extendsConfig.mjs";
5
6
  import { mergeConfig } from "../utils/mergeConfig.mjs";
6
7
  import { ignoreKeys } from "./_utils.mjs";
@@ -35,7 +36,7 @@ const react = (composer, options) => {
35
36
  {
36
37
  ...modifiedConfig,
37
38
  name: "vdustr/react/md/rules",
38
- files: [GLOB_REACT_IN_MD],
39
+ files: [GLOB_MARKDOWN_CODE, GLOB_MDX_CODE],
39
40
  rules: {
40
41
  "react-compiler/react-compiler": "off",
41
42
  "react-hooks/rules-of-hooks": "off",
@@ -29,10 +29,20 @@ const yaml = (composer, options) => {
29
29
  },
30
30
  omittedConfig
31
31
  );
32
+ return [modifiedConfig, rulesConfig];
33
+ });
34
+ extendsConfig(composer, "antfu/yaml/pnpm-workspace", (config) => {
35
+ const modifiedConfig = mergeConfig(
36
+ pick(options?.yaml ?? {}, ["files", "ignores"]),
37
+ {
38
+ ...config,
39
+ files: [GLOB_PNPM_WORKSPACE_YAML]
40
+ }
41
+ );
42
+ const omittedConfig = omit(modifiedConfig, ignoreKeys);
32
43
  const sortKeysConfig = mergeConfig(options?.sortKeys, {
33
- ...omit(omittedConfig, ["files", "ignores"]),
44
+ ...omittedConfig,
34
45
  name: "vdustr/yaml/sort-keys/rules",
35
- files: [GLOB_PNPM_WORKSPACE_YAML],
36
46
  rules: {
37
47
  "yaml/sort-keys": [
38
48
  "error",
@@ -47,7 +57,7 @@ const yaml = (composer, options) => {
47
57
  ]
48
58
  }
49
59
  });
50
- return [modifiedConfig, rulesConfig, sortKeysConfig];
60
+ return [config, sortKeysConfig];
51
61
  });
52
62
  };
53
63
  export { yaml };
@@ -1,11 +1,9 @@
1
1
  declare const GLOB_CODE_WORKSPACE: string;
2
+ declare const GLOB_CONFIG_JS: string;
3
+ declare const GLOB_CSPELL_JSON: string;
4
+ declare const GLOB_MDX: string;
5
+ declare const GLOB_MDX_CODE: string;
2
6
  declare const GLOB_PACKAGE_JSON: string;
3
7
  declare const GLOB_PNPM_WORKSPACE_YAML: string;
4
- declare const GLOB_CSPELL_JSON: string;
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;
10
8
  declare const GLOB_VITEST_WORKSPACE: string;
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, };
9
+ export { GLOB_CODE_WORKSPACE, GLOB_CONFIG_JS, GLOB_CSPELL_JSON, GLOB_MDX, GLOB_MDX_CODE, GLOB_PACKAGE_JSON, GLOB_PNPM_WORKSPACE_YAML, GLOB_VITEST_WORKSPACE, };
@@ -1,16 +1,19 @@
1
+ import { GLOB_SRC } from "@antfu/eslint-config";
1
2
  const GLOB_CODE_WORKSPACE = "**/*.code-workspace";
3
+ const GLOB_CONFIG_JS = "**/*.config.?([cm])[jt]s";
4
+ const GLOB_CSPELL_JSON = "**/cspell.json";
5
+ const GLOB_MDX = "**/*.mdx";
6
+ const GLOB_MDX_CODE = `${GLOB_MDX}/${GLOB_SRC}`;
2
7
  const GLOB_PACKAGE_JSON = "**/package.json";
3
8
  const GLOB_PNPM_WORKSPACE_YAML = "**/pnpm-workspace.y?(a)ml";
4
- const GLOB_CSPELL_JSON = "**/cspell.json";
5
- const GLOB_CONFIG_JS = "**/*.config.?([cm])[jt]s";
6
- const GLOB_REACT_IN_MD = "**/*.md?(x)/**/*.?([mc])[jt]s?(x)";
7
9
  const GLOB_VITEST_WORKSPACE = "**/vitest.workspace.?([cm])[jt]s";
8
10
  export {
9
11
  GLOB_CODE_WORKSPACE,
10
12
  GLOB_CONFIG_JS,
11
13
  GLOB_CSPELL_JSON,
14
+ GLOB_MDX,
15
+ GLOB_MDX_CODE,
12
16
  GLOB_PACKAGE_JSON,
13
17
  GLOB_PNPM_WORKSPACE_YAML,
14
- GLOB_REACT_IN_MD,
15
18
  GLOB_VITEST_WORKSPACE
16
19
  };
@@ -4,6 +4,7 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.react = void 0;
7
+ var _eslintConfig = require("@antfu/eslint-config");
7
8
  var _esToolkit = require("es-toolkit");
8
9
  var _reactCompiler = require("../configs/reactCompiler");
9
10
  var _globs = require("../globs");
@@ -29,7 +30,7 @@ const react = (composer, options) => {
29
30
  }, {
30
31
  ...modifiedConfig,
31
32
  name: "vdustr/react/md/rules",
32
- files: [_globs.GLOB_REACT_IN_MD],
33
+ files: [_eslintConfig.GLOB_MARKDOWN_CODE, _globs.GLOB_MDX_CODE],
33
34
  rules: {
34
35
  "react-compiler/react-compiler": "off",
35
36
  "react-hooks/rules-of-hooks": "off",
@@ -22,10 +22,17 @@ const yaml = (composer, options) => {
22
22
  ...Object.fromEntries([..._eslintPluginYml.default.configs["flat/recommended"].flatMap(config2 => Object.entries(config2.rules ?? {})), ..._eslintPluginYml.default.configs["flat/prettier"].flatMap(config2 => Object.entries(config2.rules ?? {}))])
23
23
  })
24
24
  }, omittedConfig);
25
+ return [modifiedConfig, rulesConfig];
26
+ });
27
+ (0, _extendsConfig.extendsConfig)(composer, "antfu/yaml/pnpm-workspace", config => {
28
+ const modifiedConfig = (0, _mergeConfig.mergeConfig)((0, _esToolkit.pick)(options?.yaml ?? {}, ["files", "ignores"]), {
29
+ ...config,
30
+ files: [_globs.GLOB_PNPM_WORKSPACE_YAML]
31
+ });
32
+ const omittedConfig = (0, _esToolkit.omit)(modifiedConfig, _utils.ignoreKeys);
25
33
  const sortKeysConfig = (0, _mergeConfig.mergeConfig)(options?.sortKeys, {
26
- ...(0, _esToolkit.omit)(omittedConfig, ["files", "ignores"]),
34
+ ...omittedConfig,
27
35
  name: "vdustr/yaml/sort-keys/rules",
28
- files: [_globs.GLOB_PNPM_WORKSPACE_YAML],
29
36
  rules: {
30
37
  "yaml/sort-keys": ["error", {
31
38
  pathPattern: ".*",
@@ -37,7 +44,7 @@ const yaml = (composer, options) => {
37
44
  }]
38
45
  }
39
46
  });
40
- return [modifiedConfig, rulesConfig, sortKeysConfig];
47
+ return [config, sortKeysConfig];
41
48
  });
42
49
  };
43
50
  exports.yaml = yaml;
package/dist/globs.d.ts CHANGED
@@ -1,11 +1,9 @@
1
1
  declare const GLOB_CODE_WORKSPACE: string;
2
+ declare const GLOB_CONFIG_JS: string;
3
+ declare const GLOB_CSPELL_JSON: string;
4
+ declare const GLOB_MDX: string;
5
+ declare const GLOB_MDX_CODE: string;
2
6
  declare const GLOB_PACKAGE_JSON: string;
3
7
  declare const GLOB_PNPM_WORKSPACE_YAML: string;
4
- declare const GLOB_CSPELL_JSON: string;
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;
10
8
  declare const GLOB_VITEST_WORKSPACE: string;
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, };
9
+ export { GLOB_CODE_WORKSPACE, GLOB_CONFIG_JS, GLOB_CSPELL_JSON, GLOB_MDX, GLOB_MDX_CODE, GLOB_PACKAGE_JSON, GLOB_PNPM_WORKSPACE_YAML, GLOB_VITEST_WORKSPACE, };
package/dist/globs.js CHANGED
@@ -3,11 +3,13 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
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;
6
+ exports.GLOB_VITEST_WORKSPACE = exports.GLOB_PNPM_WORKSPACE_YAML = exports.GLOB_PACKAGE_JSON = exports.GLOB_MDX_CODE = exports.GLOB_MDX = exports.GLOB_CSPELL_JSON = exports.GLOB_CONFIG_JS = exports.GLOB_CODE_WORKSPACE = void 0;
7
+ var _eslintConfig = require("@antfu/eslint-config");
7
8
  const GLOB_CODE_WORKSPACE = exports.GLOB_CODE_WORKSPACE = "**/*.code-workspace";
9
+ const GLOB_CONFIG_JS = exports.GLOB_CONFIG_JS = "**/*.config.?([cm])[jt]s";
10
+ const GLOB_CSPELL_JSON = exports.GLOB_CSPELL_JSON = "**/cspell.json";
11
+ const GLOB_MDX = exports.GLOB_MDX = "**/*.mdx";
12
+ const GLOB_MDX_CODE = exports.GLOB_MDX_CODE = `${GLOB_MDX}/${_eslintConfig.GLOB_SRC}`;
8
13
  const GLOB_PACKAGE_JSON = exports.GLOB_PACKAGE_JSON = "**/package.json";
9
14
  const GLOB_PNPM_WORKSPACE_YAML = exports.GLOB_PNPM_WORKSPACE_YAML = "**/pnpm-workspace.y?(a)ml";
10
- const GLOB_CSPELL_JSON = exports.GLOB_CSPELL_JSON = "**/cspell.json";
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)";
13
15
  const GLOB_VITEST_WORKSPACE = exports.GLOB_VITEST_WORKSPACE = "**/vitest.workspace.?([cm])[jt]s";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vp-tw/eslint-config",
3
- "version": "0.0.27",
3
+ "version": "0.0.29",
4
4
  "description": "ViPro's ESLint configuration",
5
5
  "homepage": "https://github.com/vdustr/eslint-config",
6
6
  "author": {
@@ -40,23 +40,24 @@
40
40
  ],
41
41
  "dependencies": {
42
42
  "@mui/types": "^7.2.21",
43
- "es-toolkit": "^1.32.0",
43
+ "es-toolkit": "^1.33.0",
44
44
  "eslint-flat-config-utils": "^2.0.1",
45
- "local-pkg": "^1.1.0"
45
+ "local-pkg": "^1.1.1"
46
46
  },
47
47
  "devDependencies": {
48
48
  "eslint-typegen": "^2.0.0",
49
49
  "unbuild": "^3.3.1"
50
50
  },
51
51
  "peerDependencies": {
52
- "@antfu/eslint-config": "^4.3.0",
52
+ "@antfu/eslint-config": "4.10.1",
53
53
  "@types/eslint-config-prettier": "^6.11.3",
54
- "eslint": "^9.21.0",
55
- "eslint-config-prettier": "^10.0.2",
56
- "eslint-plugin-mdx": "^3.1.5",
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"
54
+ "eslint": "^9.22.0",
55
+ "eslint-config-prettier": "^10.1.1",
56
+ "eslint-plugin-mdx": "^3.2.0",
57
+ "eslint-plugin-package-json": "^0.26.3",
58
+ "eslint-plugin-react-compiler": "^19.0.0-beta-bafa41b-20250307",
59
+ "eslint-plugin-storybook": "^0.11.4",
60
+ "eslint-plugin-yml": "^1.17.0"
60
61
  },
61
62
  "peerDependenciesMeta": {
62
63
  "@types/eslint-config-prettier": {
@@ -76,6 +77,9 @@
76
77
  },
77
78
  "eslint-plugin-storybook": {
78
79
  "optional": true
80
+ },
81
+ "eslint-plugin-yml": {
82
+ "optional": true
79
83
  }
80
84
  },
81
85
  "publishConfig": {
@@ -84,6 +88,6 @@
84
88
  "scripts": {
85
89
  "build": "unbuild",
86
90
  "copy": "tsx scripts/copy",
87
- "typegen": "tsx scripts/typegen"
91
+ "typegen": "jiti scripts/typegen"
88
92
  }
89
93
  }