@vp-tw/eslint-config 0.2.0 → 1.0.4

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
@@ -10,7 +10,8 @@ ViPro's ESLint configuration.
10
10
  - [@tanstack/eslint-plugin-query](https://www.npmjs.com/package/@tanstack/eslint-plugin-query)
11
11
  - [eslint-mdx](https://github.com/mdx-js/eslint-mdx)
12
12
  - [eslint-plugin-storybook](https://github.com/storybookjs/eslint-plugin-storybook)
13
- - [eslint-config-prettier](https://github.com/prettier/eslint-config-prettier)
13
+ - [eslint-plugin-svelte](https://github.com/sveltejs/eslint-plugin-svelte)
14
+ - [eslint-config-prettier](https://github.com/prettier/eslint-config-prettier) - disables formatting rules to work with any formatter (Prettier, oxfmt, etc.)
14
15
  - Fine-tuned to provide an opinionated, optimal DX. Please copy the VSCode settings from [eslint-config.code-workspace](https://github.com/VdustR/eslint-config/blob/main/eslint-config.code-workspace).
15
16
 
16
17
  Check [here](https://vdustr.dev/eslint-config) to preview the ESLint inspection.
@@ -23,7 +24,7 @@ pnpm i -D eslint @antfu/eslint-config @vp-tw/eslint-config
23
24
 
24
25
  ## Usage
25
26
 
26
- Simlar to [antfu/eslint-config](https://github.com/antfu/eslint-config) but with additional options:
27
+ Similar to [antfu/eslint-config](https://github.com/antfu/eslint-config) but with additional options:
27
28
 
28
29
  ```ts
29
30
  // eslint.config.ts
@@ -35,35 +36,92 @@ import path from "pathe";
35
36
 
36
37
  const __filename = fileURLToPath(import.meta.url);
37
38
  const __dirname = path.dirname(__filename);
38
- const prettierignorePath = path.resolve(__dirname, ".prettierignore");
39
+ const eslintignorePath = path.resolve(__dirname, ".eslintignore");
39
40
 
40
41
  export default vdustr(
41
42
  {
42
43
  // By default, we disable `stylistic` and use `prettier` instead.
43
44
  // stylistic: false,
44
45
 
45
- // Defaults
46
- packageJson: true,
47
- emotion: false,
48
- tanstackQuery: false,
49
- mdx: false,
50
- storybook: false,
51
- prettier: true,
46
+ // Options (defaults shown)
47
+ react: false, // Enable React support with eslint-react strict-typescript rules
48
+ svelte: false, // Enable Svelte support
49
+ packageJson: true, // Enable package.json linting
50
+ emotion: false, // Enable Emotion CSS-in-JS linting
51
+ tanstackQuery: false, // Enable TanStack Query linting
52
+ mdx: false, // Enable MDX linting
53
+ storybook: false, // Enable Storybook linting
54
+ prettier: true, // Enable eslint-config-prettier to disable formatting rules
55
+
56
+ // Extends options for fine-grained control
57
+ extends: {
58
+ react: {
59
+ typescript: true, // Use strict-typescript rules (default: true)
60
+ },
61
+ },
52
62
  },
53
- includeIgnoreFile(prettierignorePath),
63
+ includeIgnoreFile(eslintignorePath),
54
64
  );
55
65
  ```
56
66
 
57
- ## Release
67
+ ## Features
68
+
69
+ ### React Support
70
+
71
+ When `react: true`, this config uses `@eslint-react/eslint-plugin` with `strict-typescript` rules by default. You can disable TypeScript-specific rules:
72
+
73
+ ```ts
74
+ export default vdustr({
75
+ react: true,
76
+ extends: {
77
+ react: {
78
+ typescript: false, // Use strict rules instead of strict-typescript
79
+ },
80
+ },
81
+ });
82
+ ```
83
+
84
+ ### pnpm Workspace Sorting
85
+
86
+ Automatically sorts keys in `pnpm-workspace.yaml` alphabetically using `yaml/sort-keys` rule.
87
+
88
+ ## Contributing
89
+
90
+ ### Development
58
91
 
59
92
  ```bash
60
- pnpm -w v:patch # or
61
- pnpm -w v:minor # or
62
- pnpm -w v:major
93
+ pnpm install # Install dependencies
94
+ pnpm build # Build @vp-tw/eslint-config (in packages/eslint-config)
95
+ pnpm test # Run tests for @vp-tw/eslint-config
96
+ pnpm run checkTypes # Type check entire workspace
97
+ pnpm lint # Lint entire workspace
98
+ ```
63
99
 
64
- pnpm -r publish
100
+ ### Release
101
+
102
+ Managed by [changesets](https://github.com/changesets/changesets). CI auto-publishes when merged to main.
103
+
104
+ ```bash
105
+ pnpm changeset # Create changeset interactively
106
+ ```
107
+
108
+ ### Adding Dynamic Import Wrappers
109
+
110
+ When adding support for optional ESLint plugins, create a wrapper in `src/lib/`:
111
+
112
+ ```typescript
113
+ // src/lib/my-plugin.ts
114
+ import type MyPlugin from "eslint-plugin-my";
115
+ import { interopDefault } from "@antfu/eslint-config";
116
+
117
+ // Explicit return type required to avoid TS2742 build errors
118
+ const myPlugin = (): Promise<typeof MyPlugin> => interopDefault(import("eslint-plugin-my"));
119
+
120
+ export { myPlugin };
65
121
  ```
66
122
 
123
+ See [CLAUDE.md](./CLAUDE.md) for detailed architecture and patterns.
124
+
67
125
  ## License
68
126
 
69
127
  MIT © ViPro <vdustr@gmail.com> (<http://vdustr.dev>)
@@ -18,7 +18,11 @@ const packageJson = async options => {
18
18
  };
19
19
  const packageJsonRulesConfig = (0, _mergeConfig.mergeConfig)(options?.packageJson, {
20
20
  ...(0, _esToolkit.omit)(recommended, ["name", "plugins"]),
21
- rules: (0, _renameRules.renameRules)(recommended.rules),
21
+ rules: (0, _renameRules.renameRules)({
22
+ ...recommended.rules,
23
+ // sorted by oxfmt
24
+ "package-json/order-properties": "off"
25
+ }),
22
26
  name: "vdustr/package-json/rules"
23
27
  });
24
28
  return [packageJsonSetupConfig, packageJsonRulesConfig];
@@ -10,13 +10,15 @@ var _mergeConfig = require("../utils/mergeConfig");
10
10
  const tanstackQuery = async options => {
11
11
  await (0, _eslintConfig.ensurePackages)(["@tanstack/eslint-plugin-query"]);
12
12
  const tanstackQueryPlugin = await (0, _eslintConfig.interopDefault)(Promise.resolve().then(() => require("@tanstack/eslint-plugin-query")));
13
- const recommended = tanstackQueryPlugin.configs["flat/recommended"];
13
+ const recommendedConfigs = tanstackQueryPlugin.configs["flat/recommended"];
14
+ const setupConfig = recommendedConfigs[0];
15
+ if (!setupConfig) throw new Error("Failed to load @tanstack/eslint-plugin-query recommended config.");
14
16
  const tanstackQuerySetupConfig = {
15
- ...(0, _esToolkit.pick)(recommended[0], ["plugins"]),
17
+ ...(0, _esToolkit.pick)(setupConfig, ["plugins"]),
16
18
  name: "vdustr/tanstack-query/setup"
17
19
  };
18
20
  const tanstackQueryRulesConfig = (0, _mergeConfig.mergeConfig)(options?.tanstackQuery, {
19
- ...recommended[0],
21
+ ...setupConfig,
20
22
  name: "vdustr/tanstack-query/rules"
21
23
  });
22
24
  return [tanstackQuerySetupConfig, tanstackQueryRulesConfig];
@@ -181,5 +181,5 @@ type StorybookNoUninstalledAddons = []|[{
181
181
  [k: string]: unknown | undefined
182
182
  }]
183
183
  // Names of all the configs
184
- export type ConfigNames = 'vdustr/emotion/setup' | 'vdustr/emotion/rules' | 'vdustr/tanstack-query/setup' | 'vdustr/tanstack-query/rules' | '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'
184
+ export type ConfigNames = 'vdustr/emotion/setup' | 'vdustr/emotion/rules' | 'vdustr/tanstack-query/setup' | 'vdustr/tanstack-query/rules' | '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/react/md/rules' | 'vdustr/jsonc/rules' | 'vdustr/sort/json-keys' | 'vdustr/sort/json-array-values' | 'vdustr/sort/tsconfig-json' | 'vdustr/pnpm/pnpm-workspace-yaml-sort' | 'vdustr/yaml/rules'
185
185
 
@@ -1,16 +1,8 @@
1
- import {
2
- ensurePackages,
3
- GLOB_MARKDOWN,
4
- interopDefault
5
- } from "@antfu/eslint-config";
1
+ import { ensurePackages, GLOB_MARKDOWN, interopDefault } from "@antfu/eslint-config";
6
2
  import { omit, pick } from "es-toolkit";
7
3
  import { mergeConfig } from "../utils/mergeConfig.mjs";
8
4
  import { renameRules } from "../utils/renameRules.mjs";
9
- const mdx = async ({
10
- codeBlocks = true,
11
- processorOptions,
12
- ...options
13
- } = {}) => {
5
+ const mdx = async ({ codeBlocks = true, processorOptions, ...options } = {}) => {
14
6
  await ensurePackages(["eslint-plugin-mdx"]);
15
7
  const mdxPlugin = await interopDefault(await import("eslint-plugin-mdx"));
16
8
  const codeBlocksOptions = typeof codeBlocks !== "object" ? {} : codeBlocks;
@@ -4,9 +4,7 @@ import { mergeConfig } from "../utils/mergeConfig.mjs";
4
4
  import { renameRules } from "../utils/renameRules.mjs";
5
5
  const packageJson = async (options) => {
6
6
  await ensurePackages(["eslint-plugin-package-json"]);
7
- const packageJson2 = await interopDefault(
8
- import("eslint-plugin-package-json")
9
- );
7
+ const packageJson2 = await interopDefault(import("eslint-plugin-package-json"));
10
8
  const recommended = packageJson2.configs.recommended;
11
9
  const packageJsonSetupConfig = {
12
10
  plugins: recommended.plugins,
@@ -14,7 +12,11 @@ const packageJson = async (options) => {
14
12
  };
15
13
  const packageJsonRulesConfig = mergeConfig(options?.packageJson, {
16
14
  ...omit(recommended, ["name", "plugins"]),
17
- rules: renameRules(recommended.rules),
15
+ rules: renameRules({
16
+ ...recommended.rules,
17
+ // sorted by oxfmt
18
+ "package-json/order-properties": "off"
19
+ }),
18
20
  name: "vdustr/package-json/rules"
19
21
  });
20
22
  return [packageJsonSetupConfig, packageJsonRulesConfig];
@@ -3,9 +3,7 @@ import { mergeConfig } from "../utils/mergeConfig.mjs";
3
3
  import { renameRules } from "../utils/renameRules.mjs";
4
4
  const prettier = async (options) => {
5
5
  await ensurePackages(["eslint-config-prettier"]);
6
- const eslintConfigPrettier = await interopDefault(
7
- import("eslint-config-prettier")
8
- );
6
+ const eslintConfigPrettier = await interopDefault(import("eslint-config-prettier"));
9
7
  const rulesConfig = mergeConfig(options?.prettier, {
10
8
  ...eslintConfigPrettier,
11
9
  rules: renameRules(eslintConfigPrettier.rules),
@@ -4,9 +4,7 @@ import { mergeConfig } from "../utils/mergeConfig.mjs";
4
4
  import { renameRules } from "../utils/renameRules.mjs";
5
5
  const storybook = async (options) => {
6
6
  await ensurePackages(["eslint-plugin-storybook", "storybook"]);
7
- const storybookPlugin = await interopDefault(
8
- import("eslint-plugin-storybook")
9
- );
7
+ const storybookPlugin = await interopDefault(import("eslint-plugin-storybook"));
10
8
  const inheritingConfigs = storybookPlugin.configs["flat/csf-strict"];
11
9
  const originalSetupConfig = inheritingConfigs[0];
12
10
  const originalStoryRulesConfig = inheritingConfigs[1];
@@ -52,10 +50,6 @@ const storybook = async (options) => {
52
50
  rules: renameRules(originalMainRulesConfig.rules ?? {})
53
51
  }
54
52
  );
55
- return [
56
- setupConfig,
57
- storyRulesConfig,
58
- mainRulesConfig
59
- ];
53
+ return [setupConfig, storyRulesConfig, mainRulesConfig];
60
54
  };
61
55
  export { storybook };
@@ -3,16 +3,17 @@ import { pick } from "es-toolkit";
3
3
  import { mergeConfig } from "../utils/mergeConfig.mjs";
4
4
  const tanstackQuery = async (options) => {
5
5
  await ensurePackages(["@tanstack/eslint-plugin-query"]);
6
- const tanstackQueryPlugin = await interopDefault(
7
- import("@tanstack/eslint-plugin-query")
8
- );
9
- const recommended = tanstackQueryPlugin.configs["flat/recommended"];
6
+ const tanstackQueryPlugin = await interopDefault(import("@tanstack/eslint-plugin-query"));
7
+ const recommendedConfigs = tanstackQueryPlugin.configs["flat/recommended"];
8
+ const setupConfig = recommendedConfigs[0];
9
+ if (!setupConfig)
10
+ throw new Error("Failed to load @tanstack/eslint-plugin-query recommended config.");
10
11
  const tanstackQuerySetupConfig = {
11
- ...pick(recommended[0], ["plugins"]),
12
+ ...pick(setupConfig, ["plugins"]),
12
13
  name: "vdustr/tanstack-query/setup"
13
14
  };
14
15
  const tanstackQueryRulesConfig = mergeConfig(options?.tanstackQuery, {
15
- ...recommended[0],
16
+ ...setupConfig,
16
17
  name: "vdustr/tanstack-query/rules"
17
18
  });
18
19
  return [tanstackQuerySetupConfig, tanstackQueryRulesConfig];
@@ -181,5 +181,5 @@ type StorybookNoUninstalledAddons = []|[{
181
181
  [k: string]: unknown | undefined
182
182
  }]
183
183
  // Names of all the configs
184
- export type ConfigNames = 'vdustr/emotion/setup' | 'vdustr/emotion/rules' | 'vdustr/tanstack-query/setup' | 'vdustr/tanstack-query/rules' | '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'
184
+ export type ConfigNames = 'vdustr/emotion/setup' | 'vdustr/emotion/rules' | 'vdustr/tanstack-query/setup' | 'vdustr/tanstack-query/rules' | '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/react/md/rules' | 'vdustr/jsonc/rules' | 'vdustr/sort/json-keys' | 'vdustr/sort/json-array-values' | 'vdustr/sort/tsconfig-json' | 'vdustr/pnpm/pnpm-workspace-yaml-sort' | 'vdustr/yaml/rules'
185
185
 
@@ -13,10 +13,7 @@ import { mergeConfig } from "../utils/mergeConfig.mjs";
13
13
  import { ignoreKeys } from "./_utils.mjs";
14
14
  const imports = (composer, options) => {
15
15
  extendsConfig(composer, "antfu/imports/rules", (config) => {
16
- const modifiedConfig = mergeConfig(
17
- pick(options?.imports ?? {}, ["files", "ignores"]),
18
- config
19
- );
16
+ const modifiedConfig = mergeConfig(pick(options?.imports ?? {}, ["files", "ignores"]), config);
20
17
  const omittedConfig = omit(modifiedConfig, ignoreKeys);
21
18
  const rulesConfig = mergeConfig(
22
19
  omit(options?.imports ?? {}, ["files", "ignores"]),
@@ -0,0 +1,8 @@
1
+ import type { ConfigOverrides, VpComposer } from "../types";
2
+ declare namespace pnpm {
3
+ interface Options {
4
+ pnpm?: ConfigOverrides;
5
+ }
6
+ }
7
+ declare const pnpm: (composer: VpComposer, options?: pnpm.Options) => void;
8
+ export { pnpm };
@@ -0,0 +1,33 @@
1
+ import { omit, pick } from "es-toolkit";
2
+ import { GLOB_PNPM_WORKSPACE_YAML } from "../globs.mjs";
3
+ import { extendsConfig } from "../utils/extendsConfig.mjs";
4
+ import { mergeConfig } from "../utils/mergeConfig.mjs";
5
+ import { ignoreKeys } from "./_utils.mjs";
6
+ const pnpm = (composer, options) => {
7
+ extendsConfig(composer, "antfu/pnpm/pnpm-workspace-yaml-sort", (config) => {
8
+ const modifiedConfig = mergeConfig(pick(options?.pnpm ?? {}, ["files", "ignores"]), {
9
+ ...config,
10
+ files: [GLOB_PNPM_WORKSPACE_YAML]
11
+ });
12
+ const omittedConfig = omit(modifiedConfig, ignoreKeys);
13
+ const sortKeysConfig = mergeConfig(options?.pnpm, {
14
+ ...omittedConfig,
15
+ name: "vdustr/pnpm/pnpm-workspace-yaml-sort",
16
+ rules: {
17
+ "yaml/sort-keys": [
18
+ "error",
19
+ {
20
+ pathPattern: ".*",
21
+ order: {
22
+ type: "asc",
23
+ caseSensitive: false,
24
+ natural: true
25
+ }
26
+ }
27
+ ]
28
+ }
29
+ });
30
+ return [modifiedConfig, sortKeysConfig];
31
+ });
32
+ };
33
+ export { pnpm };
@@ -6,6 +6,7 @@ declare namespace react {
6
6
  reactCompiler?: reactCompiler.Options["reactCompiler"];
7
7
  reactCompilerSetup?: reactCompiler.Options["setup"];
8
8
  md?: ConfigOverrides;
9
+ typescript?: boolean;
9
10
  }
10
11
  }
11
12
  declare const react: (composer: VpComposer, options?: react.Options) => void;
@@ -2,32 +2,56 @@ import { GLOB_MARKDOWN_CODE } from "@antfu/eslint-config";
2
2
  import { omit, pick } from "es-toolkit";
3
3
  import { reactCompiler } from "../configs/reactCompiler.mjs";
4
4
  import { GLOB_MDX_CODE } from "../globs.mjs";
5
+ import { eslintReact as importEslintReact } from "../lib/eslint-react.mjs";
5
6
  import { extendsConfig } from "../utils/extendsConfig.mjs";
6
7
  import { mergeConfig } from "../utils/mergeConfig.mjs";
7
8
  import { ignoreKeys } from "./_utils.mjs";
9
+ const reactRulesRenameMap = {
10
+ "@eslint-react": "react",
11
+ "@eslint-react/dom": "react-dom",
12
+ "@eslint-react/hooks-extra": "react-hooks-extra",
13
+ "@eslint-react/naming-convention": "react-naming-convention",
14
+ "@eslint-react/web-api": "react-web-api"
15
+ };
16
+ function renameReactRules(rules) {
17
+ return Object.fromEntries(
18
+ Object.entries(rules).map(([key, value]) => {
19
+ const namespaceArray = key.split("/");
20
+ const namespace = namespaceArray.slice(0, -1).join("/");
21
+ if (namespace in reactRulesRenameMap) {
22
+ const newNamespace = reactRulesRenameMap[namespace];
23
+ if (newNamespace) {
24
+ const newKey = key.replace(namespace, newNamespace);
25
+ return [newKey, value];
26
+ }
27
+ }
28
+ return [key, value];
29
+ })
30
+ );
31
+ }
8
32
  const react = (composer, options) => {
33
+ const typescriptEnabled = options?.typescript ?? true;
9
34
  extendsConfig(composer, "antfu/react/rules", async (config) => {
10
- const modifiedConfig = mergeConfig(
11
- pick(options?.react ?? {}, ["files", "ignores"]),
12
- config
13
- );
35
+ const eslintReact = await importEslintReact();
36
+ const modifiedConfig = mergeConfig(pick(options?.react ?? {}, ["files", "ignores"]), config);
14
37
  const omittedConfig = omit(modifiedConfig, ignoreKeys);
38
+ const baseConfig = typescriptEnabled ? eslintReact.configs["strict-typescript"] : eslintReact.configs.strict;
15
39
  const rulesConfig = mergeConfig(
16
40
  omit(options?.react ?? {}, ["files", "ignores"]),
17
41
  {
42
+ // plugins already setup by antfu
43
+ ...omit(baseConfig, ["plugins"]),
18
44
  name: "vdustr/react/rules",
19
- rules: {
45
+ rules: renameReactRules({
46
+ ...baseConfig.rules,
20
47
  "react/prefer-destructuring-assignment": "off"
21
- }
48
+ })
22
49
  },
23
50
  omittedConfig
24
51
  );
25
52
  const reactCompilerConfigs = await reactCompiler({
26
53
  setup: options?.reactCompilerSetup ?? {},
27
- reactCompiler: mergeConfig(
28
- options?.reactCompiler,
29
- pick(omittedConfig, ["files", "ignores"])
30
- )
54
+ reactCompiler: mergeConfig(options?.reactCompiler, pick(omittedConfig, ["files", "ignores"]))
31
55
  });
32
56
  const mdConfig = mergeConfig(
33
57
  {
@@ -43,10 +43,7 @@ const sortJsonKeys = async (composer, options) => {
43
43
  };
44
44
  const sortPackageJson = async (composer, options) => {
45
45
  extendsConfig(composer, "antfu/sort/package-json", (config) => {
46
- const modifiedConfig = mergeConfig(
47
- pick(options ?? {}, ["files", "ignores"]),
48
- config
49
- );
46
+ const modifiedConfig = mergeConfig(pick(options ?? {}, ["files", "ignores"]), config);
50
47
  const omittedConfig = omit(modifiedConfig, ignoreKeys);
51
48
  const rulesConfig = mergeConfig(
52
49
  options,
@@ -64,10 +61,7 @@ const sortPackageJson = async (composer, options) => {
64
61
  };
65
62
  const sortTsconfigJson = async (composer, options) => {
66
63
  extendsConfig(composer, "antfu/sort/tsconfig-json", (config) => {
67
- const modifiedConfig = mergeConfig(
68
- pick(options ?? {}, ["files", "ignores"]),
69
- config
70
- );
64
+ const modifiedConfig = mergeConfig(pick(options ?? {}, ["files", "ignores"]), config);
71
65
  const omittedConfig = omit(modifiedConfig, ignoreKeys);
72
66
  const rulesConfig = mergeConfig(
73
67
  options,
@@ -2,7 +2,6 @@ import type { ConfigOverrides, VpComposer } from "../types";
2
2
  declare namespace yaml {
3
3
  interface Options {
4
4
  yaml?: ConfigOverrides;
5
- sortKeys?: ConfigOverrides;
6
5
  }
7
6
  }
8
7
  declare const yaml: (composer: VpComposer, options?: yaml.Options) => void;
@@ -1,16 +1,12 @@
1
1
  import { omit, pick } from "es-toolkit";
2
2
  import eslintPluginYml from "eslint-plugin-yml";
3
- import { GLOB_PNPM_WORKSPACE_YAML } from "../globs.mjs";
4
3
  import { extendsConfig } from "../utils/extendsConfig.mjs";
5
4
  import { mergeConfig } from "../utils/mergeConfig.mjs";
6
5
  import { renameRules } from "../utils/renameRules.mjs";
7
6
  import { ignoreKeys } from "./_utils.mjs";
8
7
  const yaml = (composer, options) => {
9
8
  extendsConfig(composer, "antfu/yaml/rules", (config) => {
10
- const modifiedConfig = mergeConfig(
11
- pick(options?.yaml ?? {}, ["files", "ignores"]),
12
- config
13
- );
9
+ const modifiedConfig = mergeConfig(pick(options?.yaml ?? {}, ["files", "ignores"]), config);
14
10
  const omittedConfig = omit(modifiedConfig, ignoreKeys);
15
11
  const rulesConfig = mergeConfig(
16
12
  omit(options?.yaml ?? {}, ["files", "ignores"]),
@@ -31,33 +27,5 @@ const yaml = (composer, options) => {
31
27
  );
32
28
  return [modifiedConfig, rulesConfig];
33
29
  });
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);
43
- const sortKeysConfig = mergeConfig(options?.sortKeys, {
44
- ...omittedConfig,
45
- name: "vdustr/yaml/sort-keys/rules",
46
- rules: {
47
- "yaml/sort-keys": [
48
- "error",
49
- {
50
- pathPattern: ".*",
51
- order: {
52
- type: "asc",
53
- caseSensitive: false,
54
- natural: true
55
- }
56
- }
57
- ]
58
- }
59
- });
60
- return [config, sortKeysConfig];
61
- });
62
30
  };
63
31
  export { yaml };
@@ -1,9 +1,7 @@
1
1
  import { ensurePackages, interopDefault } from "@antfu/eslint-config";
2
2
  const reactCompiler = async () => {
3
3
  await ensurePackages(["eslint-plugin-react-compiler"]);
4
- const reactCompiler2 = await interopDefault(
5
- import("eslint-plugin-react-compiler")
6
- );
4
+ const reactCompiler2 = await interopDefault(import("eslint-plugin-react-compiler"));
7
5
  return reactCompiler2;
8
6
  };
9
7
  export { reactCompiler };
@@ -0,0 +1,3 @@
1
+ import type EslintReact from "@eslint-react/eslint-plugin";
2
+ declare const eslintReact: () => Promise<typeof EslintReact>;
3
+ export { eslintReact };
@@ -0,0 +1,3 @@
1
+ import { interopDefault } from "@antfu/eslint-config";
2
+ const eslintReact = () => interopDefault(import("@eslint-react/eslint-plugin"));
3
+ export { eslintReact };
@@ -4,14 +4,16 @@ import type { Arrayable, Awaitable, DefaultConfigNamesMap, FlatConfigComposer, S
4
4
  * <https://github.com/antfu/eslint-flat-config-utils/blob/ac3a9b4/src/composer.ts#L492-L512>
5
5
  */
6
6
  declare function getConfigIndex(configs: Array<Linter.Config>, nameOrIndex: string | number): number;
7
+ declare const tryGetConfigIndex: typeof getConfigIndex;
7
8
  /**
8
9
  * <https://github.com/antfu/eslint-flat-config-utils/blob/ac3a9b4/src/composer.ts#L91>
9
10
  */
10
11
  type Operation<T extends object = Linter.Config> = (items: Array<T>) => Promise<Array<T>>;
12
+ declare const pushOverations: <T extends object = Linter.Config, ConfigNames extends string = keyof DefaultConfigNamesMap>(composer: FlatConfigComposer<T, ConfigNames>, operations: Array<Operation<T>>) => void;
11
13
  declare function extendsConfigInternal<T extends object = Linter.Config, ConfigNames extends string = keyof DefaultConfigNamesMap>(composer: FlatConfigComposer<T, ConfigNames>, sourceOrIndex: StringLiteralUnion<ConfigNames, string | number>, config: Awaitable<Arrayable<T>> | ((config: T) => Awaitable<Arrayable<T>>)): void;
12
14
  declare const extendsConfig: typeof extendsConfigInternal & {
13
15
  getConfigIndex: typeof getConfigIndex;
14
- tryGetConfigIndex: typeof getConfigIndex;
15
- pushOverations: <T extends object = Linter.Config<Linter.RulesRecord>, ConfigNames extends string = never>(composer: FlatConfigComposer<T, ConfigNames>, operations: Array<Operation<T>>) => void;
16
+ tryGetConfigIndex: typeof tryGetConfigIndex;
17
+ pushOverations: typeof pushOverations;
16
18
  };
17
19
  export { extendsConfig };
@@ -10,6 +10,7 @@ import { tanstackQuery } from "./configs/tanstackQuery";
10
10
  import { imports } from "./extends/imports";
11
11
  import { javascript } from "./extends/javascript";
12
12
  import { jsonc } from "./extends/jsonc";
13
+ import { pnpm } from "./extends/pnpm";
13
14
  import { react } from "./extends/react";
14
15
  import { typescript } from "./extends/typescript";
15
16
  import { yaml } from "./extends/yaml";
@@ -22,6 +23,7 @@ type Options = ReplaceAntfuEslintRulesWithVpRulesDeeply<NonNullable<Parameters<t
22
23
  sort?: sort.Options;
23
24
  yaml?: yaml.Options;
24
25
  react?: react.Options;
26
+ pnpm?: pnpm.Options;
25
27
  };
26
28
  packageJson?: boolean | packageJson.Options;
27
29
  emotion?: boolean | emotion.Options;
@@ -9,6 +9,7 @@ import { tanstackQuery } from "./configs/tanstackQuery.mjs";
9
9
  import { imports } from "./extends/imports.mjs";
10
10
  import { javascript } from "./extends/javascript.mjs";
11
11
  import { jsonc } from "./extends/jsonc.mjs";
12
+ import { pnpm } from "./extends/pnpm.mjs";
12
13
  import { react } from "./extends/react.mjs";
13
14
  import {
14
15
  sortJsonArrayValues,
@@ -35,12 +36,11 @@ const vdustr = (options, ...userConfigs) => {
35
36
  const vpOptions = pick(options ?? {}, ownedConfigNames);
36
37
  const packageJsonEnabled = Boolean(vpOptions?.packageJson ?? true);
37
38
  const emotionEnabled = Boolean(vpOptions?.emotion ?? false);
38
- const tanstackQueryEnabled = Boolean(
39
- vpOptions?.tanstackQuery ?? false
40
- );
39
+ const tanstackQueryEnabled = Boolean(vpOptions?.tanstackQuery ?? false);
41
40
  const mdxEnabled = Boolean(vpOptions?.mdx ?? false);
42
41
  const storybookEnabled = Boolean(vpOptions?.storybook ?? false);
43
42
  const prettierEnabled = Boolean(vpOptions?.prettier ?? true);
43
+ const reactEnabled = Boolean(antfuOptions?.react ?? false);
44
44
  let config = antfu({
45
45
  ...antfuOptions,
46
46
  ...!prettierEnabled ? null : {
@@ -52,44 +52,36 @@ const vdustr = (options, ...userConfigs) => {
52
52
  imports(config, vpOptions?.extends?.imports);
53
53
  typescript(config, vpOptions?.extends?.typescript);
54
54
  jsonc(config, vpOptions?.extends?.jsonc);
55
- if (packageJsonEnabled)
56
- sortPackageJson(config, vpOptions?.extends?.sort?.packageJson);
55
+ if (packageJsonEnabled) sortPackageJson(config, vpOptions?.extends?.sort?.packageJson);
57
56
  sortTsconfigJson(config, vpOptions?.extends?.sort?.tsconfigJson);
58
57
  sortJsonKeys(config, vpOptions?.extends?.sort?.jsoncSortKeys);
59
58
  sortJsonArrayValues(config, vpOptions?.extends?.sort?.jsoncSortArrayValues);
60
59
  yaml(config, vpOptions?.extends?.yaml);
61
- react(config, vpOptions?.extends?.react);
60
+ if (reactEnabled) {
61
+ react(config, vpOptions?.extends?.react);
62
+ }
63
+ pnpm(config, vpOptions?.extends?.pnpm);
62
64
  if (packageJsonEnabled) {
63
65
  const packageJsonOptions = typeof vpOptions?.packageJson !== "object" ? void 0 : vpOptions.packageJson;
64
- config = config.append(
65
- packageJson(...!packageJsonOptions ? [] : [packageJsonOptions])
66
- );
66
+ config = config.append(packageJson(...!packageJsonOptions ? [] : [packageJsonOptions]));
67
67
  }
68
68
  if (emotionEnabled) {
69
69
  const emotionOptions = typeof vpOptions?.emotion !== "object" ? void 0 : vpOptions.emotion;
70
- config = config.append(
71
- emotion(...!emotionOptions ? [] : [emotionOptions])
72
- );
70
+ config = config.append(emotion(...!emotionOptions ? [] : [emotionOptions]));
73
71
  }
74
72
  if (tanstackQueryEnabled) {
75
73
  const tanstackQueryOptions = typeof vpOptions?.tanstackQuery !== "object" ? void 0 : vpOptions.tanstackQuery;
76
- config = config.append(
77
- tanstackQuery(...!tanstackQueryOptions ? [] : [tanstackQueryOptions])
78
- );
74
+ config = config.append(tanstackQuery(...!tanstackQueryOptions ? [] : [tanstackQueryOptions]));
79
75
  }
80
76
  if (storybookEnabled) {
81
77
  const storybookOptions = typeof vpOptions?.storybook !== "object" ? void 0 : vpOptions.storybook;
82
- config = config.append(
83
- storybook(...!storybookOptions ? [] : [storybookOptions])
84
- );
78
+ config = config.append(storybook(...!storybookOptions ? [] : [storybookOptions]));
85
79
  }
86
80
  if (mdxEnabled) {
87
81
  const mdxOptions = {
88
82
  ...typeof vpOptions?.mdx !== "object" ? null : vpOptions.mdx
89
83
  };
90
- const mdxFlatCodeBlocksEnabled = Boolean(
91
- mdxOptions?.codeBlocks ?? true
92
- );
84
+ const mdxFlatCodeBlocksEnabled = Boolean(mdxOptions?.codeBlocks ?? true);
93
85
  const mdxFlatCodeBlocksOptions = {
94
86
  ...typeof mdxOptions?.codeBlocks !== "object" ? null : mdxOptions.codeBlocks
95
87
  };
@@ -102,9 +94,7 @@ const vdustr = (options, ...userConfigs) => {
102
94
  }
103
95
  if (prettierEnabled) {
104
96
  const prettierOptions = typeof vpOptions?.prettier !== "object" ? void 0 : vpOptions.prettier;
105
- config = config.append(
106
- prettier(...!prettierOptions ? [] : [prettierOptions])
107
- );
97
+ config = config.append(prettier(...!prettierOptions ? [] : [prettierOptions]));
108
98
  }
109
99
  config.append(...userConfigs);
110
100
  return config;
@@ -0,0 +1,8 @@
1
+ import type { ConfigOverrides, VpComposer } from "../types";
2
+ declare namespace pnpm {
3
+ interface Options {
4
+ pnpm?: ConfigOverrides;
5
+ }
6
+ }
7
+ declare const pnpm: (composer: VpComposer, options?: pnpm.Options) => void;
8
+ export { pnpm };
@@ -0,0 +1,36 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.pnpm = void 0;
7
+ var _esToolkit = require("es-toolkit");
8
+ var _globs = require("../globs");
9
+ var _extendsConfig = require("../utils/extendsConfig");
10
+ var _mergeConfig = require("../utils/mergeConfig");
11
+ var _utils = require("./_utils");
12
+ const pnpm = (composer, options) => {
13
+ (0, _extendsConfig.extendsConfig)(composer, "antfu/pnpm/pnpm-workspace-yaml-sort", config => {
14
+ const modifiedConfig = (0, _mergeConfig.mergeConfig)((0, _esToolkit.pick)(options?.pnpm ?? {}, ["files", "ignores"]), {
15
+ ...config,
16
+ files: [_globs.GLOB_PNPM_WORKSPACE_YAML]
17
+ });
18
+ const omittedConfig = (0, _esToolkit.omit)(modifiedConfig, _utils.ignoreKeys);
19
+ const sortKeysConfig = (0, _mergeConfig.mergeConfig)(options?.pnpm, {
20
+ ...omittedConfig,
21
+ name: "vdustr/pnpm/pnpm-workspace-yaml-sort",
22
+ rules: {
23
+ "yaml/sort-keys": ["error", {
24
+ pathPattern: ".*",
25
+ order: {
26
+ type: "asc",
27
+ caseSensitive: false,
28
+ natural: true
29
+ }
30
+ }]
31
+ }
32
+ });
33
+ return [modifiedConfig, sortKeysConfig];
34
+ });
35
+ };
36
+ exports.pnpm = pnpm;
@@ -6,6 +6,7 @@ declare namespace react {
6
6
  reactCompiler?: reactCompiler.Options["reactCompiler"];
7
7
  reactCompilerSetup?: reactCompiler.Options["setup"];
8
8
  md?: ConfigOverrides;
9
+ typescript?: boolean;
9
10
  }
10
11
  }
11
12
  declare const react: (composer: VpComposer, options?: react.Options) => void;
@@ -8,18 +8,46 @@ var _eslintConfig = require("@antfu/eslint-config");
8
8
  var _esToolkit = require("es-toolkit");
9
9
  var _reactCompiler = require("../configs/reactCompiler");
10
10
  var _globs = require("../globs");
11
+ var _eslintReact = require("../lib/eslint-react");
11
12
  var _extendsConfig = require("../utils/extendsConfig");
12
13
  var _mergeConfig = require("../utils/mergeConfig");
13
14
  var _utils = require("./_utils");
15
+ const reactRulesRenameMap = {
16
+ "@eslint-react": "react",
17
+ "@eslint-react/dom": "react-dom",
18
+ "@eslint-react/hooks-extra": "react-hooks-extra",
19
+ "@eslint-react/naming-convention": "react-naming-convention",
20
+ "@eslint-react/web-api": "react-web-api"
21
+ };
22
+ function renameReactRules(rules) {
23
+ return Object.fromEntries(Object.entries(rules).map(([key, value]) => {
24
+ const namespaceArray = key.split("/");
25
+ const namespace = namespaceArray.slice(0, -1).join("/");
26
+ if (namespace in reactRulesRenameMap) {
27
+ const newNamespace = reactRulesRenameMap[namespace];
28
+ if (newNamespace) {
29
+ const newKey = key.replace(namespace, newNamespace);
30
+ return [newKey, value];
31
+ }
32
+ }
33
+ return [key, value];
34
+ }));
35
+ }
14
36
  const react = (composer, options) => {
37
+ const typescriptEnabled = options?.typescript ?? true;
15
38
  (0, _extendsConfig.extendsConfig)(composer, "antfu/react/rules", async config => {
39
+ const eslintReact = await (0, _eslintReact.eslintReact)();
16
40
  const modifiedConfig = (0, _mergeConfig.mergeConfig)((0, _esToolkit.pick)(options?.react ?? {}, ["files", "ignores"]), config);
17
41
  const omittedConfig = (0, _esToolkit.omit)(modifiedConfig, _utils.ignoreKeys);
42
+ const baseConfig = typescriptEnabled ? eslintReact.configs["strict-typescript"] : eslintReact.configs.strict;
18
43
  const rulesConfig = (0, _mergeConfig.mergeConfig)((0, _esToolkit.omit)(options?.react ?? {}, ["files", "ignores"]), {
44
+ // plugins already setup by antfu
45
+ ...(0, _esToolkit.omit)(baseConfig, ["plugins"]),
19
46
  name: "vdustr/react/rules",
20
- rules: {
47
+ rules: renameReactRules({
48
+ ...baseConfig.rules,
21
49
  "react/prefer-destructuring-assignment": "off"
22
- }
50
+ })
23
51
  }, omittedConfig);
24
52
  const reactCompilerConfigs = await (0, _reactCompiler.reactCompiler)({
25
53
  setup: options?.reactCompilerSetup ?? {},
@@ -2,7 +2,6 @@ import type { ConfigOverrides, VpComposer } from "../types";
2
2
  declare namespace yaml {
3
3
  interface Options {
4
4
  yaml?: ConfigOverrides;
5
- sortKeys?: ConfigOverrides;
6
5
  }
7
6
  }
8
7
  declare const yaml: (composer: VpComposer, options?: yaml.Options) => void;
@@ -6,7 +6,6 @@ Object.defineProperty(exports, "__esModule", {
6
6
  exports.yaml = void 0;
7
7
  var _esToolkit = require("es-toolkit");
8
8
  var _eslintPluginYml = _interopRequireDefault(require("eslint-plugin-yml"));
9
- var _globs = require("../globs");
10
9
  var _extendsConfig = require("../utils/extendsConfig");
11
10
  var _mergeConfig = require("../utils/mergeConfig");
12
11
  var _renameRules = require("../utils/renameRules");
@@ -24,27 +23,5 @@ const yaml = (composer, options) => {
24
23
  }, omittedConfig);
25
24
  return [modifiedConfig, rulesConfig];
26
25
  });
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);
33
- const sortKeysConfig = (0, _mergeConfig.mergeConfig)(options?.sortKeys, {
34
- ...omittedConfig,
35
- name: "vdustr/yaml/sort-keys/rules",
36
- rules: {
37
- "yaml/sort-keys": ["error", {
38
- pathPattern: ".*",
39
- order: {
40
- type: "asc",
41
- caseSensitive: false,
42
- natural: true
43
- }
44
- }]
45
- }
46
- });
47
- return [config, sortKeysConfig];
48
- });
49
26
  };
50
27
  exports.yaml = yaml;
@@ -0,0 +1,3 @@
1
+ import type EslintReact from "@eslint-react/eslint-plugin";
2
+ declare const eslintReact: () => Promise<typeof EslintReact>;
3
+ export { eslintReact };
@@ -0,0 +1,9 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.eslintReact = void 0;
7
+ var _eslintConfig = require("@antfu/eslint-config");
8
+ const eslintReact = () => (0, _eslintConfig.interopDefault)(Promise.resolve().then(() => require("@eslint-react/eslint-plugin")));
9
+ exports.eslintReact = eslintReact;
@@ -4,14 +4,16 @@ import type { Arrayable, Awaitable, DefaultConfigNamesMap, FlatConfigComposer, S
4
4
  * <https://github.com/antfu/eslint-flat-config-utils/blob/ac3a9b4/src/composer.ts#L492-L512>
5
5
  */
6
6
  declare function getConfigIndex(configs: Array<Linter.Config>, nameOrIndex: string | number): number;
7
+ declare const tryGetConfigIndex: typeof getConfigIndex;
7
8
  /**
8
9
  * <https://github.com/antfu/eslint-flat-config-utils/blob/ac3a9b4/src/composer.ts#L91>
9
10
  */
10
11
  type Operation<T extends object = Linter.Config> = (items: Array<T>) => Promise<Array<T>>;
12
+ declare const pushOverations: <T extends object = Linter.Config, ConfigNames extends string = keyof DefaultConfigNamesMap>(composer: FlatConfigComposer<T, ConfigNames>, operations: Array<Operation<T>>) => void;
11
13
  declare function extendsConfigInternal<T extends object = Linter.Config, ConfigNames extends string = keyof DefaultConfigNamesMap>(composer: FlatConfigComposer<T, ConfigNames>, sourceOrIndex: StringLiteralUnion<ConfigNames, string | number>, config: Awaitable<Arrayable<T>> | ((config: T) => Awaitable<Arrayable<T>>)): void;
12
14
  declare const extendsConfig: typeof extendsConfigInternal & {
13
15
  getConfigIndex: typeof getConfigIndex;
14
- tryGetConfigIndex: typeof getConfigIndex;
15
- pushOverations: <T extends object = Linter.Config<Linter.RulesRecord>, ConfigNames extends string = never>(composer: FlatConfigComposer<T, ConfigNames>, operations: Array<Operation<T>>) => void;
16
+ tryGetConfigIndex: typeof tryGetConfigIndex;
17
+ pushOverations: typeof pushOverations;
16
18
  };
17
19
  export { extendsConfig };
package/dist/vdustr.d.ts CHANGED
@@ -10,6 +10,7 @@ import { tanstackQuery } from "./configs/tanstackQuery";
10
10
  import { imports } from "./extends/imports";
11
11
  import { javascript } from "./extends/javascript";
12
12
  import { jsonc } from "./extends/jsonc";
13
+ import { pnpm } from "./extends/pnpm";
13
14
  import { react } from "./extends/react";
14
15
  import { typescript } from "./extends/typescript";
15
16
  import { yaml } from "./extends/yaml";
@@ -22,6 +23,7 @@ type Options = ReplaceAntfuEslintRulesWithVpRulesDeeply<NonNullable<Parameters<t
22
23
  sort?: sort.Options;
23
24
  yaml?: yaml.Options;
24
25
  react?: react.Options;
26
+ pnpm?: pnpm.Options;
25
27
  };
26
28
  packageJson?: boolean | packageJson.Options;
27
29
  emotion?: boolean | emotion.Options;
package/dist/vdustr.js CHANGED
@@ -15,6 +15,7 @@ var _tanstackQuery = require("./configs/tanstackQuery");
15
15
  var _imports = require("./extends/imports");
16
16
  var _javascript = require("./extends/javascript");
17
17
  var _jsonc = require("./extends/jsonc");
18
+ var _pnpm = require("./extends/pnpm");
18
19
  var _react = require("./extends/react");
19
20
  var _sort = require("./extends/sort");
20
21
  var _typescript = require("./extends/typescript");
@@ -30,6 +31,7 @@ const vdustr = (options, ...userConfigs) => {
30
31
  const mdxEnabled = Boolean(vpOptions?.mdx ?? false);
31
32
  const storybookEnabled = Boolean(vpOptions?.storybook ?? false);
32
33
  const prettierEnabled = Boolean(vpOptions?.prettier ?? true);
34
+ const reactEnabled = Boolean(antfuOptions?.react ?? false);
33
35
  let config = (0, _eslintConfig.default)({
34
36
  ...antfuOptions,
35
37
  ...(!prettierEnabled ? null : {
@@ -46,7 +48,10 @@ const vdustr = (options, ...userConfigs) => {
46
48
  (0, _sort.sortJsonKeys)(config, vpOptions?.extends?.sort?.jsoncSortKeys);
47
49
  (0, _sort.sortJsonArrayValues)(config, vpOptions?.extends?.sort?.jsoncSortArrayValues);
48
50
  (0, _yaml.yaml)(config, vpOptions?.extends?.yaml);
49
- (0, _react.react)(config, vpOptions?.extends?.react);
51
+ if (reactEnabled) {
52
+ (0, _react.react)(config, vpOptions?.extends?.react);
53
+ }
54
+ (0, _pnpm.pnpm)(config, vpOptions?.extends?.pnpm);
50
55
  if (packageJsonEnabled) {
51
56
  const packageJsonOptions = typeof vpOptions?.packageJson !== "object" ? void 0 : vpOptions.packageJson;
52
57
  config = config.append((0, _packageJson.packageJson)(...(!packageJsonOptions ? [] : [packageJsonOptions])));
package/package.json CHANGED
@@ -1,13 +1,20 @@
1
1
  {
2
2
  "name": "@vp-tw/eslint-config",
3
- "version": "0.2.0",
3
+ "version": "1.0.4",
4
4
  "description": "ViPro's ESLint configuration",
5
5
  "homepage": "https://github.com/vdustr/eslint-config",
6
+ "license": "MIT",
6
7
  "author": {
7
8
  "name": "ViPro",
8
9
  "url": "https://vdustr.dev"
9
10
  },
11
+ "files": [
12
+ "dist"
13
+ ],
10
14
  "type": "module",
15
+ "main": "./dist/index.js",
16
+ "module": "./dist/esm/index.mjs",
17
+ "types": "./dist/index.d.ts",
11
18
  "exports": {
12
19
  ".": {
13
20
  "import": {
@@ -33,35 +40,51 @@
33
40
  "./package": "./package.json",
34
41
  "./package.json": "./package.json"
35
42
  },
36
- "main": "./dist/index.js",
37
- "module": "./dist/esm/index.mjs",
38
- "types": "./dist/index.d.ts",
39
- "files": [
40
- "dist"
41
- ],
43
+ "publishConfig": {
44
+ "access": "public"
45
+ },
46
+ "scripts": {
47
+ "build": "unbuild",
48
+ "copy": "tsx scripts/copy",
49
+ "prepare": "run-s typegen",
50
+ "prepublishOnly": "run-s copy build",
51
+ "typegen": "jiti scripts/typegen"
52
+ },
42
53
  "dependencies": {
43
- "@mui/types": "^7.4.2",
44
- "es-toolkit": "^1.39.10",
45
- "eslint-flat-config-utils": "^2.1.0",
46
- "local-pkg": "^1.1.2"
54
+ "@mui/types": "catalog:",
55
+ "@typescript-eslint/utils": "catalog:",
56
+ "es-toolkit": "catalog:",
57
+ "eslint-flat-config-utils": "catalog:",
58
+ "local-pkg": "catalog:"
47
59
  },
48
60
  "devDependencies": {
49
- "@antfu/eslint-config": "^5.4.1",
50
- "eslint-typegen": "^2.2.0",
51
- "unbuild": "^3.5.0"
61
+ "@antfu/eslint-config": "catalog:",
62
+ "@emotion/eslint-plugin": "catalog:",
63
+ "@tanstack/eslint-plugin-query": "catalog:",
64
+ "@types/eslint-config-prettier": "catalog:",
65
+ "eslint": "catalog:",
66
+ "eslint-config-prettier": "catalog:",
67
+ "eslint-plugin-mdx": "catalog:",
68
+ "eslint-plugin-package-json": "catalog:",
69
+ "eslint-plugin-react-compiler": "catalog:",
70
+ "eslint-plugin-storybook": "catalog:",
71
+ "eslint-plugin-yml": "catalog:",
72
+ "eslint-typegen": "catalog:",
73
+ "storybook": "catalog:",
74
+ "unbuild": "catalog:"
52
75
  },
53
76
  "peerDependencies": {
54
- "@emotion/eslint-plugin": "^11.12.0",
55
- "@tanstack/eslint-plugin-query": "^5.89.0",
56
- "@types/eslint-config-prettier": "^6.11.3",
57
- "eslint": "^9.36.0",
58
- "eslint-config-prettier": "^10.1.8",
59
- "eslint-plugin-mdx": "^3.6.2",
60
- "eslint-plugin-package-json": "^0.56.3",
61
- "eslint-plugin-react-compiler": "19.1.0-rc.2",
62
- "eslint-plugin-storybook": "^9.1.7",
63
- "eslint-plugin-yml": "^1.18.0",
64
- "storybook": "^9.1.7"
77
+ "@emotion/eslint-plugin": "catalog:",
78
+ "@tanstack/eslint-plugin-query": "catalog:",
79
+ "@types/eslint-config-prettier": "catalog:",
80
+ "eslint": "catalog:",
81
+ "eslint-config-prettier": "catalog:",
82
+ "eslint-plugin-mdx": "catalog:",
83
+ "eslint-plugin-package-json": "catalog:",
84
+ "eslint-plugin-react-compiler": "catalog:",
85
+ "eslint-plugin-storybook": "catalog:",
86
+ "eslint-plugin-yml": "catalog:",
87
+ "storybook": "catalog:"
65
88
  },
66
89
  "peerDependenciesMeta": {
67
90
  "@emotion/eslint-plugin": {
@@ -94,13 +117,5 @@
94
117
  "storybook": {
95
118
  "optional": true
96
119
  }
97
- },
98
- "publishConfig": {
99
- "access": "public"
100
- },
101
- "scripts": {
102
- "build": "unbuild",
103
- "copy": "tsx scripts/copy",
104
- "typegen": "jiti scripts/typegen"
105
120
  }
106
- }
121
+ }