@vp-tw/eslint-config 0.0.20 → 0.0.22
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 +10 -0
- package/dist/configs/mdx.js +17 -8
- package/dist/esm/configs/mdx.mjs +29 -16
- package/dist/esm/extends/javascript.mjs +0 -2
- package/dist/esm/types.d.ts +7 -2
- package/dist/esm/vdustr.d.ts +2 -2
- package/dist/esm/vdustr.mjs +1 -7
- package/dist/extends/javascript.js +0 -2
- package/dist/types.d.ts +7 -2
- package/dist/vdustr.d.ts +2 -2
- package/dist/vdustr.js +1 -7
- package/package.json +1 -1
package/README.md
CHANGED
package/dist/configs/mdx.js
CHANGED
|
@@ -29,24 +29,33 @@ const mdx = async ({
|
|
|
29
29
|
name: "vdustr/mdx/processor"
|
|
30
30
|
};
|
|
31
31
|
const rulesConfig = (0, _defu.default)(options.mdx, {
|
|
32
|
-
|
|
33
|
-
name: "vdustr/mdx/rules",
|
|
34
|
-
rules: (0, _renameRules.renameRules)(mdxPlugin.flat.rules ?? {}),
|
|
32
|
+
ignores: [
|
|
35
33
|
/**
|
|
36
34
|
* Handled by `@eslint/markdown`.
|
|
37
35
|
*/
|
|
38
|
-
|
|
36
|
+
_eslintConfig.GLOB_MARKDOWN]
|
|
37
|
+
}, {
|
|
38
|
+
...(0, _esToolkit.omit)(mdxPlugin.flat, ["plugins", "processor"]),
|
|
39
|
+
name: "vdustr/mdx/rules",
|
|
40
|
+
rules: (0, _renameRules.renameRules)(mdxPlugin.flat.rules ?? {}),
|
|
41
|
+
ignores: mdxPlugin.flat.ignores ?? []
|
|
39
42
|
});
|
|
40
43
|
const configs = [setupConfig, processorConfig, rulesConfig];
|
|
41
44
|
if (codeBlocks) {
|
|
42
45
|
const codeBlocksConfig = (0, _defu.default)(codeBlocksOptions, {
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
+
rules: {
|
|
47
|
+
"import/no-default-export": "off"
|
|
48
|
+
},
|
|
49
|
+
ignores: [
|
|
46
50
|
/**
|
|
47
51
|
* Handled by `@eslint/markdown`.
|
|
48
52
|
*/
|
|
49
|
-
|
|
53
|
+
_eslintConfig.GLOB_MARKDOWN_CODE]
|
|
54
|
+
}, {
|
|
55
|
+
...mdxPlugin.flatCodeBlocks,
|
|
56
|
+
name: "vdustr/mdx/code-blocks",
|
|
57
|
+
rules: (0, _renameRules.renameRules)(mdxPlugin.flatCodeBlocks.rules ?? {}),
|
|
58
|
+
ignores: mdxPlugin.flatCodeBlocks.ignores ?? []
|
|
50
59
|
});
|
|
51
60
|
configs.push(codeBlocksConfig);
|
|
52
61
|
}
|
package/dist/esm/configs/mdx.mjs
CHANGED
|
@@ -28,30 +28,43 @@ const mdx = async ({
|
|
|
28
28
|
};
|
|
29
29
|
const rulesConfig = defu(
|
|
30
30
|
options.mdx,
|
|
31
|
+
{
|
|
32
|
+
ignores: [
|
|
33
|
+
/**
|
|
34
|
+
* Handled by `@eslint/markdown`.
|
|
35
|
+
*/
|
|
36
|
+
GLOB_MARKDOWN
|
|
37
|
+
]
|
|
38
|
+
},
|
|
31
39
|
{
|
|
32
40
|
...omit(mdxPlugin.flat, ["plugins", "processor"]),
|
|
33
41
|
name: "vdustr/mdx/rules",
|
|
34
42
|
rules: renameRules(mdxPlugin.flat.rules ?? {}),
|
|
35
|
-
|
|
36
|
-
* Handled by `@eslint/markdown`.
|
|
37
|
-
*/
|
|
38
|
-
ignores: [...mdxPlugin.flat.ignores ?? [], GLOB_MARKDOWN]
|
|
43
|
+
ignores: mdxPlugin.flat.ignores ?? []
|
|
39
44
|
}
|
|
40
45
|
);
|
|
41
46
|
const configs = [setupConfig, processorConfig, rulesConfig];
|
|
42
47
|
if (codeBlocks) {
|
|
43
|
-
const codeBlocksConfig = defu(
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
48
|
+
const codeBlocksConfig = defu(
|
|
49
|
+
codeBlocksOptions,
|
|
50
|
+
{
|
|
51
|
+
rules: {
|
|
52
|
+
"import/no-default-export": "off"
|
|
53
|
+
},
|
|
54
|
+
ignores: [
|
|
55
|
+
/**
|
|
56
|
+
* Handled by `@eslint/markdown`.
|
|
57
|
+
*/
|
|
58
|
+
GLOB_MARKDOWN_CODE
|
|
59
|
+
]
|
|
60
|
+
},
|
|
61
|
+
{
|
|
62
|
+
...mdxPlugin.flatCodeBlocks,
|
|
63
|
+
name: "vdustr/mdx/code-blocks",
|
|
64
|
+
rules: renameRules(mdxPlugin.flatCodeBlocks.rules ?? {}),
|
|
65
|
+
ignores: mdxPlugin.flatCodeBlocks.ignores ?? []
|
|
66
|
+
}
|
|
67
|
+
);
|
|
55
68
|
configs.push(codeBlocksConfig);
|
|
56
69
|
}
|
|
57
70
|
return configs;
|
|
@@ -21,8 +21,6 @@ const javascript = (composer, options) => {
|
|
|
21
21
|
*/
|
|
22
22
|
"no-unused-vars": "off",
|
|
23
23
|
"unused-imports/no-unused-vars": "off",
|
|
24
|
-
"unused-imports/no-unused-imports-ts": "off",
|
|
25
|
-
"unused-imports/no-unused-vars-ts": "off",
|
|
26
24
|
"unused-imports/no-unused-imports": "off"
|
|
27
25
|
}
|
|
28
26
|
},
|
package/dist/esm/types.d.ts
CHANGED
|
@@ -4,7 +4,12 @@ import type { DistributiveOmit } 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
|
-
type
|
|
7
|
+
type AnyObject = Record<PropertyKey, any>;
|
|
8
|
+
type ObjectReplaceAntfuEslintRulesWithRulesDeeply<T extends AnyObject> = (Extract<T, AntfuEslintRules> extends never ? never : Rules) | {
|
|
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]>>;
|
|
8
13
|
type Rules = RuleOptions & AntfuEslintRules;
|
|
9
14
|
type ConfigNames = VpEslintConfigNames | AntfuEslintConfigNames;
|
|
10
15
|
/**
|
|
@@ -19,4 +24,4 @@ interface ConfigOverrides extends DistributiveOmit<TypedFlatConfigItem, "process
|
|
|
19
24
|
* Typed composer.
|
|
20
25
|
*/
|
|
21
26
|
type VpComposer = FlatConfigComposer<TypedFlatConfigItem, ConfigNames>;
|
|
22
|
-
export type { Config, ConfigNames, ConfigOverrides, TypedFlatConfigItem, VpComposer, };
|
|
27
|
+
export type { AnyObject, Config, ConfigNames, ConfigOverrides, ReplaceAntfuEslintRulesWithVpRulesDeeply, TypedFlatConfigItem, VpComposer, };
|
package/dist/esm/vdustr.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { Config, VpComposer } from "./types";
|
|
1
|
+
import type { Config, ReplaceAntfuEslintRulesWithVpRulesDeeply, VpComposer } from "./types";
|
|
2
2
|
import antfu from "@antfu/eslint-config";
|
|
3
3
|
import { mdx } from "./configs/mdx";
|
|
4
4
|
import { prettier } from "./configs/prettier";
|
|
@@ -9,7 +9,7 @@ import { jsonc } from "./extends/jsonc";
|
|
|
9
9
|
import { react } from "./extends/react";
|
|
10
10
|
import { typescript } from "./extends/typescript";
|
|
11
11
|
import { yaml } from "./extends/yaml";
|
|
12
|
-
type Options = NonNullable<Parameters<typeof antfu>[0]
|
|
12
|
+
type Options = ReplaceAntfuEslintRulesWithVpRulesDeeply<NonNullable<Parameters<typeof antfu>[0]>> & {
|
|
13
13
|
javascriptExtends?: javascript.Options;
|
|
14
14
|
importsExtends?: imports.Options;
|
|
15
15
|
typescriptExtends?: typescript.Options;
|
package/dist/esm/vdustr.mjs
CHANGED
|
@@ -41,13 +41,7 @@ const vdustr = (options, ...userConfigs) => {
|
|
|
41
41
|
config = config.append(
|
|
42
42
|
mdx({
|
|
43
43
|
...mdxOptions,
|
|
44
|
-
codeBlocks: !mdxFlatCodeBlocksEnabled ? false :
|
|
45
|
-
...mdxFlatCodeBlocksOptions,
|
|
46
|
-
rules: {
|
|
47
|
-
"import/no-default-export": "off",
|
|
48
|
-
...mdxFlatCodeBlocksOptions?.rules
|
|
49
|
-
}
|
|
50
|
-
}
|
|
44
|
+
codeBlocks: !mdxFlatCodeBlocksEnabled ? false : mdxFlatCodeBlocksOptions
|
|
51
45
|
})
|
|
52
46
|
);
|
|
53
47
|
}
|
|
@@ -26,8 +26,6 @@ const javascript = (composer, options) => {
|
|
|
26
26
|
*/
|
|
27
27
|
"no-unused-vars": "off",
|
|
28
28
|
"unused-imports/no-unused-vars": "off",
|
|
29
|
-
"unused-imports/no-unused-imports-ts": "off",
|
|
30
|
-
"unused-imports/no-unused-vars-ts": "off",
|
|
31
29
|
"unused-imports/no-unused-imports": "off"
|
|
32
30
|
}
|
|
33
31
|
}, omittedConfig);
|
package/dist/types.d.ts
CHANGED
|
@@ -4,7 +4,12 @@ import type { DistributiveOmit } 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
|
-
type
|
|
7
|
+
type AnyObject = Record<PropertyKey, any>;
|
|
8
|
+
type ObjectReplaceAntfuEslintRulesWithRulesDeeply<T extends AnyObject> = (Extract<T, AntfuEslintRules> extends never ? never : Rules) | {
|
|
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]>>;
|
|
8
13
|
type Rules = RuleOptions & AntfuEslintRules;
|
|
9
14
|
type ConfigNames = VpEslintConfigNames | AntfuEslintConfigNames;
|
|
10
15
|
/**
|
|
@@ -19,4 +24,4 @@ interface ConfigOverrides extends DistributiveOmit<TypedFlatConfigItem, "process
|
|
|
19
24
|
* Typed composer.
|
|
20
25
|
*/
|
|
21
26
|
type VpComposer = FlatConfigComposer<TypedFlatConfigItem, ConfigNames>;
|
|
22
|
-
export type { Config, ConfigNames, ConfigOverrides, TypedFlatConfigItem, VpComposer, };
|
|
27
|
+
export type { AnyObject, Config, ConfigNames, ConfigOverrides, ReplaceAntfuEslintRulesWithVpRulesDeeply, TypedFlatConfigItem, VpComposer, };
|
package/dist/vdustr.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { Config, VpComposer } from "./types";
|
|
1
|
+
import type { Config, ReplaceAntfuEslintRulesWithVpRulesDeeply, VpComposer } from "./types";
|
|
2
2
|
import antfu from "@antfu/eslint-config";
|
|
3
3
|
import { mdx } from "./configs/mdx";
|
|
4
4
|
import { prettier } from "./configs/prettier";
|
|
@@ -9,7 +9,7 @@ import { jsonc } from "./extends/jsonc";
|
|
|
9
9
|
import { react } from "./extends/react";
|
|
10
10
|
import { typescript } from "./extends/typescript";
|
|
11
11
|
import { yaml } from "./extends/yaml";
|
|
12
|
-
type Options = NonNullable<Parameters<typeof antfu>[0]
|
|
12
|
+
type Options = ReplaceAntfuEslintRulesWithVpRulesDeeply<NonNullable<Parameters<typeof antfu>[0]>> & {
|
|
13
13
|
javascriptExtends?: javascript.Options;
|
|
14
14
|
importsExtends?: imports.Options;
|
|
15
15
|
typescriptExtends?: typescript.Options;
|
package/dist/vdustr.js
CHANGED
|
@@ -43,13 +43,7 @@ const vdustr = (options, ...userConfigs) => {
|
|
|
43
43
|
};
|
|
44
44
|
config = config.append((0, _mdx.mdx)({
|
|
45
45
|
...mdxOptions,
|
|
46
|
-
codeBlocks: !mdxFlatCodeBlocksEnabled ? false :
|
|
47
|
-
...mdxFlatCodeBlocksOptions,
|
|
48
|
-
rules: {
|
|
49
|
-
"import/no-default-export": "off",
|
|
50
|
-
...mdxFlatCodeBlocksOptions?.rules
|
|
51
|
-
}
|
|
52
|
-
}
|
|
46
|
+
codeBlocks: !mdxFlatCodeBlocksEnabled ? false : mdxFlatCodeBlocksOptions
|
|
53
47
|
}));
|
|
54
48
|
}
|
|
55
49
|
const prettierEnabled = Boolean(options?.prettier ?? true);
|