@vp-tw/eslint-config 1.0.5 → 3.0.0
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/LICENSE +1 -1
- package/README.md +5 -11
- package/dist/configs/storybook.js +6 -1
- package/dist/eslint-typegen.d.ts +13 -2
- package/dist/esm/configs/storybook.mjs +12 -2
- package/dist/esm/eslint-typegen.d.ts +13 -2
- package/dist/esm/extends/_utils.d.ts +1 -1
- package/dist/esm/extends/react.mjs +14 -2
- package/dist/esm/types.d.ts +8 -6
- package/dist/esm/vdustr.d.ts +4 -3
- package/dist/esm/vdustr.mjs +3 -5
- package/dist/extends/_utils.d.ts +1 -1
- package/dist/extends/react.js +13 -1
- package/dist/types.d.ts +8 -6
- package/dist/vdustr.d.ts +4 -3
- package/dist/vdustr.js +3 -2
- package/package.json +34 -24
package/LICENSE
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
MIT License
|
|
2
2
|
|
|
3
|
-
Copyright (c) 2024-2025 ViPro <vdustr@gmail.com> (
|
|
3
|
+
Copyright (c) 2024-2025 ViPro <vdustr@gmail.com> (https://vdustr.github.io)
|
|
4
4
|
|
|
5
5
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
6
|
of this software and associated documentation files (the "Software"), to deal
|
package/README.md
CHANGED
|
@@ -14,7 +14,7 @@ ViPro's ESLint configuration.
|
|
|
14
14
|
- [eslint-config-prettier](https://github.com/prettier/eslint-config-prettier) - disables formatting rules to work with any formatter (Prettier, oxfmt, etc.)
|
|
15
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).
|
|
16
16
|
|
|
17
|
-
Check [here](https://
|
|
17
|
+
Check [here](https://vp-tw.github.io/eslint-config/) to preview the ESLint inspection.
|
|
18
18
|
|
|
19
19
|
## Installation
|
|
20
20
|
|
|
@@ -28,15 +28,7 @@ Similar to [antfu/eslint-config](https://github.com/antfu/eslint-config) but wit
|
|
|
28
28
|
|
|
29
29
|
```ts
|
|
30
30
|
// eslint.config.ts
|
|
31
|
-
import { fileURLToPath } from "node:url";
|
|
32
|
-
|
|
33
|
-
import { includeIgnoreFile } from "@eslint/compat";
|
|
34
31
|
import { vdustr } from "@vp-tw/eslint-config";
|
|
35
|
-
import path from "pathe";
|
|
36
|
-
|
|
37
|
-
const __filename = fileURLToPath(import.meta.url);
|
|
38
|
-
const __dirname = path.dirname(__filename);
|
|
39
|
-
const eslintignorePath = path.resolve(__dirname, ".eslintignore");
|
|
40
32
|
|
|
41
33
|
export default vdustr(
|
|
42
34
|
{
|
|
@@ -60,7 +52,9 @@ export default vdustr(
|
|
|
60
52
|
},
|
|
61
53
|
},
|
|
62
54
|
},
|
|
63
|
-
|
|
55
|
+
{
|
|
56
|
+
ignores: ["**/dist/**", "**/CHANGELOG.md", ".changeset/**"],
|
|
57
|
+
},
|
|
64
58
|
);
|
|
65
59
|
```
|
|
66
60
|
|
|
@@ -124,4 +118,4 @@ See [CLAUDE.md](./CLAUDE.md) for detailed architecture and patterns.
|
|
|
124
118
|
|
|
125
119
|
## License
|
|
126
120
|
|
|
127
|
-
MIT © ViPro <vdustr@gmail.com> (<
|
|
121
|
+
MIT © ViPro <vdustr@gmail.com> (<https://vdustr.github.io>)
|
|
@@ -8,6 +8,11 @@ var _eslintConfig = require("@antfu/eslint-config");
|
|
|
8
8
|
var _esToolkit = require("es-toolkit");
|
|
9
9
|
var _mergeConfig = require("../utils/mergeConfig");
|
|
10
10
|
var _renameRules = require("../utils/renameRules");
|
|
11
|
+
const storybookPluginRenaming = {
|
|
12
|
+
..._eslintConfig.defaultPluginRenaming,
|
|
13
|
+
"react-hooks": "react"
|
|
14
|
+
};
|
|
15
|
+
const renameStorybookRules = rules => (0, _eslintConfig.renameRules)(rules ?? {}, storybookPluginRenaming);
|
|
11
16
|
const storybook = async options => {
|
|
12
17
|
await (0, _eslintConfig.ensurePackages)(["eslint-plugin-storybook", "storybook"]);
|
|
13
18
|
const storybookPlugin = await (0, _eslintConfig.interopDefault)(Promise.resolve().then(() => require("eslint-plugin-storybook")));
|
|
@@ -37,7 +42,7 @@ const storybook = async options => {
|
|
|
37
42
|
}, {
|
|
38
43
|
...originalStoryRulesConfig,
|
|
39
44
|
...originalCsfStrictConfig,
|
|
40
|
-
rules: (
|
|
45
|
+
rules: renameStorybookRules({
|
|
41
46
|
...originalStoryRulesConfig.rules,
|
|
42
47
|
...originalCsfStrictConfig.rules
|
|
43
48
|
})
|
package/dist/eslint-typegen.d.ts
CHANGED
|
@@ -37,7 +37,7 @@ export interface RuleOptions {
|
|
|
37
37
|
* Exhaustive deps rule for useQuery
|
|
38
38
|
* @see https://tanstack.com/query/latest/docs/eslint/exhaustive-deps
|
|
39
39
|
*/
|
|
40
|
-
'@tanstack/query/exhaustive-deps'?: Linter.RuleEntry<
|
|
40
|
+
'@tanstack/query/exhaustive-deps'?: Linter.RuleEntry<TanstackQueryExhaustiveDeps>
|
|
41
41
|
/**
|
|
42
42
|
* Ensure correct order of inference sensitive properties for infinite queries
|
|
43
43
|
* @see https://tanstack.com/query/latest/docs/eslint/infinite-query-property-order
|
|
@@ -63,6 +63,11 @@ export interface RuleOptions {
|
|
|
63
63
|
* @see https://tanstack.com/query/latest/docs/eslint/no-void-query-fn
|
|
64
64
|
*/
|
|
65
65
|
'@tanstack/query/no-void-query-fn'?: Linter.RuleEntry<[]>
|
|
66
|
+
/**
|
|
67
|
+
* Prefer using queryOptions() to co-locate queryKey and queryFn
|
|
68
|
+
* @see https://tanstack.com/query/latest/docs/eslint/prefer-query-options
|
|
69
|
+
*/
|
|
70
|
+
'@tanstack/query/prefer-query-options'?: Linter.RuleEntry<[]>
|
|
66
71
|
/**
|
|
67
72
|
* Makes sure that QueryClient is stable
|
|
68
73
|
* @see https://tanstack.com/query/latest/docs/eslint/stable-query-client
|
|
@@ -166,6 +171,13 @@ type EmotionJsxImport = (string | {
|
|
|
166
171
|
})[]
|
|
167
172
|
// ----- @emotion/syntax-preference -----
|
|
168
173
|
type EmotionSyntaxPreference = []|[("string" | "object")]
|
|
174
|
+
// ----- @tanstack/query/exhaustive-deps -----
|
|
175
|
+
type TanstackQueryExhaustiveDeps = []|[{
|
|
176
|
+
allowlist?: {
|
|
177
|
+
variables?: string[]
|
|
178
|
+
types?: string[]
|
|
179
|
+
}
|
|
180
|
+
}]
|
|
169
181
|
// ----- react-compiler/react-compiler -----
|
|
170
182
|
type ReactCompilerReactCompiler = []|[{
|
|
171
183
|
[k: string]: unknown | undefined
|
|
@@ -178,7 +190,6 @@ type StorybookMetaInlineProperties = []|[{
|
|
|
178
190
|
type StorybookNoUninstalledAddons = []|[{
|
|
179
191
|
packageJsonLocation?: string
|
|
180
192
|
ignore?: string[]
|
|
181
|
-
[k: string]: unknown | undefined
|
|
182
193
|
}]
|
|
183
194
|
// Names of all the configs
|
|
184
195
|
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'
|
|
@@ -1,7 +1,17 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import {
|
|
2
|
+
renameRules as antfuRenameRules,
|
|
3
|
+
defaultPluginRenaming,
|
|
4
|
+
ensurePackages,
|
|
5
|
+
interopDefault
|
|
6
|
+
} from "@antfu/eslint-config";
|
|
2
7
|
import { pick } from "es-toolkit";
|
|
3
8
|
import { mergeConfig } from "../utils/mergeConfig.mjs";
|
|
4
9
|
import { renameRules } from "../utils/renameRules.mjs";
|
|
10
|
+
const storybookPluginRenaming = {
|
|
11
|
+
...defaultPluginRenaming,
|
|
12
|
+
"react-hooks": "react"
|
|
13
|
+
};
|
|
14
|
+
const renameStorybookRules = (rules) => antfuRenameRules(rules ?? {}, storybookPluginRenaming);
|
|
5
15
|
const storybook = async (options) => {
|
|
6
16
|
await ensurePackages(["eslint-plugin-storybook", "storybook"]);
|
|
7
17
|
const storybookPlugin = await interopDefault(import("eslint-plugin-storybook"));
|
|
@@ -34,7 +44,7 @@ const storybook = async (options) => {
|
|
|
34
44
|
{
|
|
35
45
|
...originalStoryRulesConfig,
|
|
36
46
|
...originalCsfStrictConfig,
|
|
37
|
-
rules:
|
|
47
|
+
rules: renameStorybookRules({
|
|
38
48
|
...originalStoryRulesConfig.rules,
|
|
39
49
|
...originalCsfStrictConfig.rules
|
|
40
50
|
})
|
|
@@ -37,7 +37,7 @@ export interface RuleOptions {
|
|
|
37
37
|
* Exhaustive deps rule for useQuery
|
|
38
38
|
* @see https://tanstack.com/query/latest/docs/eslint/exhaustive-deps
|
|
39
39
|
*/
|
|
40
|
-
'@tanstack/query/exhaustive-deps'?: Linter.RuleEntry<
|
|
40
|
+
'@tanstack/query/exhaustive-deps'?: Linter.RuleEntry<TanstackQueryExhaustiveDeps>
|
|
41
41
|
/**
|
|
42
42
|
* Ensure correct order of inference sensitive properties for infinite queries
|
|
43
43
|
* @see https://tanstack.com/query/latest/docs/eslint/infinite-query-property-order
|
|
@@ -63,6 +63,11 @@ export interface RuleOptions {
|
|
|
63
63
|
* @see https://tanstack.com/query/latest/docs/eslint/no-void-query-fn
|
|
64
64
|
*/
|
|
65
65
|
'@tanstack/query/no-void-query-fn'?: Linter.RuleEntry<[]>
|
|
66
|
+
/**
|
|
67
|
+
* Prefer using queryOptions() to co-locate queryKey and queryFn
|
|
68
|
+
* @see https://tanstack.com/query/latest/docs/eslint/prefer-query-options
|
|
69
|
+
*/
|
|
70
|
+
'@tanstack/query/prefer-query-options'?: Linter.RuleEntry<[]>
|
|
66
71
|
/**
|
|
67
72
|
* Makes sure that QueryClient is stable
|
|
68
73
|
* @see https://tanstack.com/query/latest/docs/eslint/stable-query-client
|
|
@@ -166,6 +171,13 @@ type EmotionJsxImport = (string | {
|
|
|
166
171
|
})[]
|
|
167
172
|
// ----- @emotion/syntax-preference -----
|
|
168
173
|
type EmotionSyntaxPreference = []|[("string" | "object")]
|
|
174
|
+
// ----- @tanstack/query/exhaustive-deps -----
|
|
175
|
+
type TanstackQueryExhaustiveDeps = []|[{
|
|
176
|
+
allowlist?: {
|
|
177
|
+
variables?: string[]
|
|
178
|
+
types?: string[]
|
|
179
|
+
}
|
|
180
|
+
}]
|
|
169
181
|
// ----- react-compiler/react-compiler -----
|
|
170
182
|
type ReactCompilerReactCompiler = []|[{
|
|
171
183
|
[k: string]: unknown | undefined
|
|
@@ -178,7 +190,6 @@ type StorybookMetaInlineProperties = []|[{
|
|
|
178
190
|
type StorybookNoUninstalledAddons = []|[{
|
|
179
191
|
packageJsonLocation?: string
|
|
180
192
|
ignore?: string[]
|
|
181
|
-
[k: string]: unknown | undefined
|
|
182
193
|
}]
|
|
183
194
|
// Names of all the configs
|
|
184
195
|
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'
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
declare const ignoreKeys: ("
|
|
1
|
+
declare const ignoreKeys: ("name" | "processor" | "plugins" | "rules")[];
|
|
2
2
|
export { ignoreKeys };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { GLOB_MARKDOWN_CODE } from "@antfu/eslint-config";
|
|
1
|
+
import { GLOB_MARKDOWN_CODE, interopDefault } 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";
|
|
@@ -31,6 +31,18 @@ function renameReactRules(rules) {
|
|
|
31
31
|
}
|
|
32
32
|
const react = (composer, options) => {
|
|
33
33
|
const typescriptEnabled = options?.typescript ?? true;
|
|
34
|
+
extendsConfig(composer, "antfu/react/setup", async (config) => {
|
|
35
|
+
const eslintReact = await importEslintReact();
|
|
36
|
+
const reactPlugin = eslintReact.configs.all.plugins?.["@eslint-react"];
|
|
37
|
+
const reactRefresh = await interopDefault(import("eslint-plugin-react-refresh"));
|
|
38
|
+
return {
|
|
39
|
+
...config,
|
|
40
|
+
plugins: {
|
|
41
|
+
react: reactPlugin,
|
|
42
|
+
"react-refresh": reactRefresh
|
|
43
|
+
}
|
|
44
|
+
};
|
|
45
|
+
});
|
|
34
46
|
extendsConfig(composer, "antfu/react/rules", async (config) => {
|
|
35
47
|
const eslintReact = await importEslintReact();
|
|
36
48
|
const modifiedConfig = mergeConfig(pick(options?.react ?? {}, ["files", "ignores"]), config);
|
|
@@ -63,7 +75,7 @@ const react = (composer, options) => {
|
|
|
63
75
|
files: [GLOB_MARKDOWN_CODE, GLOB_MDX_CODE],
|
|
64
76
|
rules: {
|
|
65
77
|
"react-compiler/react-compiler": "off",
|
|
66
|
-
"react
|
|
78
|
+
"react/rules-of-hooks": "off",
|
|
67
79
|
"react-refresh/only-export-components": "off"
|
|
68
80
|
}
|
|
69
81
|
}
|
package/dist/esm/types.d.ts
CHANGED
|
@@ -4,12 +4,14 @@ import type { DistributiveOmit, Overwrite } from "@mui/types";
|
|
|
4
4
|
import type { Linter } from "eslint";
|
|
5
5
|
import type { FlatConfigComposer } from "eslint-flat-config-utils";
|
|
6
6
|
import type { RuleOptions, ConfigNames as VpEslintConfigNames } from "./eslint-typegen";
|
|
7
|
+
declare module "@antfu/eslint-config" {
|
|
8
|
+
interface RuleOptions extends VpRuleOptions {
|
|
9
|
+
}
|
|
10
|
+
}
|
|
11
|
+
interface VpRuleOptions extends RuleOptions {
|
|
12
|
+
}
|
|
7
13
|
type AnyObject = Record<PropertyKey, any>;
|
|
8
|
-
type
|
|
9
|
-
[K in keyof T]: ReplaceAntfuEslintRulesWithVpRulesDeeply<T[K]>;
|
|
10
|
-
};
|
|
11
|
-
type ReplaceAntfuEslintRulesWithVpRulesDeeply<T> = (Extract<T, AntfuEslintRules> extends never ? never : Rules) | (ObjectReplaceAntfuEslintRulesWithRulesDeeply<Extract<T, AnyObject>> | Exclude<T, AnyObject>);
|
|
12
|
-
type Config = ReplaceAntfuEslintRulesWithVpRulesDeeply<NonNullable<Parameters<typeof antfu>[1]>>;
|
|
14
|
+
type Config = NonNullable<Parameters<typeof antfu>[1]>;
|
|
13
15
|
type Rules = RuleOptions & AntfuEslintRules;
|
|
14
16
|
type ConfigNames = VpEslintConfigNames | AntfuEslintConfigNames;
|
|
15
17
|
/**
|
|
@@ -30,4 +32,4 @@ interface ConfigOverrides extends Overwrite<DistributiveOmit<TypedFlatConfigItem
|
|
|
30
32
|
* Typed composer.
|
|
31
33
|
*/
|
|
32
34
|
type VpComposer = FlatConfigComposer<TypedFlatConfigItem, ConfigNames>;
|
|
33
|
-
export type { AnyObject, Config, ConfigNames, ConfigOverrides,
|
|
35
|
+
export type { AnyObject, Config, ConfigNames, ConfigOverrides, Rules, TypedFlatConfigItem, VpComposer, };
|
package/dist/esm/vdustr.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { sort } from "./extends/sort";
|
|
2
|
-
import type { Config,
|
|
2
|
+
import type { Config, VpComposer } from "./types";
|
|
3
3
|
import antfu from "@antfu/eslint-config";
|
|
4
4
|
import { emotion } from "./configs/emotion";
|
|
5
5
|
import { mdx } from "./configs/mdx";
|
|
@@ -14,7 +14,7 @@ import { pnpm } from "./extends/pnpm";
|
|
|
14
14
|
import { react } from "./extends/react";
|
|
15
15
|
import { typescript } from "./extends/typescript";
|
|
16
16
|
import { yaml } from "./extends/yaml";
|
|
17
|
-
|
|
17
|
+
interface VpOptions {
|
|
18
18
|
extends?: {
|
|
19
19
|
javascript?: javascript.Options;
|
|
20
20
|
imports?: imports.Options;
|
|
@@ -31,6 +31,7 @@ type Options = ReplaceAntfuEslintRulesWithVpRulesDeeply<NonNullable<Parameters<t
|
|
|
31
31
|
mdx?: boolean | mdx.Options;
|
|
32
32
|
storybook?: boolean | storybook.Options;
|
|
33
33
|
prettier?: boolean | prettier.Options;
|
|
34
|
-
}
|
|
34
|
+
}
|
|
35
|
+
type Options = NonNullable<Parameters<typeof antfu>[0]> & VpOptions;
|
|
35
36
|
declare const vdustr: (options?: Options, ...userConfigs: Array<Config>) => VpComposer;
|
|
36
37
|
export { vdustr };
|
package/dist/esm/vdustr.mjs
CHANGED
|
@@ -29,11 +29,9 @@ const ownedConfigNames = [
|
|
|
29
29
|
"prettier"
|
|
30
30
|
];
|
|
31
31
|
const vdustr = (options, ...userConfigs) => {
|
|
32
|
-
const
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
);
|
|
36
|
-
const vpOptions = pick(options ?? {}, ownedConfigNames);
|
|
32
|
+
const rawOptions = options ?? {};
|
|
33
|
+
const antfuOptions = omit(rawOptions, ownedConfigNames);
|
|
34
|
+
const vpOptions = pick(rawOptions, ownedConfigNames);
|
|
37
35
|
const packageJsonEnabled = Boolean(vpOptions?.packageJson ?? true);
|
|
38
36
|
const emotionEnabled = Boolean(vpOptions?.emotion ?? false);
|
|
39
37
|
const tanstackQueryEnabled = Boolean(vpOptions?.tanstackQuery ?? false);
|
package/dist/extends/_utils.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
declare const ignoreKeys: ("
|
|
1
|
+
declare const ignoreKeys: ("name" | "processor" | "plugins" | "rules")[];
|
|
2
2
|
export { ignoreKeys };
|
package/dist/extends/react.js
CHANGED
|
@@ -35,6 +35,18 @@ function renameReactRules(rules) {
|
|
|
35
35
|
}
|
|
36
36
|
const react = (composer, options) => {
|
|
37
37
|
const typescriptEnabled = options?.typescript ?? true;
|
|
38
|
+
(0, _extendsConfig.extendsConfig)(composer, "antfu/react/setup", async config => {
|
|
39
|
+
const eslintReact = await (0, _eslintReact.eslintReact)();
|
|
40
|
+
const reactPlugin = eslintReact.configs.all.plugins?.["@eslint-react"];
|
|
41
|
+
const reactRefresh = await (0, _eslintConfig.interopDefault)(Promise.resolve().then(() => require("eslint-plugin-react-refresh")));
|
|
42
|
+
return {
|
|
43
|
+
...config,
|
|
44
|
+
plugins: {
|
|
45
|
+
react: reactPlugin,
|
|
46
|
+
"react-refresh": reactRefresh
|
|
47
|
+
}
|
|
48
|
+
};
|
|
49
|
+
});
|
|
38
50
|
(0, _extendsConfig.extendsConfig)(composer, "antfu/react/rules", async config => {
|
|
39
51
|
const eslintReact = await (0, _eslintReact.eslintReact)();
|
|
40
52
|
const modifiedConfig = (0, _mergeConfig.mergeConfig)((0, _esToolkit.pick)(options?.react ?? {}, ["files", "ignores"]), config);
|
|
@@ -61,7 +73,7 @@ const react = (composer, options) => {
|
|
|
61
73
|
files: [_eslintConfig.GLOB_MARKDOWN_CODE, _globs.GLOB_MDX_CODE],
|
|
62
74
|
rules: {
|
|
63
75
|
"react-compiler/react-compiler": "off",
|
|
64
|
-
"react
|
|
76
|
+
"react/rules-of-hooks": "off",
|
|
65
77
|
"react-refresh/only-export-components": "off"
|
|
66
78
|
}
|
|
67
79
|
});
|
package/dist/types.d.ts
CHANGED
|
@@ -4,12 +4,14 @@ import type { DistributiveOmit, Overwrite } from "@mui/types";
|
|
|
4
4
|
import type { Linter } from "eslint";
|
|
5
5
|
import type { FlatConfigComposer } from "eslint-flat-config-utils";
|
|
6
6
|
import type { RuleOptions, ConfigNames as VpEslintConfigNames } from "./eslint-typegen";
|
|
7
|
+
declare module "@antfu/eslint-config" {
|
|
8
|
+
interface RuleOptions extends VpRuleOptions {
|
|
9
|
+
}
|
|
10
|
+
}
|
|
11
|
+
interface VpRuleOptions extends RuleOptions {
|
|
12
|
+
}
|
|
7
13
|
type AnyObject = Record<PropertyKey, any>;
|
|
8
|
-
type
|
|
9
|
-
[K in keyof T]: ReplaceAntfuEslintRulesWithVpRulesDeeply<T[K]>;
|
|
10
|
-
};
|
|
11
|
-
type ReplaceAntfuEslintRulesWithVpRulesDeeply<T> = (Extract<T, AntfuEslintRules> extends never ? never : Rules) | (ObjectReplaceAntfuEslintRulesWithRulesDeeply<Extract<T, AnyObject>> | Exclude<T, AnyObject>);
|
|
12
|
-
type Config = ReplaceAntfuEslintRulesWithVpRulesDeeply<NonNullable<Parameters<typeof antfu>[1]>>;
|
|
14
|
+
type Config = NonNullable<Parameters<typeof antfu>[1]>;
|
|
13
15
|
type Rules = RuleOptions & AntfuEslintRules;
|
|
14
16
|
type ConfigNames = VpEslintConfigNames | AntfuEslintConfigNames;
|
|
15
17
|
/**
|
|
@@ -30,4 +32,4 @@ interface ConfigOverrides extends Overwrite<DistributiveOmit<TypedFlatConfigItem
|
|
|
30
32
|
* Typed composer.
|
|
31
33
|
*/
|
|
32
34
|
type VpComposer = FlatConfigComposer<TypedFlatConfigItem, ConfigNames>;
|
|
33
|
-
export type { AnyObject, Config, ConfigNames, ConfigOverrides,
|
|
35
|
+
export type { AnyObject, Config, ConfigNames, ConfigOverrides, Rules, TypedFlatConfigItem, VpComposer, };
|
package/dist/vdustr.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { sort } from "./extends/sort";
|
|
2
|
-
import type { Config,
|
|
2
|
+
import type { Config, VpComposer } from "./types";
|
|
3
3
|
import antfu from "@antfu/eslint-config";
|
|
4
4
|
import { emotion } from "./configs/emotion";
|
|
5
5
|
import { mdx } from "./configs/mdx";
|
|
@@ -14,7 +14,7 @@ import { pnpm } from "./extends/pnpm";
|
|
|
14
14
|
import { react } from "./extends/react";
|
|
15
15
|
import { typescript } from "./extends/typescript";
|
|
16
16
|
import { yaml } from "./extends/yaml";
|
|
17
|
-
|
|
17
|
+
interface VpOptions {
|
|
18
18
|
extends?: {
|
|
19
19
|
javascript?: javascript.Options;
|
|
20
20
|
imports?: imports.Options;
|
|
@@ -31,6 +31,7 @@ type Options = ReplaceAntfuEslintRulesWithVpRulesDeeply<NonNullable<Parameters<t
|
|
|
31
31
|
mdx?: boolean | mdx.Options;
|
|
32
32
|
storybook?: boolean | storybook.Options;
|
|
33
33
|
prettier?: boolean | prettier.Options;
|
|
34
|
-
}
|
|
34
|
+
}
|
|
35
|
+
type Options = NonNullable<Parameters<typeof antfu>[0]> & VpOptions;
|
|
35
36
|
declare const vdustr: (options?: Options, ...userConfigs: Array<Config>) => VpComposer;
|
|
36
37
|
export { vdustr };
|
package/dist/vdustr.js
CHANGED
|
@@ -23,8 +23,9 @@ var _yaml = require("./extends/yaml");
|
|
|
23
23
|
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
24
24
|
const ownedConfigNames = ["extends", "packageJson", "emotion", "tanstackQuery", "mdx", "storybook", "prettier"];
|
|
25
25
|
const vdustr = (options, ...userConfigs) => {
|
|
26
|
-
const
|
|
27
|
-
const
|
|
26
|
+
const rawOptions = options ?? {};
|
|
27
|
+
const antfuOptions = (0, _esToolkit.omit)(rawOptions, ownedConfigNames);
|
|
28
|
+
const vpOptions = (0, _esToolkit.pick)(rawOptions, ownedConfigNames);
|
|
28
29
|
const packageJsonEnabled = Boolean(vpOptions?.packageJson ?? true);
|
|
29
30
|
const emotionEnabled = Boolean(vpOptions?.emotion ?? false);
|
|
30
31
|
const tanstackQueryEnabled = Boolean(vpOptions?.tanstackQuery ?? false);
|
package/package.json
CHANGED
|
@@ -1,17 +1,23 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vp-tw/eslint-config",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "3.0.0",
|
|
4
4
|
"description": "ViPro's ESLint configuration",
|
|
5
5
|
"homepage": "https://github.com/vdustr/eslint-config",
|
|
6
6
|
"license": "MIT",
|
|
7
7
|
"author": {
|
|
8
8
|
"name": "ViPro",
|
|
9
|
-
"url": "https://vdustr.
|
|
9
|
+
"url": "https://vdustr.github.io"
|
|
10
|
+
},
|
|
11
|
+
"repository": {
|
|
12
|
+
"type": "git",
|
|
13
|
+
"url": "git+https://github.com/vdustr/eslint-config.git",
|
|
14
|
+
"directory": "packages/eslint-config"
|
|
10
15
|
},
|
|
11
16
|
"files": [
|
|
12
17
|
"dist"
|
|
13
18
|
],
|
|
14
19
|
"type": "module",
|
|
20
|
+
"sideEffects": false,
|
|
15
21
|
"main": "./dist/index.js",
|
|
16
22
|
"module": "./dist/esm/index.mjs",
|
|
17
23
|
"types": "./dist/index.d.ts",
|
|
@@ -44,40 +50,40 @@
|
|
|
44
50
|
"access": "public"
|
|
45
51
|
},
|
|
46
52
|
"dependencies": {
|
|
47
|
-
"@mui/types": "^
|
|
48
|
-
"@typescript-eslint/utils": "^8.
|
|
49
|
-
"es-toolkit": "^1.
|
|
50
|
-
"eslint-flat-config-utils": "^3.
|
|
51
|
-
"local-pkg": "^1.1
|
|
53
|
+
"@mui/types": "^9.4.0",
|
|
54
|
+
"@typescript-eslint/utils": "^8.69.0",
|
|
55
|
+
"es-toolkit": "^1.52.0",
|
|
56
|
+
"eslint-flat-config-utils": "^3.2.0",
|
|
57
|
+
"local-pkg": "^1.2.1"
|
|
52
58
|
},
|
|
53
59
|
"devDependencies": {
|
|
54
|
-
"@antfu/eslint-config": "^
|
|
60
|
+
"@antfu/eslint-config": "^9.4.1",
|
|
55
61
|
"@emotion/eslint-plugin": "^11.12.0",
|
|
56
|
-
"@tanstack/eslint-plugin-query": "^5.
|
|
62
|
+
"@tanstack/eslint-plugin-query": "^5.102.8",
|
|
57
63
|
"@types/eslint-config-prettier": "^6.11.3",
|
|
58
|
-
"eslint": "^9.
|
|
64
|
+
"eslint": "^10.9.1",
|
|
59
65
|
"eslint-config-prettier": "^10.1.8",
|
|
60
|
-
"eslint-plugin-mdx": "^3.
|
|
61
|
-
"eslint-plugin-package-json": "^
|
|
66
|
+
"eslint-plugin-mdx": "^3.8.1",
|
|
67
|
+
"eslint-plugin-package-json": "^1.8.0",
|
|
62
68
|
"eslint-plugin-react-compiler": "19.1.0-rc.2",
|
|
63
|
-
"eslint-plugin-storybook": "^10.
|
|
64
|
-
"eslint-plugin-yml": "^3.
|
|
65
|
-
"eslint-typegen": "^2.
|
|
66
|
-
"storybook": "^10.
|
|
67
|
-
"unbuild": "^3.
|
|
69
|
+
"eslint-plugin-storybook": "^10.5.10",
|
|
70
|
+
"eslint-plugin-yml": "^3.8.1",
|
|
71
|
+
"eslint-typegen": "^2.3.1",
|
|
72
|
+
"storybook": "^10.5.10",
|
|
73
|
+
"unbuild": "^3.6.1"
|
|
68
74
|
},
|
|
69
75
|
"peerDependencies": {
|
|
70
76
|
"@emotion/eslint-plugin": "^11.12.0",
|
|
71
|
-
"@tanstack/eslint-plugin-query": "^5.
|
|
77
|
+
"@tanstack/eslint-plugin-query": "^5.102.8",
|
|
72
78
|
"@types/eslint-config-prettier": "^6.11.3",
|
|
73
|
-
"eslint": "^9.
|
|
79
|
+
"eslint": "^10.9.1",
|
|
74
80
|
"eslint-config-prettier": "^10.1.8",
|
|
75
|
-
"eslint-plugin-mdx": "^3.
|
|
76
|
-
"eslint-plugin-package-json": "^
|
|
81
|
+
"eslint-plugin-mdx": "^3.8.1",
|
|
82
|
+
"eslint-plugin-package-json": "^1.8.0",
|
|
77
83
|
"eslint-plugin-react-compiler": "19.1.0-rc.2",
|
|
78
|
-
"eslint-plugin-storybook": "^10.
|
|
79
|
-
"eslint-plugin-yml": "^3.
|
|
80
|
-
"storybook": "^10.
|
|
84
|
+
"eslint-plugin-storybook": "^10.5.10",
|
|
85
|
+
"eslint-plugin-yml": "^3.8.1",
|
|
86
|
+
"storybook": "^10.5.10"
|
|
81
87
|
},
|
|
82
88
|
"peerDependenciesMeta": {
|
|
83
89
|
"@emotion/eslint-plugin": {
|
|
@@ -111,7 +117,11 @@
|
|
|
111
117
|
"optional": true
|
|
112
118
|
}
|
|
113
119
|
},
|
|
120
|
+
"engines": {
|
|
121
|
+
"node": "^22.22.2 || >=24.15.0"
|
|
122
|
+
},
|
|
114
123
|
"scripts": {
|
|
124
|
+
"prebuild": "run-s copy",
|
|
115
125
|
"build": "unbuild",
|
|
116
126
|
"copy": "tsx scripts/copy",
|
|
117
127
|
"typegen": "jiti scripts/typegen"
|