@vp-tw/eslint-config 0.1.6 → 1.0.2
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 +42 -11
- package/dist/configs/packageJson.js +4 -1
- package/dist/configs/tanstackQuery.js +5 -3
- package/dist/eslint-typegen.d.ts +1 -1
- package/dist/esm/configs/mdx.mjs +2 -10
- package/dist/esm/configs/packageJson.mjs +5 -4
- package/dist/esm/configs/prettier.mjs +1 -3
- package/dist/esm/configs/storybook.mjs +2 -8
- package/dist/esm/configs/tanstackQuery.mjs +7 -6
- package/dist/esm/eslint-typegen.d.ts +1 -1
- package/dist/esm/extends/_utils.d.ts +1 -1
- package/dist/esm/extends/imports.mjs +1 -4
- package/dist/esm/extends/pnpm.d.ts +8 -0
- package/dist/esm/extends/pnpm.mjs +33 -0
- package/dist/esm/extends/react.d.ts +1 -0
- package/dist/esm/extends/react.mjs +33 -10
- package/dist/esm/extends/sort.mjs +2 -8
- package/dist/esm/extends/yaml.d.ts +0 -1
- package/dist/esm/extends/yaml.mjs +1 -33
- package/dist/esm/lib/eslint-plugin-react-compiler.mjs +1 -3
- package/dist/esm/utils/extendsConfig.d.ts +4 -2
- package/dist/esm/vdustr.d.ts +2 -0
- package/dist/esm/vdustr.mjs +10 -23
- package/dist/extends/_utils.d.ts +1 -1
- package/dist/extends/pnpm.d.ts +8 -0
- package/dist/extends/pnpm.js +36 -0
- package/dist/extends/react.d.ts +1 -0
- package/dist/extends/react.js +30 -2
- package/dist/extends/yaml.d.ts +0 -1
- package/dist/extends/yaml.js +0 -23
- package/dist/utils/extendsConfig.d.ts +4 -2
- package/dist/vdustr.d.ts +2 -0
- package/dist/vdustr.js +2 -0
- package/package.json +33 -20
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-
|
|
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
|
-
|
|
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,25 +36,55 @@ import path from "pathe";
|
|
|
35
36
|
|
|
36
37
|
const __filename = fileURLToPath(import.meta.url);
|
|
37
38
|
const __dirname = path.dirname(__filename);
|
|
38
|
-
const
|
|
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
|
-
//
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
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(
|
|
63
|
+
includeIgnoreFile(eslintignorePath),
|
|
54
64
|
);
|
|
55
65
|
```
|
|
56
66
|
|
|
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
|
+
|
|
57
88
|
## Release
|
|
58
89
|
|
|
59
90
|
```bash
|
|
@@ -18,7 +18,10 @@ 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)(
|
|
21
|
+
rules: (0, _renameRules.renameRules)({
|
|
22
|
+
...recommended.rules,
|
|
23
|
+
"package-json/order-properties": "off"
|
|
24
|
+
}),
|
|
22
25
|
name: "vdustr/package-json/rules"
|
|
23
26
|
});
|
|
24
27
|
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
|
|
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)(
|
|
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
|
-
...
|
|
21
|
+
...setupConfig,
|
|
20
22
|
name: "vdustr/tanstack-query/rules"
|
|
21
23
|
});
|
|
22
24
|
return [tanstackQuerySetupConfig, tanstackQueryRulesConfig];
|
package/dist/eslint-typegen.d.ts
CHANGED
|
@@ -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/
|
|
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
|
|
package/dist/esm/configs/mdx.mjs
CHANGED
|
@@ -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,10 @@ const packageJson = async (options) => {
|
|
|
14
12
|
};
|
|
15
13
|
const packageJsonRulesConfig = mergeConfig(options?.packageJson, {
|
|
16
14
|
...omit(recommended, ["name", "plugins"]),
|
|
17
|
-
rules: renameRules(
|
|
15
|
+
rules: renameRules({
|
|
16
|
+
...recommended.rules,
|
|
17
|
+
"package-json/order-properties": "off"
|
|
18
|
+
}),
|
|
18
19
|
name: "vdustr/package-json/rules"
|
|
19
20
|
});
|
|
20
21
|
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
|
-
|
|
8
|
-
|
|
9
|
-
|
|
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(
|
|
12
|
+
...pick(setupConfig, ["plugins"]),
|
|
12
13
|
name: "vdustr/tanstack-query/setup"
|
|
13
14
|
};
|
|
14
15
|
const tanstackQueryRulesConfig = mergeConfig(options?.tanstackQuery, {
|
|
15
|
-
...
|
|
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/
|
|
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,2 +1,2 @@
|
|
|
1
|
-
declare const ignoreKeys: ("plugins" | "
|
|
1
|
+
declare const ignoreKeys: ("plugins" | "rules" | "name" | "processor")[];
|
|
2
2
|
export { ignoreKeys };
|
|
@@ -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,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;
|
|
@@ -1,33 +1,56 @@
|
|
|
1
1
|
import { GLOB_MARKDOWN_CODE } from "@antfu/eslint-config";
|
|
2
|
+
import eslintReact from "@eslint-react/eslint-plugin";
|
|
2
3
|
import { omit, pick } from "es-toolkit";
|
|
3
4
|
import { reactCompiler } from "../configs/reactCompiler.mjs";
|
|
4
5
|
import { GLOB_MDX_CODE } from "../globs.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 modifiedConfig = mergeConfig(pick(options?.react ?? {}, ["files", "ignores"]), config);
|
|
14
36
|
const omittedConfig = omit(modifiedConfig, ignoreKeys);
|
|
37
|
+
const baseConfig = typescriptEnabled ? eslintReact.configs["strict-typescript"] : eslintReact.configs.strict;
|
|
15
38
|
const rulesConfig = mergeConfig(
|
|
16
39
|
omit(options?.react ?? {}, ["files", "ignores"]),
|
|
17
40
|
{
|
|
41
|
+
// plugins already setup by antfu
|
|
42
|
+
...omit(baseConfig, ["plugins"]),
|
|
18
43
|
name: "vdustr/react/rules",
|
|
19
|
-
rules: {
|
|
44
|
+
rules: renameReactRules({
|
|
45
|
+
...baseConfig.rules,
|
|
20
46
|
"react/prefer-destructuring-assignment": "off"
|
|
21
|
-
}
|
|
47
|
+
})
|
|
22
48
|
},
|
|
23
49
|
omittedConfig
|
|
24
50
|
);
|
|
25
51
|
const reactCompilerConfigs = await reactCompiler({
|
|
26
52
|
setup: options?.reactCompilerSetup ?? {},
|
|
27
|
-
reactCompiler: mergeConfig(
|
|
28
|
-
options?.reactCompiler,
|
|
29
|
-
pick(omittedConfig, ["files", "ignores"])
|
|
30
|
-
)
|
|
53
|
+
reactCompiler: mergeConfig(options?.reactCompiler, pick(omittedConfig, ["files", "ignores"]))
|
|
31
54
|
});
|
|
32
55
|
const mdConfig = mergeConfig(
|
|
33
56
|
{
|
|
@@ -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,
|
|
@@ -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 };
|
|
@@ -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
|
|
15
|
-
pushOverations:
|
|
16
|
+
tryGetConfigIndex: typeof tryGetConfigIndex;
|
|
17
|
+
pushOverations: typeof pushOverations;
|
|
16
18
|
};
|
|
17
19
|
export { extendsConfig };
|
package/dist/esm/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/esm/vdustr.mjs
CHANGED
|
@@ -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,9 +36,7 @@ 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);
|
|
@@ -52,44 +51,34 @@ const vdustr = (options, ...userConfigs) => {
|
|
|
52
51
|
imports(config, vpOptions?.extends?.imports);
|
|
53
52
|
typescript(config, vpOptions?.extends?.typescript);
|
|
54
53
|
jsonc(config, vpOptions?.extends?.jsonc);
|
|
55
|
-
if (packageJsonEnabled)
|
|
56
|
-
sortPackageJson(config, vpOptions?.extends?.sort?.packageJson);
|
|
54
|
+
if (packageJsonEnabled) sortPackageJson(config, vpOptions?.extends?.sort?.packageJson);
|
|
57
55
|
sortTsconfigJson(config, vpOptions?.extends?.sort?.tsconfigJson);
|
|
58
56
|
sortJsonKeys(config, vpOptions?.extends?.sort?.jsoncSortKeys);
|
|
59
57
|
sortJsonArrayValues(config, vpOptions?.extends?.sort?.jsoncSortArrayValues);
|
|
60
58
|
yaml(config, vpOptions?.extends?.yaml);
|
|
61
59
|
react(config, vpOptions?.extends?.react);
|
|
60
|
+
pnpm(config, vpOptions?.extends?.pnpm);
|
|
62
61
|
if (packageJsonEnabled) {
|
|
63
62
|
const packageJsonOptions = typeof vpOptions?.packageJson !== "object" ? void 0 : vpOptions.packageJson;
|
|
64
|
-
config = config.append(
|
|
65
|
-
packageJson(...!packageJsonOptions ? [] : [packageJsonOptions])
|
|
66
|
-
);
|
|
63
|
+
config = config.append(packageJson(...!packageJsonOptions ? [] : [packageJsonOptions]));
|
|
67
64
|
}
|
|
68
65
|
if (emotionEnabled) {
|
|
69
66
|
const emotionOptions = typeof vpOptions?.emotion !== "object" ? void 0 : vpOptions.emotion;
|
|
70
|
-
config = config.append(
|
|
71
|
-
emotion(...!emotionOptions ? [] : [emotionOptions])
|
|
72
|
-
);
|
|
67
|
+
config = config.append(emotion(...!emotionOptions ? [] : [emotionOptions]));
|
|
73
68
|
}
|
|
74
69
|
if (tanstackQueryEnabled) {
|
|
75
70
|
const tanstackQueryOptions = typeof vpOptions?.tanstackQuery !== "object" ? void 0 : vpOptions.tanstackQuery;
|
|
76
|
-
config = config.append(
|
|
77
|
-
tanstackQuery(...!tanstackQueryOptions ? [] : [tanstackQueryOptions])
|
|
78
|
-
);
|
|
71
|
+
config = config.append(tanstackQuery(...!tanstackQueryOptions ? [] : [tanstackQueryOptions]));
|
|
79
72
|
}
|
|
80
73
|
if (storybookEnabled) {
|
|
81
74
|
const storybookOptions = typeof vpOptions?.storybook !== "object" ? void 0 : vpOptions.storybook;
|
|
82
|
-
config = config.append(
|
|
83
|
-
storybook(...!storybookOptions ? [] : [storybookOptions])
|
|
84
|
-
);
|
|
75
|
+
config = config.append(storybook(...!storybookOptions ? [] : [storybookOptions]));
|
|
85
76
|
}
|
|
86
77
|
if (mdxEnabled) {
|
|
87
78
|
const mdxOptions = {
|
|
88
79
|
...typeof vpOptions?.mdx !== "object" ? null : vpOptions.mdx
|
|
89
80
|
};
|
|
90
|
-
const mdxFlatCodeBlocksEnabled = Boolean(
|
|
91
|
-
mdxOptions?.codeBlocks ?? true
|
|
92
|
-
);
|
|
81
|
+
const mdxFlatCodeBlocksEnabled = Boolean(mdxOptions?.codeBlocks ?? true);
|
|
93
82
|
const mdxFlatCodeBlocksOptions = {
|
|
94
83
|
...typeof mdxOptions?.codeBlocks !== "object" ? null : mdxOptions.codeBlocks
|
|
95
84
|
};
|
|
@@ -102,9 +91,7 @@ const vdustr = (options, ...userConfigs) => {
|
|
|
102
91
|
}
|
|
103
92
|
if (prettierEnabled) {
|
|
104
93
|
const prettierOptions = typeof vpOptions?.prettier !== "object" ? void 0 : vpOptions.prettier;
|
|
105
|
-
config = config.append(
|
|
106
|
-
prettier(...!prettierOptions ? [] : [prettierOptions])
|
|
107
|
-
);
|
|
94
|
+
config = config.append(prettier(...!prettierOptions ? [] : [prettierOptions]));
|
|
108
95
|
}
|
|
109
96
|
config.append(...userConfigs);
|
|
110
97
|
return config;
|
package/dist/extends/_utils.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
declare const ignoreKeys: ("plugins" | "
|
|
1
|
+
declare const ignoreKeys: ("plugins" | "rules" | "name" | "processor")[];
|
|
2
2
|
export { ignoreKeys };
|
|
@@ -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;
|
package/dist/extends/react.d.ts
CHANGED
|
@@ -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;
|
package/dist/extends/react.js
CHANGED
|
@@ -5,21 +5,49 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
});
|
|
6
6
|
exports.react = void 0;
|
|
7
7
|
var _eslintConfig = require("@antfu/eslint-config");
|
|
8
|
+
var _eslintPlugin = _interopRequireDefault(require("@eslint-react/eslint-plugin"));
|
|
8
9
|
var _esToolkit = require("es-toolkit");
|
|
9
10
|
var _reactCompiler = require("../configs/reactCompiler");
|
|
10
11
|
var _globs = require("../globs");
|
|
11
12
|
var _extendsConfig = require("../utils/extendsConfig");
|
|
12
13
|
var _mergeConfig = require("../utils/mergeConfig");
|
|
13
14
|
var _utils = require("./_utils");
|
|
15
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
16
|
+
const reactRulesRenameMap = {
|
|
17
|
+
"@eslint-react": "react",
|
|
18
|
+
"@eslint-react/dom": "react-dom",
|
|
19
|
+
"@eslint-react/hooks-extra": "react-hooks-extra",
|
|
20
|
+
"@eslint-react/naming-convention": "react-naming-convention",
|
|
21
|
+
"@eslint-react/web-api": "react-web-api"
|
|
22
|
+
};
|
|
23
|
+
function renameReactRules(rules) {
|
|
24
|
+
return Object.fromEntries(Object.entries(rules).map(([key, value]) => {
|
|
25
|
+
const namespaceArray = key.split("/");
|
|
26
|
+
const namespace = namespaceArray.slice(0, -1).join("/");
|
|
27
|
+
if (namespace in reactRulesRenameMap) {
|
|
28
|
+
const newNamespace = reactRulesRenameMap[namespace];
|
|
29
|
+
if (newNamespace) {
|
|
30
|
+
const newKey = key.replace(namespace, newNamespace);
|
|
31
|
+
return [newKey, value];
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
return [key, value];
|
|
35
|
+
}));
|
|
36
|
+
}
|
|
14
37
|
const react = (composer, options) => {
|
|
38
|
+
const typescriptEnabled = options?.typescript ?? true;
|
|
15
39
|
(0, _extendsConfig.extendsConfig)(composer, "antfu/react/rules", async config => {
|
|
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 ? _eslintPlugin.default.configs["strict-typescript"] : _eslintPlugin.default.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 ?? {},
|
package/dist/extends/yaml.d.ts
CHANGED
package/dist/extends/yaml.js
CHANGED
|
@@ -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;
|
|
@@ -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
|
|
15
|
-
pushOverations:
|
|
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");
|
|
@@ -47,6 +48,7 @@ const vdustr = (options, ...userConfigs) => {
|
|
|
47
48
|
(0, _sort.sortJsonArrayValues)(config, vpOptions?.extends?.sort?.jsoncSortArrayValues);
|
|
48
49
|
(0, _yaml.yaml)(config, vpOptions?.extends?.yaml);
|
|
49
50
|
(0, _react.react)(config, vpOptions?.extends?.react);
|
|
51
|
+
(0, _pnpm.pnpm)(config, vpOptions?.extends?.pnpm);
|
|
50
52
|
if (packageJsonEnabled) {
|
|
51
53
|
const packageJsonOptions = typeof vpOptions?.packageJson !== "object" ? void 0 : vpOptions.packageJson;
|
|
52
54
|
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.
|
|
3
|
+
"version": "1.0.2",
|
|
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,44 @@
|
|
|
33
40
|
"./package": "./package.json",
|
|
34
41
|
"./package.json": "./package.json"
|
|
35
42
|
},
|
|
36
|
-
"
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
"files": [
|
|
40
|
-
"dist"
|
|
41
|
-
],
|
|
43
|
+
"publishConfig": {
|
|
44
|
+
"access": "public"
|
|
45
|
+
},
|
|
42
46
|
"dependencies": {
|
|
43
47
|
"@mui/types": "^7.4.2",
|
|
44
|
-
"
|
|
45
|
-
"
|
|
46
|
-
"
|
|
48
|
+
"@typescript-eslint/utils": "^8.54.0",
|
|
49
|
+
"es-toolkit": "^1.44.0",
|
|
50
|
+
"eslint-flat-config-utils": "^3.0.0",
|
|
51
|
+
"local-pkg": "^1.1.2"
|
|
47
52
|
},
|
|
48
53
|
"devDependencies": {
|
|
54
|
+
"@antfu/eslint-config": "^7.2.0",
|
|
55
|
+
"@emotion/eslint-plugin": "^11.12.0",
|
|
56
|
+
"@tanstack/eslint-plugin-query": "^5.91.3",
|
|
57
|
+
"@types/eslint-config-prettier": "^6.11.3",
|
|
58
|
+
"eslint": "^9.39.2",
|
|
59
|
+
"eslint-config-prettier": "^10.1.8",
|
|
60
|
+
"eslint-plugin-mdx": "^3.6.2",
|
|
61
|
+
"eslint-plugin-package-json": "^0.88.2",
|
|
62
|
+
"eslint-plugin-react-compiler": "19.1.0-rc.2",
|
|
63
|
+
"eslint-plugin-storybook": "^10.2.1",
|
|
64
|
+
"eslint-plugin-yml": "^3.0.0",
|
|
49
65
|
"eslint-typegen": "^2.2.0",
|
|
66
|
+
"storybook": "^10.2.1",
|
|
50
67
|
"unbuild": "^3.5.0"
|
|
51
68
|
},
|
|
52
69
|
"peerDependencies": {
|
|
53
|
-
"@antfu/eslint-config": "^4.17.0",
|
|
54
70
|
"@emotion/eslint-plugin": "^11.12.0",
|
|
55
|
-
"@tanstack/eslint-plugin-query": "^5.
|
|
71
|
+
"@tanstack/eslint-plugin-query": "^5.91.3",
|
|
56
72
|
"@types/eslint-config-prettier": "^6.11.3",
|
|
57
|
-
"eslint": "^9.
|
|
73
|
+
"eslint": "^9.39.2",
|
|
58
74
|
"eslint-config-prettier": "^10.1.8",
|
|
59
75
|
"eslint-plugin-mdx": "^3.6.2",
|
|
60
|
-
"eslint-plugin-package-json": "^0.
|
|
76
|
+
"eslint-plugin-package-json": "^0.88.2",
|
|
61
77
|
"eslint-plugin-react-compiler": "19.1.0-rc.2",
|
|
62
|
-
"eslint-plugin-storybook": "^
|
|
63
|
-
"eslint-plugin-yml": "^
|
|
64
|
-
"storybook": "^
|
|
78
|
+
"eslint-plugin-storybook": "^10.2.1",
|
|
79
|
+
"eslint-plugin-yml": "^3.0.0",
|
|
80
|
+
"storybook": "^10.2.1"
|
|
65
81
|
},
|
|
66
82
|
"peerDependenciesMeta": {
|
|
67
83
|
"@emotion/eslint-plugin": {
|
|
@@ -95,9 +111,6 @@
|
|
|
95
111
|
"optional": true
|
|
96
112
|
}
|
|
97
113
|
},
|
|
98
|
-
"publishConfig": {
|
|
99
|
-
"access": "public"
|
|
100
|
-
},
|
|
101
114
|
"scripts": {
|
|
102
115
|
"build": "unbuild",
|
|
103
116
|
"copy": "tsx scripts/copy",
|