@vp-tw/eslint-config 0.0.14 → 0.0.16
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 +1 -0
- package/dist/configs/mdx.d.ts +3 -2
- package/dist/configs/mdx.js +22 -60
- package/dist/configs/prettier.d.ts +2 -1
- package/dist/configs/prettier.js +8 -24
- package/dist/configs/storybook.d.ts +6 -6
- package/dist/configs/storybook.js +20 -42
- package/dist/esm/configs/mdx.d.ts +3 -2
- package/dist/esm/configs/mdx.mjs +34 -76
- package/dist/esm/configs/prettier.d.ts +2 -1
- package/dist/esm/configs/prettier.mjs +13 -24
- package/dist/esm/configs/storybook.d.ts +6 -6
- package/dist/esm/configs/storybook.mjs +30 -45
- package/dist/esm/extends/_utils.d.ts +1 -1
- package/dist/esm/extends/_utils.mjs +1 -1
- package/dist/esm/extends/imports.d.ts +3 -3
- package/dist/esm/extends/imports.mjs +55 -66
- package/dist/esm/extends/javascript.d.ts +4 -3
- package/dist/esm/extends/javascript.mjs +30 -41
- package/dist/esm/extends/jsonc.d.ts +6 -6
- package/dist/esm/extends/jsonc.mjs +50 -118
- package/dist/esm/extends/react.d.ts +10 -3
- package/dist/esm/extends/react.mjs +39 -45
- package/dist/esm/extends/typescript.d.ts +4 -3
- package/dist/esm/extends/typescript.mjs +37 -48
- package/dist/esm/extends/yaml.d.ts +4 -4
- package/dist/esm/extends/yaml.mjs +23 -47
- package/dist/extends/_utils.d.ts +1 -1
- package/dist/extends/_utils.js +1 -1
- package/dist/extends/imports.d.ts +3 -3
- package/dist/extends/imports.js +38 -52
- package/dist/extends/javascript.d.ts +4 -3
- package/dist/extends/javascript.js +26 -37
- package/dist/extends/jsonc.d.ts +6 -6
- package/dist/extends/jsonc.js +29 -101
- package/dist/extends/react.d.ts +10 -3
- package/dist/extends/react.js +28 -43
- package/dist/extends/typescript.d.ts +4 -3
- package/dist/extends/typescript.js +35 -46
- package/dist/extends/yaml.d.ts +4 -4
- package/dist/extends/yaml.js +28 -52
- package/package.json +22 -4
package/README.md
CHANGED
|
@@ -8,6 +8,7 @@ ViPro's ESLint configuration.
|
|
|
8
8
|
- [eslint-mdx](https://github.com/mdx-js/eslint-mdx)
|
|
9
9
|
- [eslint-plugin-storybook](https://github.com/storybookjs/eslint-plugin-storybook)
|
|
10
10
|
- [eslint-plugin-react-compiler](https://www.npmjs.com/package/eslint-plugin-react-compiler)
|
|
11
|
+
- [eslint-plugin-package-json](https://github.com/JoshuaKGoldberg/eslint-plugin-package-json)
|
|
11
12
|
- 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).
|
|
12
13
|
|
|
13
14
|
Check [here](https://vdustr.dev/eslint-config) to preview the ESLint inspection.
|
package/dist/configs/mdx.d.ts
CHANGED
|
@@ -12,8 +12,9 @@ declare module "../types" {
|
|
|
12
12
|
}
|
|
13
13
|
declare namespace mdx {
|
|
14
14
|
type ConfigNamesMapSource = typeof configNamesMapSource;
|
|
15
|
-
interface Options
|
|
16
|
-
|
|
15
|
+
interface Options {
|
|
16
|
+
mdx?: ConfigOverrides;
|
|
17
|
+
processorOptions?: Omit<import("eslint-plugin-mdx").ProcessorOptions, "lintCodeBlocks">;
|
|
17
18
|
codeBlocks?: boolean | ConfigOverrides;
|
|
18
19
|
}
|
|
19
20
|
}
|
package/dist/configs/mdx.js
CHANGED
|
@@ -5,8 +5,10 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
});
|
|
6
6
|
exports.mdx = void 0;
|
|
7
7
|
var _eslintConfig = require("@antfu/eslint-config");
|
|
8
|
+
var _defu = _interopRequireDefault(require("defu"));
|
|
8
9
|
var _esToolkit = require("es-toolkit");
|
|
9
10
|
var _renameRules = require("../utils/renameRules");
|
|
11
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
10
12
|
const configNamesMapSource = {
|
|
11
13
|
setup: "vdustr/mdx/setup",
|
|
12
14
|
processor: "vdustr/mdx/processor",
|
|
@@ -21,79 +23,39 @@ const mdxInternal = async ({
|
|
|
21
23
|
await (0, _eslintConfig.ensurePackages)(["eslint-plugin-mdx"]);
|
|
22
24
|
const mdxPlugin = await (0, _eslintConfig.interopDefault)(await Promise.resolve().then(() => require("eslint-plugin-mdx")));
|
|
23
25
|
const codeBlocksOptions = typeof codeBlocks !== "object" ? {} : codeBlocks;
|
|
24
|
-
const
|
|
26
|
+
const setupConfig = {
|
|
25
27
|
...(0, _esToolkit.pick)(mdxPlugin.flat, ["plugins"]),
|
|
26
28
|
name: configNamesMapSource.setup
|
|
27
|
-
}
|
|
29
|
+
};
|
|
30
|
+
const processorConfig = {
|
|
28
31
|
processor: mdxPlugin.createRemarkProcessor({
|
|
29
|
-
lintCodeBlocks: Boolean(codeBlocks),
|
|
30
32
|
...processorOptions,
|
|
31
|
-
|
|
32
|
-
...processorOptions?.languageMapper
|
|
33
|
-
}
|
|
33
|
+
lintCodeBlocks: Boolean(codeBlocks)
|
|
34
34
|
}),
|
|
35
35
|
name: configNamesMapSource.processor
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
* Inherited.
|
|
39
|
-
*/
|
|
36
|
+
};
|
|
37
|
+
const rulesConfig = (0, _defu.default)(options.mdx, {
|
|
40
38
|
...(0, _esToolkit.omit)(mdxPlugin.flat, ["plugins", "processor"]),
|
|
41
|
-
/**
|
|
42
|
-
* Default.
|
|
43
|
-
*/
|
|
44
39
|
name: configNamesMapSource.rules,
|
|
45
|
-
|
|
40
|
+
rules: (0, _renameRules.renameRules)(mdxPlugin.flat.rules ?? {}),
|
|
46
41
|
/**
|
|
47
42
|
* Handled by `@eslint/markdown`.
|
|
48
43
|
*/
|
|
49
|
-
_eslintConfig.GLOB_MARKDOWN]
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
*/
|
|
58
|
-
...(0, _renameRules.renameRules)({
|
|
59
|
-
...mdxPlugin.flat.rules
|
|
60
|
-
}),
|
|
61
|
-
/**
|
|
62
|
-
* Overridable.
|
|
63
|
-
*/
|
|
64
|
-
...options.rules
|
|
65
|
-
}
|
|
66
|
-
}, ...(!codeBlocks ? [] : [{
|
|
67
|
-
/**
|
|
68
|
-
* Inherited.
|
|
69
|
-
*/
|
|
70
|
-
...mdxPlugin.flatCodeBlocks,
|
|
71
|
-
/**
|
|
72
|
-
* Default.
|
|
73
|
-
*/
|
|
74
|
-
name: configNamesMapSource.codeBlocks,
|
|
75
|
-
ignores: [
|
|
76
|
-
/**
|
|
77
|
-
* Handled by `@eslint/markdown`.
|
|
78
|
-
*/
|
|
79
|
-
_eslintConfig.GLOB_MARKDOWN_CODE],
|
|
80
|
-
/**
|
|
81
|
-
* Overridable.
|
|
82
|
-
*/
|
|
83
|
-
...codeBlocksOptions,
|
|
84
|
-
rules: {
|
|
85
|
-
/**
|
|
86
|
-
* Inherited.
|
|
87
|
-
*/
|
|
88
|
-
...(0, _renameRules.renameRules)({
|
|
89
|
-
...mdxPlugin.flatCodeBlocks.rules
|
|
90
|
-
}),
|
|
44
|
+
ignores: [...(mdxPlugin.flat.ignores ?? []), _eslintConfig.GLOB_MARKDOWN]
|
|
45
|
+
});
|
|
46
|
+
const configs = [setupConfig, processorConfig, rulesConfig];
|
|
47
|
+
if (codeBlocks) {
|
|
48
|
+
const codeBlocksConfig = (0, _defu.default)(codeBlocksOptions, {
|
|
49
|
+
...mdxPlugin.flatCodeBlocks,
|
|
50
|
+
name: configNamesMapSource.codeBlocks,
|
|
51
|
+
rules: (0, _renameRules.renameRules)(mdxPlugin.flatCodeBlocks.rules ?? {}),
|
|
91
52
|
/**
|
|
92
|
-
*
|
|
53
|
+
* Handled by `@eslint/markdown`.
|
|
93
54
|
*/
|
|
94
|
-
...
|
|
95
|
-
}
|
|
96
|
-
|
|
55
|
+
ignores: [...(mdxPlugin.flatCodeBlocks.ignores ?? []), _eslintConfig.GLOB_MARKDOWN_CODE]
|
|
56
|
+
});
|
|
57
|
+
configs.push(codeBlocksConfig);
|
|
58
|
+
}
|
|
97
59
|
return configs;
|
|
98
60
|
};
|
|
99
61
|
const mdx = exports.mdx = Object.assign(mdxInternal, {
|
|
@@ -9,7 +9,8 @@ declare module "../types" {
|
|
|
9
9
|
}
|
|
10
10
|
declare namespace prettier {
|
|
11
11
|
type ConfigNamesMapSource = typeof configNamesMapSource;
|
|
12
|
-
interface Options
|
|
12
|
+
interface Options {
|
|
13
|
+
prettier?: ConfigOverrides;
|
|
13
14
|
}
|
|
14
15
|
}
|
|
15
16
|
declare const prettier: ((options?: prettier.Options) => Promise<TypedFlatConfigItem>) & {
|
package/dist/configs/prettier.js
CHANGED
|
@@ -5,7 +5,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
});
|
|
6
6
|
exports.prettier = void 0;
|
|
7
7
|
var _eslintConfig = require("@antfu/eslint-config");
|
|
8
|
-
var
|
|
8
|
+
var _defu = _interopRequireDefault(require("defu"));
|
|
9
9
|
var _renameRules = require("../utils/renameRules");
|
|
10
10
|
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
11
11
|
const configNamesMapSource = {
|
|
@@ -13,29 +13,13 @@ const configNamesMapSource = {
|
|
|
13
13
|
};
|
|
14
14
|
const prettierInternal = async options => {
|
|
15
15
|
await (0, _eslintConfig.ensurePackages)(["eslint-config-prettier"]);
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
*/
|
|
24
|
-
name: configNamesMapSource.rules,
|
|
25
|
-
/**
|
|
26
|
-
* Overridable.
|
|
27
|
-
*/
|
|
28
|
-
rules: {
|
|
29
|
-
/**
|
|
30
|
-
* Inherited.
|
|
31
|
-
*/
|
|
32
|
-
...(0, _renameRules.renameRules)(_eslintConfigPrettier.default.rules),
|
|
33
|
-
/**
|
|
34
|
-
* Overridable.
|
|
35
|
-
*/
|
|
36
|
-
...options?.rules
|
|
37
|
-
}
|
|
38
|
-
};
|
|
16
|
+
const eslintConfigPrettier = await (0, _eslintConfig.interopDefault)(Promise.resolve().then(() => require("eslint-config-prettier")));
|
|
17
|
+
const rulesConfig = (0, _defu.default)(options?.prettier, {
|
|
18
|
+
...eslintConfigPrettier,
|
|
19
|
+
rules: (0, _renameRules.renameRules)(eslintConfigPrettier.rules),
|
|
20
|
+
name: configNamesMapSource.rules
|
|
21
|
+
});
|
|
22
|
+
return rulesConfig;
|
|
39
23
|
};
|
|
40
24
|
const prettier = exports.prettier = Object.assign(prettierInternal, {
|
|
41
25
|
configNamesMapSource
|
|
@@ -2,8 +2,8 @@ import type { TypedFlatConfigItem } from "@antfu/eslint-config";
|
|
|
2
2
|
import type { ConfigOverrides, ResolveConfigNamesMap } from "../types";
|
|
3
3
|
declare const configNamesMapSource: {
|
|
4
4
|
readonly setup: "vdustr/stroybook/setup";
|
|
5
|
-
readonly storiesRules: "vdustr/storybook/stories
|
|
6
|
-
readonly mainRules: "vdustr/storybook/main
|
|
5
|
+
readonly storiesRules: "vdustr/storybook/stories/rules";
|
|
6
|
+
readonly mainRules: "vdustr/storybook/main/rules";
|
|
7
7
|
};
|
|
8
8
|
declare module "../types" {
|
|
9
9
|
interface ConfigNamesMap extends ResolveConfigNamesMap<storybook.ConfigNamesMapSource> {
|
|
@@ -12,15 +12,15 @@ declare module "../types" {
|
|
|
12
12
|
declare namespace storybook {
|
|
13
13
|
type ConfigNamesMapSource = typeof configNamesMapSource;
|
|
14
14
|
interface Options {
|
|
15
|
-
|
|
16
|
-
|
|
15
|
+
stories?: ConfigOverrides;
|
|
16
|
+
main?: ConfigOverrides;
|
|
17
17
|
}
|
|
18
18
|
}
|
|
19
19
|
declare const storybook: ((options?: storybook.Options) => Promise<Array<TypedFlatConfigItem>>) & {
|
|
20
20
|
configNamesMapSource: {
|
|
21
21
|
readonly setup: "vdustr/stroybook/setup";
|
|
22
|
-
readonly storiesRules: "vdustr/storybook/stories
|
|
23
|
-
readonly mainRules: "vdustr/storybook/main
|
|
22
|
+
readonly storiesRules: "vdustr/storybook/stories/rules";
|
|
23
|
+
readonly mainRules: "vdustr/storybook/main/rules";
|
|
24
24
|
};
|
|
25
25
|
};
|
|
26
26
|
export { storybook };
|
|
@@ -5,11 +5,14 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
});
|
|
6
6
|
exports.storybook = void 0;
|
|
7
7
|
var _eslintConfig = require("@antfu/eslint-config");
|
|
8
|
+
var _defu = _interopRequireDefault(require("defu"));
|
|
8
9
|
var _esToolkit = require("es-toolkit");
|
|
10
|
+
var _renameRules = require("../utils/renameRules");
|
|
11
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
9
12
|
const configNamesMapSource = {
|
|
10
13
|
setup: "vdustr/stroybook/setup",
|
|
11
|
-
storiesRules: "vdustr/storybook/stories
|
|
12
|
-
mainRules: "vdustr/storybook/main
|
|
14
|
+
storiesRules: "vdustr/storybook/stories/rules",
|
|
15
|
+
mainRules: "vdustr/storybook/main/rules"
|
|
13
16
|
};
|
|
14
17
|
const storybookInternal = async options => {
|
|
15
18
|
await (0, _eslintConfig.ensurePackages)(["eslint-plugin-storybook"]);
|
|
@@ -27,50 +30,25 @@ const storybookInternal = async options => {
|
|
|
27
30
|
...(0, _esToolkit.pick)(originalSetupConfig, ["plugins"]),
|
|
28
31
|
name: configNamesMapSource.setup
|
|
29
32
|
};
|
|
30
|
-
const storyRulesConfig = {
|
|
31
|
-
/**
|
|
32
|
-
* Inherited.
|
|
33
|
-
*/
|
|
34
|
-
...originalStoryRulesConfig,
|
|
35
|
-
...originalCsfStrictConfig,
|
|
36
|
-
/**
|
|
37
|
-
* Default.
|
|
38
|
-
*/
|
|
33
|
+
const storyRulesConfig = (0, _defu.default)(options?.stories, {
|
|
39
34
|
name: configNamesMapSource.storiesRules,
|
|
40
|
-
/**
|
|
41
|
-
* Overridable.
|
|
42
|
-
*/
|
|
43
|
-
...options?.storiesConfig,
|
|
44
35
|
rules: {
|
|
45
|
-
|
|
46
|
-
* Inherited.
|
|
47
|
-
*/
|
|
48
|
-
...originalStoryRulesConfig.rules,
|
|
49
|
-
...originalCsfStrictConfig.rules,
|
|
50
|
-
/**
|
|
51
|
-
* Default.
|
|
52
|
-
*/
|
|
53
|
-
"import/no-default-export": "off",
|
|
54
|
-
/**
|
|
55
|
-
* Overridable.
|
|
56
|
-
*/
|
|
57
|
-
...options?.storiesConfig?.rules
|
|
36
|
+
"import/no-default-export": "off"
|
|
58
37
|
}
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
38
|
+
}, {
|
|
39
|
+
...originalStoryRulesConfig,
|
|
40
|
+
...originalCsfStrictConfig,
|
|
41
|
+
rules: (0, _renameRules.renameRules)({
|
|
42
|
+
...originalStoryRulesConfig.rules,
|
|
43
|
+
...originalCsfStrictConfig.rules
|
|
44
|
+
})
|
|
45
|
+
});
|
|
46
|
+
const mainRulesConfig = (0, _defu.default)(options?.main, {
|
|
47
|
+
name: configNamesMapSource.mainRules
|
|
48
|
+
}, {
|
|
64
49
|
...originalMainRulesConfig,
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
*/
|
|
68
|
-
name: configNamesMapSource.mainRules,
|
|
69
|
-
/**
|
|
70
|
-
* Overridable.
|
|
71
|
-
*/
|
|
72
|
-
...options?.mainConfig
|
|
73
|
-
};
|
|
50
|
+
rules: (0, _renameRules.renameRules)(originalMainRulesConfig.rules ?? {})
|
|
51
|
+
});
|
|
74
52
|
return [setupConfig, storyRulesConfig, mainRulesConfig];
|
|
75
53
|
};
|
|
76
54
|
const storybook = exports.storybook = Object.assign(storybookInternal, {
|
|
@@ -12,8 +12,9 @@ declare module "../types" {
|
|
|
12
12
|
}
|
|
13
13
|
declare namespace mdx {
|
|
14
14
|
type ConfigNamesMapSource = typeof configNamesMapSource;
|
|
15
|
-
interface Options
|
|
16
|
-
|
|
15
|
+
interface Options {
|
|
16
|
+
mdx?: ConfigOverrides;
|
|
17
|
+
processorOptions?: Omit<import("eslint-plugin-mdx").ProcessorOptions, "lintCodeBlocks">;
|
|
17
18
|
codeBlocks?: boolean | ConfigOverrides;
|
|
18
19
|
}
|
|
19
20
|
}
|
package/dist/esm/configs/mdx.mjs
CHANGED
|
@@ -4,6 +4,7 @@ import {
|
|
|
4
4
|
GLOB_MARKDOWN_CODE,
|
|
5
5
|
interopDefault
|
|
6
6
|
} from "@antfu/eslint-config";
|
|
7
|
+
import defu from "defu";
|
|
7
8
|
import { omit, pick } from "es-toolkit";
|
|
8
9
|
import { renameRules } from "../utils/renameRules.mjs";
|
|
9
10
|
const configNamesMapSource = {
|
|
@@ -20,88 +21,45 @@ const mdxInternal = async ({
|
|
|
20
21
|
await ensurePackages(["eslint-plugin-mdx"]);
|
|
21
22
|
const mdxPlugin = await interopDefault(await import("eslint-plugin-mdx"));
|
|
22
23
|
const codeBlocksOptions = typeof codeBlocks !== "object" ? {} : codeBlocks;
|
|
23
|
-
const
|
|
24
|
+
const setupConfig = {
|
|
25
|
+
...pick(mdxPlugin.flat, ["plugins"]),
|
|
26
|
+
name: configNamesMapSource.setup
|
|
27
|
+
};
|
|
28
|
+
const processorConfig = {
|
|
29
|
+
processor: mdxPlugin.createRemarkProcessor({
|
|
30
|
+
...processorOptions,
|
|
31
|
+
lintCodeBlocks: Boolean(codeBlocks)
|
|
32
|
+
}),
|
|
33
|
+
name: configNamesMapSource.processor
|
|
34
|
+
};
|
|
35
|
+
const rulesConfig = defu(
|
|
36
|
+
options.mdx,
|
|
24
37
|
{
|
|
25
|
-
...pick(mdxPlugin.flat, ["plugins"]),
|
|
26
|
-
name: configNamesMapSource.setup
|
|
27
|
-
},
|
|
28
|
-
{
|
|
29
|
-
processor: mdxPlugin.createRemarkProcessor({
|
|
30
|
-
lintCodeBlocks: Boolean(codeBlocks),
|
|
31
|
-
...processorOptions,
|
|
32
|
-
languageMapper: {
|
|
33
|
-
...processorOptions?.languageMapper
|
|
34
|
-
}
|
|
35
|
-
}),
|
|
36
|
-
name: configNamesMapSource.processor
|
|
37
|
-
},
|
|
38
|
-
{
|
|
39
|
-
/**
|
|
40
|
-
* Inherited.
|
|
41
|
-
*/
|
|
42
38
|
...omit(mdxPlugin.flat, ["plugins", "processor"]),
|
|
39
|
+
name: configNamesMapSource.rules,
|
|
40
|
+
rules: renameRules(mdxPlugin.flat.rules ?? {}),
|
|
43
41
|
/**
|
|
44
|
-
*
|
|
42
|
+
* Handled by `@eslint/markdown`.
|
|
45
43
|
*/
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
44
|
+
ignores: [...mdxPlugin.flat.ignores ?? [], GLOB_MARKDOWN]
|
|
45
|
+
}
|
|
46
|
+
);
|
|
47
|
+
const configs = [setupConfig, processorConfig, rulesConfig];
|
|
48
|
+
if (codeBlocks) {
|
|
49
|
+
const codeBlocksConfig = defu(codeBlocksOptions, {
|
|
50
|
+
...mdxPlugin.flatCodeBlocks,
|
|
51
|
+
name: configNamesMapSource.codeBlocks,
|
|
52
|
+
rules: renameRules(mdxPlugin.flatCodeBlocks.rules ?? {}),
|
|
53
53
|
/**
|
|
54
|
-
*
|
|
54
|
+
* Handled by `@eslint/markdown`.
|
|
55
55
|
*/
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
}),
|
|
64
|
-
/**
|
|
65
|
-
* Overridable.
|
|
66
|
-
*/
|
|
67
|
-
...options.rules
|
|
68
|
-
}
|
|
69
|
-
},
|
|
70
|
-
...!codeBlocks ? [] : [
|
|
71
|
-
{
|
|
72
|
-
/**
|
|
73
|
-
* Inherited.
|
|
74
|
-
*/
|
|
75
|
-
...mdxPlugin.flatCodeBlocks,
|
|
76
|
-
/**
|
|
77
|
-
* Default.
|
|
78
|
-
*/
|
|
79
|
-
name: configNamesMapSource.codeBlocks,
|
|
80
|
-
ignores: [
|
|
81
|
-
/**
|
|
82
|
-
* Handled by `@eslint/markdown`.
|
|
83
|
-
*/
|
|
84
|
-
GLOB_MARKDOWN_CODE
|
|
85
|
-
],
|
|
86
|
-
/**
|
|
87
|
-
* Overridable.
|
|
88
|
-
*/
|
|
89
|
-
...codeBlocksOptions,
|
|
90
|
-
rules: {
|
|
91
|
-
/**
|
|
92
|
-
* Inherited.
|
|
93
|
-
*/
|
|
94
|
-
...renameRules({
|
|
95
|
-
...mdxPlugin.flatCodeBlocks.rules
|
|
96
|
-
}),
|
|
97
|
-
/**
|
|
98
|
-
* Overridable.
|
|
99
|
-
*/
|
|
100
|
-
...codeBlocksOptions.rules
|
|
101
|
-
}
|
|
102
|
-
}
|
|
103
|
-
]
|
|
104
|
-
];
|
|
56
|
+
ignores: [
|
|
57
|
+
...mdxPlugin.flatCodeBlocks.ignores ?? [],
|
|
58
|
+
GLOB_MARKDOWN_CODE
|
|
59
|
+
]
|
|
60
|
+
});
|
|
61
|
+
configs.push(codeBlocksConfig);
|
|
62
|
+
}
|
|
105
63
|
return configs;
|
|
106
64
|
};
|
|
107
65
|
const mdx = Object.assign(mdxInternal, {
|
|
@@ -9,7 +9,8 @@ declare module "../types" {
|
|
|
9
9
|
}
|
|
10
10
|
declare namespace prettier {
|
|
11
11
|
type ConfigNamesMapSource = typeof configNamesMapSource;
|
|
12
|
-
interface Options
|
|
12
|
+
interface Options {
|
|
13
|
+
prettier?: ConfigOverrides;
|
|
13
14
|
}
|
|
14
15
|
}
|
|
15
16
|
declare const prettier: ((options?: prettier.Options) => Promise<TypedFlatConfigItem>) & {
|
|
@@ -1,34 +1,23 @@
|
|
|
1
|
-
import { ensurePackages } from "@antfu/eslint-config";
|
|
2
|
-
import
|
|
1
|
+
import { ensurePackages, interopDefault } from "@antfu/eslint-config";
|
|
2
|
+
import defu from "defu";
|
|
3
3
|
import { renameRules } from "../utils/renameRules.mjs";
|
|
4
4
|
const configNamesMapSource = {
|
|
5
5
|
rules: "vdustr/prettier/rules"
|
|
6
6
|
};
|
|
7
7
|
const prettierInternal = async (options) => {
|
|
8
8
|
await ensurePackages(["eslint-config-prettier"]);
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
/**
|
|
19
|
-
* Overridable.
|
|
20
|
-
*/
|
|
21
|
-
rules: {
|
|
22
|
-
/**
|
|
23
|
-
* Inherited.
|
|
24
|
-
*/
|
|
25
|
-
...renameRules(eslintConfigPrettier.rules),
|
|
26
|
-
/**
|
|
27
|
-
* Overridable.
|
|
28
|
-
*/
|
|
29
|
-
...options?.rules
|
|
9
|
+
const eslintConfigPrettier = await interopDefault(
|
|
10
|
+
import("eslint-config-prettier")
|
|
11
|
+
);
|
|
12
|
+
const rulesConfig = defu(
|
|
13
|
+
options?.prettier,
|
|
14
|
+
{
|
|
15
|
+
...eslintConfigPrettier,
|
|
16
|
+
rules: renameRules(eslintConfigPrettier.rules),
|
|
17
|
+
name: configNamesMapSource.rules
|
|
30
18
|
}
|
|
31
|
-
|
|
19
|
+
);
|
|
20
|
+
return rulesConfig;
|
|
32
21
|
};
|
|
33
22
|
const prettier = Object.assign(prettierInternal, {
|
|
34
23
|
configNamesMapSource
|
|
@@ -2,8 +2,8 @@ import type { TypedFlatConfigItem } from "@antfu/eslint-config";
|
|
|
2
2
|
import type { ConfigOverrides, ResolveConfigNamesMap } from "../types";
|
|
3
3
|
declare const configNamesMapSource: {
|
|
4
4
|
readonly setup: "vdustr/stroybook/setup";
|
|
5
|
-
readonly storiesRules: "vdustr/storybook/stories
|
|
6
|
-
readonly mainRules: "vdustr/storybook/main
|
|
5
|
+
readonly storiesRules: "vdustr/storybook/stories/rules";
|
|
6
|
+
readonly mainRules: "vdustr/storybook/main/rules";
|
|
7
7
|
};
|
|
8
8
|
declare module "../types" {
|
|
9
9
|
interface ConfigNamesMap extends ResolveConfigNamesMap<storybook.ConfigNamesMapSource> {
|
|
@@ -12,15 +12,15 @@ declare module "../types" {
|
|
|
12
12
|
declare namespace storybook {
|
|
13
13
|
type ConfigNamesMapSource = typeof configNamesMapSource;
|
|
14
14
|
interface Options {
|
|
15
|
-
|
|
16
|
-
|
|
15
|
+
stories?: ConfigOverrides;
|
|
16
|
+
main?: ConfigOverrides;
|
|
17
17
|
}
|
|
18
18
|
}
|
|
19
19
|
declare const storybook: ((options?: storybook.Options) => Promise<Array<TypedFlatConfigItem>>) & {
|
|
20
20
|
configNamesMapSource: {
|
|
21
21
|
readonly setup: "vdustr/stroybook/setup";
|
|
22
|
-
readonly storiesRules: "vdustr/storybook/stories
|
|
23
|
-
readonly mainRules: "vdustr/storybook/main
|
|
22
|
+
readonly storiesRules: "vdustr/storybook/stories/rules";
|
|
23
|
+
readonly mainRules: "vdustr/storybook/main/rules";
|
|
24
24
|
};
|
|
25
25
|
};
|
|
26
26
|
export { storybook };
|
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
import { ensurePackages, interopDefault } from "@antfu/eslint-config";
|
|
2
|
+
import defu from "defu";
|
|
2
3
|
import { pick } from "es-toolkit";
|
|
4
|
+
import { renameRules } from "../utils/renameRules.mjs";
|
|
3
5
|
const configNamesMapSource = {
|
|
4
6
|
setup: "vdustr/stroybook/setup",
|
|
5
|
-
storiesRules: "vdustr/storybook/stories
|
|
6
|
-
mainRules: "vdustr/storybook/main
|
|
7
|
+
storiesRules: "vdustr/storybook/stories/rules",
|
|
8
|
+
mainRules: "vdustr/storybook/main/rules"
|
|
7
9
|
};
|
|
8
10
|
const storybookInternal = async (options) => {
|
|
9
11
|
await ensurePackages(["eslint-plugin-storybook"]);
|
|
@@ -23,50 +25,33 @@ const storybookInternal = async (options) => {
|
|
|
23
25
|
...pick(originalSetupConfig, ["plugins"]),
|
|
24
26
|
name: configNamesMapSource.setup
|
|
25
27
|
};
|
|
26
|
-
const storyRulesConfig =
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
/**
|
|
42
|
-
* Inherited.
|
|
43
|
-
*/
|
|
44
|
-
...originalStoryRulesConfig.rules,
|
|
45
|
-
...originalCsfStrictConfig.rules,
|
|
46
|
-
/**
|
|
47
|
-
* Default.
|
|
48
|
-
*/
|
|
49
|
-
"import/no-default-export": "off",
|
|
50
|
-
/**
|
|
51
|
-
* Overridable.
|
|
52
|
-
*/
|
|
53
|
-
...options?.storiesConfig?.rules
|
|
28
|
+
const storyRulesConfig = defu(
|
|
29
|
+
options?.stories,
|
|
30
|
+
{
|
|
31
|
+
name: configNamesMapSource.storiesRules,
|
|
32
|
+
rules: {
|
|
33
|
+
"import/no-default-export": "off"
|
|
34
|
+
}
|
|
35
|
+
},
|
|
36
|
+
{
|
|
37
|
+
...originalStoryRulesConfig,
|
|
38
|
+
...originalCsfStrictConfig,
|
|
39
|
+
rules: renameRules({
|
|
40
|
+
...originalStoryRulesConfig.rules,
|
|
41
|
+
...originalCsfStrictConfig.rules
|
|
42
|
+
})
|
|
54
43
|
}
|
|
55
|
-
|
|
56
|
-
const mainRulesConfig =
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
* Overridable.
|
|
67
|
-
*/
|
|
68
|
-
...options?.mainConfig
|
|
69
|
-
};
|
|
44
|
+
);
|
|
45
|
+
const mainRulesConfig = defu(
|
|
46
|
+
options?.main,
|
|
47
|
+
{
|
|
48
|
+
name: configNamesMapSource.mainRules
|
|
49
|
+
},
|
|
50
|
+
{
|
|
51
|
+
...originalMainRulesConfig,
|
|
52
|
+
rules: renameRules(originalMainRulesConfig.rules ?? {})
|
|
53
|
+
}
|
|
54
|
+
);
|
|
70
55
|
return [
|
|
71
56
|
setupConfig,
|
|
72
57
|
storyRulesConfig,
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
declare const ignoreKeys: ("plugins" | "rules")[];
|
|
1
|
+
declare const ignoreKeys: ("plugins" | "name" | "processor" | "rules")[];
|
|
2
2
|
export { ignoreKeys };
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
const ignoreKeys = ["plugins", "rules"];
|
|
1
|
+
const ignoreKeys = ["name", "plugins", "processor", "rules"];
|
|
2
2
|
export { ignoreKeys };
|
|
@@ -3,7 +3,7 @@ import type { FlatConfigComposer } from "eslint-flat-config-utils";
|
|
|
3
3
|
import type { ConfigOverrides, ResolveConfigNamesMap } from "../types";
|
|
4
4
|
declare const configNamesMapSource: {
|
|
5
5
|
readonly imports: "vdustr/imports/rules";
|
|
6
|
-
readonly noDefaultExport: "vdustr/no-default-export/rules";
|
|
6
|
+
readonly noDefaultExport: "vdustr/imports/no-default-export/rules";
|
|
7
7
|
};
|
|
8
8
|
declare module "../types" {
|
|
9
9
|
interface ConfigNamesMap extends ResolveConfigNamesMap<imports.ConfigNamesMapSource> {
|
|
@@ -13,13 +13,13 @@ declare namespace imports {
|
|
|
13
13
|
type ConfigNamesMapSource = typeof configNamesMapSource;
|
|
14
14
|
interface Options {
|
|
15
15
|
imports?: ConfigOverrides;
|
|
16
|
-
noDefaultExport
|
|
16
|
+
noDefaultExport?: ConfigOverrides;
|
|
17
17
|
}
|
|
18
18
|
}
|
|
19
19
|
declare const imports: ((composer: FlatConfigComposer<TypedFlatConfigItem, ConfigNames>, options?: imports.Options) => void) & {
|
|
20
20
|
configNamesMapSource: {
|
|
21
21
|
readonly imports: "vdustr/imports/rules";
|
|
22
|
-
readonly noDefaultExport: "vdustr/no-default-export/rules";
|
|
22
|
+
readonly noDefaultExport: "vdustr/imports/no-default-export/rules";
|
|
23
23
|
};
|
|
24
24
|
};
|
|
25
25
|
export { imports };
|