@vp-tw/eslint-config 0.0.18 → 0.0.20
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 +0 -31
- package/dist/configs/mdx.d.ts +2 -21
- package/dist/configs/mdx.js +6 -14
- package/dist/configs/prettier.d.ts +2 -15
- package/dist/configs/prettier.js +3 -8
- package/dist/configs/reactCompiler.d.ts +9 -0
- package/dist/configs/reactCompiler.js +25 -0
- package/dist/configs/storybook.d.ts +2 -19
- package/dist/configs/storybook.js +5 -12
- package/dist/eslint-typegen.d.ts +4 -7
- package/dist/esm/configs/mdx.d.ts +2 -21
- package/dist/esm/configs/mdx.mjs +5 -14
- package/dist/esm/configs/prettier.d.ts +2 -15
- package/dist/esm/configs/prettier.mjs +2 -8
- package/dist/esm/configs/reactCompiler.d.ts +9 -0
- package/dist/esm/configs/reactCompiler.mjs +18 -0
- package/dist/esm/configs/storybook.d.ts +2 -19
- package/dist/esm/configs/storybook.mjs +4 -12
- package/dist/esm/eslint-typegen.d.ts +4 -7
- package/dist/esm/extends/imports.d.ts +2 -18
- package/dist/esm/extends/imports.mjs +3 -10
- package/dist/esm/extends/javascript.d.ts +2 -16
- package/dist/esm/extends/javascript.mjs +2 -8
- package/dist/esm/extends/jsonc.d.ts +2 -22
- package/dist/esm/extends/jsonc.mjs +5 -14
- package/dist/esm/extends/react.d.ts +5 -22
- package/dist/esm/extends/react.mjs +10 -32
- package/dist/esm/extends/typescript.d.ts +2 -16
- package/dist/esm/extends/typescript.mjs +2 -8
- package/dist/esm/extends/yaml.d.ts +2 -18
- package/dist/esm/extends/yaml.mjs +3 -10
- package/dist/esm/types.d.ts +14 -29
- package/dist/esm/vdustr.d.ts +2 -5
- package/dist/esm/vdustr.mjs +1 -2
- package/dist/extends/imports.d.ts +2 -18
- package/dist/extends/imports.js +4 -10
- package/dist/extends/javascript.d.ts +2 -16
- package/dist/extends/javascript.js +3 -8
- package/dist/extends/jsonc.d.ts +2 -22
- package/dist/extends/jsonc.js +6 -14
- package/dist/extends/react.d.ts +5 -22
- package/dist/extends/react.js +8 -23
- package/dist/extends/typescript.d.ts +2 -16
- package/dist/extends/typescript.js +3 -8
- package/dist/extends/yaml.d.ts +2 -18
- package/dist/extends/yaml.js +4 -10
- package/dist/types.d.ts +14 -29
- package/dist/vdustr.d.ts +2 -5
- package/dist/vdustr.js +1 -2
- package/package.json +14 -16
- package/dist/eslint-typegen.js +0 -2
- package/dist/esm/eslint-typegen.mjs +0 -1
package/README.md
CHANGED
|
@@ -46,37 +46,6 @@ export default vdustr(
|
|
|
46
46
|
);
|
|
47
47
|
```
|
|
48
48
|
|
|
49
|
-
## Known Issues
|
|
50
|
-
|
|
51
|
-
## `RulesRecord` Type Definition Not Applied
|
|
52
|
-
|
|
53
|
-
If the rule record type definitions are not applied correctly, the plugin rules
|
|
54
|
-
supported by this ESLint config may not appear in properties that rely on these
|
|
55
|
-
types, such as `overrides`.
|
|
56
|
-
|
|
57
|
-
For example, you might not see the rule key `react-compiler/react-compiler` as
|
|
58
|
-
expected.
|
|
59
|
-
|
|
60
|
-
To fix this, you may need to prevent the outdated package `@types/eslint` from
|
|
61
|
-
being installed. This can be done by creating a `.pnpmfile.cjs` file:
|
|
62
|
-
|
|
63
|
-
```js
|
|
64
|
-
// .pnpmfile.cjs
|
|
65
|
-
module.exports = {
|
|
66
|
-
hooks: {
|
|
67
|
-
readPackage(pkg) {
|
|
68
|
-
if (pkg.dependencies) {
|
|
69
|
-
delete pkg.dependencies["@types/eslint"];
|
|
70
|
-
}
|
|
71
|
-
return pkg;
|
|
72
|
-
},
|
|
73
|
-
},
|
|
74
|
-
};
|
|
75
|
-
```
|
|
76
|
-
|
|
77
|
-
- [ESLint v9.10.0 released - Types now included](https://eslint.org/blog/2024/09/eslint-v9.10.0-released/#types-now-included)
|
|
78
|
-
- [feat: Add types #18854](https://github.com/eslint/eslint/pull/18854)
|
|
79
|
-
|
|
80
49
|
## License
|
|
81
50
|
|
|
82
51
|
MIT © ViPro <vdustr@gmail.com> (<http://vdustr.dev>)
|
package/dist/configs/mdx.d.ts
CHANGED
|
@@ -1,29 +1,10 @@
|
|
|
1
|
-
import type { TypedFlatConfigItem } from "
|
|
2
|
-
import type { ConfigOverrides, ResolveConfigNamesMap } from "../types";
|
|
3
|
-
declare const configNamesMapSource: {
|
|
4
|
-
readonly setup: "vdustr/mdx/setup";
|
|
5
|
-
readonly processor: "vdustr/mdx/processor";
|
|
6
|
-
readonly rules: "vdustr/mdx/rules";
|
|
7
|
-
readonly codeBlocks: "vdustr/mdx/code-blocks";
|
|
8
|
-
};
|
|
9
|
-
declare module "../types" {
|
|
10
|
-
interface ConfigNamesMap extends ResolveConfigNamesMap<mdx.ConfigNamesMapSource> {
|
|
11
|
-
}
|
|
12
|
-
}
|
|
1
|
+
import type { ConfigOverrides, TypedFlatConfigItem } from "../types";
|
|
13
2
|
declare namespace mdx {
|
|
14
|
-
type ConfigNamesMapSource = typeof configNamesMapSource;
|
|
15
3
|
interface Options {
|
|
16
4
|
mdx?: ConfigOverrides;
|
|
17
5
|
processorOptions?: Omit<import("eslint-plugin-mdx").ProcessorOptions, "lintCodeBlocks">;
|
|
18
6
|
codeBlocks?: boolean | ConfigOverrides;
|
|
19
7
|
}
|
|
20
8
|
}
|
|
21
|
-
declare const mdx: (
|
|
22
|
-
configNamesMapSource: {
|
|
23
|
-
readonly setup: "vdustr/mdx/setup";
|
|
24
|
-
readonly processor: "vdustr/mdx/processor";
|
|
25
|
-
readonly rules: "vdustr/mdx/rules";
|
|
26
|
-
readonly codeBlocks: "vdustr/mdx/code-blocks";
|
|
27
|
-
};
|
|
28
|
-
};
|
|
9
|
+
declare const mdx: ({ codeBlocks, processorOptions, ...options }?: mdx.Options) => Promise<Array<TypedFlatConfigItem>>;
|
|
29
10
|
export { mdx };
|
package/dist/configs/mdx.js
CHANGED
|
@@ -9,13 +9,7 @@ var _defu = _interopRequireDefault(require("defu"));
|
|
|
9
9
|
var _esToolkit = require("es-toolkit");
|
|
10
10
|
var _renameRules = require("../utils/renameRules");
|
|
11
11
|
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
12
|
-
const
|
|
13
|
-
setup: "vdustr/mdx/setup",
|
|
14
|
-
processor: "vdustr/mdx/processor",
|
|
15
|
-
rules: "vdustr/mdx/rules",
|
|
16
|
-
codeBlocks: "vdustr/mdx/code-blocks"
|
|
17
|
-
};
|
|
18
|
-
const mdxInternal = async ({
|
|
12
|
+
const mdx = async ({
|
|
19
13
|
codeBlocks = true,
|
|
20
14
|
processorOptions,
|
|
21
15
|
...options
|
|
@@ -25,18 +19,18 @@ const mdxInternal = async ({
|
|
|
25
19
|
const codeBlocksOptions = typeof codeBlocks !== "object" ? {} : codeBlocks;
|
|
26
20
|
const setupConfig = {
|
|
27
21
|
...(0, _esToolkit.pick)(mdxPlugin.flat, ["plugins"]),
|
|
28
|
-
name:
|
|
22
|
+
name: "vdustr/mdx/setup"
|
|
29
23
|
};
|
|
30
24
|
const processorConfig = {
|
|
31
25
|
processor: mdxPlugin.createRemarkProcessor({
|
|
32
26
|
...processorOptions,
|
|
33
27
|
lintCodeBlocks: Boolean(codeBlocks)
|
|
34
28
|
}),
|
|
35
|
-
name:
|
|
29
|
+
name: "vdustr/mdx/processor"
|
|
36
30
|
};
|
|
37
31
|
const rulesConfig = (0, _defu.default)(options.mdx, {
|
|
38
32
|
...(0, _esToolkit.omit)(mdxPlugin.flat, ["plugins", "processor"]),
|
|
39
|
-
name:
|
|
33
|
+
name: "vdustr/mdx/rules",
|
|
40
34
|
rules: (0, _renameRules.renameRules)(mdxPlugin.flat.rules ?? {}),
|
|
41
35
|
/**
|
|
42
36
|
* Handled by `@eslint/markdown`.
|
|
@@ -47,7 +41,7 @@ const mdxInternal = async ({
|
|
|
47
41
|
if (codeBlocks) {
|
|
48
42
|
const codeBlocksConfig = (0, _defu.default)(codeBlocksOptions, {
|
|
49
43
|
...mdxPlugin.flatCodeBlocks,
|
|
50
|
-
name:
|
|
44
|
+
name: "vdustr/mdx/code-blocks",
|
|
51
45
|
rules: (0, _renameRules.renameRules)(mdxPlugin.flatCodeBlocks.rules ?? {}),
|
|
52
46
|
/**
|
|
53
47
|
* Handled by `@eslint/markdown`.
|
|
@@ -58,6 +52,4 @@ const mdxInternal = async ({
|
|
|
58
52
|
}
|
|
59
53
|
return configs;
|
|
60
54
|
};
|
|
61
|
-
|
|
62
|
-
configNamesMapSource
|
|
63
|
-
});
|
|
55
|
+
exports.mdx = mdx;
|
|
@@ -1,21 +1,8 @@
|
|
|
1
|
-
import type { TypedFlatConfigItem } from "
|
|
2
|
-
import type { ConfigOverrides, ResolveConfigNamesMap } from "../types";
|
|
3
|
-
declare const configNamesMapSource: {
|
|
4
|
-
readonly rules: "vdustr/prettier/rules";
|
|
5
|
-
};
|
|
6
|
-
declare module "../types" {
|
|
7
|
-
interface ConfigNamesMap extends ResolveConfigNamesMap<prettier.ConfigNamesMapSource> {
|
|
8
|
-
}
|
|
9
|
-
}
|
|
1
|
+
import type { ConfigOverrides, TypedFlatConfigItem } from "../types";
|
|
10
2
|
declare namespace prettier {
|
|
11
|
-
type ConfigNamesMapSource = typeof configNamesMapSource;
|
|
12
3
|
interface Options {
|
|
13
4
|
prettier?: ConfigOverrides;
|
|
14
5
|
}
|
|
15
6
|
}
|
|
16
|
-
declare const prettier: (
|
|
17
|
-
configNamesMapSource: {
|
|
18
|
-
readonly rules: "vdustr/prettier/rules";
|
|
19
|
-
};
|
|
20
|
-
};
|
|
7
|
+
declare const prettier: (options?: prettier.Options) => Promise<TypedFlatConfigItem>;
|
|
21
8
|
export { prettier };
|
package/dist/configs/prettier.js
CHANGED
|
@@ -8,19 +8,14 @@ var _eslintConfig = require("@antfu/eslint-config");
|
|
|
8
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
|
-
const
|
|
12
|
-
rules: "vdustr/prettier/rules"
|
|
13
|
-
};
|
|
14
|
-
const prettierInternal = async options => {
|
|
11
|
+
const prettier = async options => {
|
|
15
12
|
await (0, _eslintConfig.ensurePackages)(["eslint-config-prettier"]);
|
|
16
13
|
const eslintConfigPrettier = await (0, _eslintConfig.interopDefault)(Promise.resolve().then(() => require("eslint-config-prettier")));
|
|
17
14
|
const rulesConfig = (0, _defu.default)(options?.prettier, {
|
|
18
15
|
...eslintConfigPrettier,
|
|
19
16
|
rules: (0, _renameRules.renameRules)(eslintConfigPrettier.rules),
|
|
20
|
-
name:
|
|
17
|
+
name: "vdustr/prettier/rules"
|
|
21
18
|
});
|
|
22
19
|
return rulesConfig;
|
|
23
20
|
};
|
|
24
|
-
|
|
25
|
-
configNamesMapSource
|
|
26
|
-
});
|
|
21
|
+
exports.prettier = prettier;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { ConfigOverrides, TypedFlatConfigItem } from "../types";
|
|
2
|
+
declare namespace reactCompiler {
|
|
3
|
+
interface Options {
|
|
4
|
+
setup?: ConfigOverrides;
|
|
5
|
+
reactCompiler?: ConfigOverrides;
|
|
6
|
+
}
|
|
7
|
+
}
|
|
8
|
+
declare const reactCompiler: (options?: reactCompiler.Options) => Promise<TypedFlatConfigItem[]>;
|
|
9
|
+
export { reactCompiler };
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.reactCompiler = void 0;
|
|
7
|
+
var _defu = _interopRequireDefault(require("defu"));
|
|
8
|
+
var _eslintPluginReactCompiler = require("../lib/eslint-plugin-react-compiler");
|
|
9
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
10
|
+
const reactCompiler = async options => {
|
|
11
|
+
const reactCompilerSetupConfig = (0, _defu.default)(options?.setup, {
|
|
12
|
+
name: "vdustr/react/react-compiler/setup",
|
|
13
|
+
plugins: {
|
|
14
|
+
"react-compiler": await (0, _eslintPluginReactCompiler.reactCompiler)()
|
|
15
|
+
}
|
|
16
|
+
});
|
|
17
|
+
const reactCompilerRulesConfig = (0, _defu.default)(options?.reactCompiler, {
|
|
18
|
+
name: "vdustr/react/react-compiler/rules",
|
|
19
|
+
rules: {
|
|
20
|
+
"react-compiler/react-compiler": "error"
|
|
21
|
+
}
|
|
22
|
+
});
|
|
23
|
+
return [reactCompilerSetupConfig, reactCompilerRulesConfig];
|
|
24
|
+
};
|
|
25
|
+
exports.reactCompiler = reactCompiler;
|
|
@@ -1,26 +1,9 @@
|
|
|
1
|
-
import type { TypedFlatConfigItem } from "
|
|
2
|
-
import type { ConfigOverrides, ResolveConfigNamesMap } from "../types";
|
|
3
|
-
declare const configNamesMapSource: {
|
|
4
|
-
readonly setup: "vdustr/stroybook/setup";
|
|
5
|
-
readonly storiesRules: "vdustr/storybook/stories/rules";
|
|
6
|
-
readonly mainRules: "vdustr/storybook/main/rules";
|
|
7
|
-
};
|
|
8
|
-
declare module "../types" {
|
|
9
|
-
interface ConfigNamesMap extends ResolveConfigNamesMap<storybook.ConfigNamesMapSource> {
|
|
10
|
-
}
|
|
11
|
-
}
|
|
1
|
+
import type { ConfigOverrides, TypedFlatConfigItem } from "../types";
|
|
12
2
|
declare namespace storybook {
|
|
13
|
-
type ConfigNamesMapSource = typeof configNamesMapSource;
|
|
14
3
|
interface Options {
|
|
15
4
|
stories?: ConfigOverrides;
|
|
16
5
|
main?: ConfigOverrides;
|
|
17
6
|
}
|
|
18
7
|
}
|
|
19
|
-
declare const storybook: (
|
|
20
|
-
configNamesMapSource: {
|
|
21
|
-
readonly setup: "vdustr/stroybook/setup";
|
|
22
|
-
readonly storiesRules: "vdustr/storybook/stories/rules";
|
|
23
|
-
readonly mainRules: "vdustr/storybook/main/rules";
|
|
24
|
-
};
|
|
25
|
-
};
|
|
8
|
+
declare const storybook: (options?: storybook.Options) => Promise<Array<TypedFlatConfigItem>>;
|
|
26
9
|
export { storybook };
|
|
@@ -9,12 +9,7 @@ var _defu = _interopRequireDefault(require("defu"));
|
|
|
9
9
|
var _esToolkit = require("es-toolkit");
|
|
10
10
|
var _renameRules = require("../utils/renameRules");
|
|
11
11
|
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
12
|
-
const
|
|
13
|
-
setup: "vdustr/stroybook/setup",
|
|
14
|
-
storiesRules: "vdustr/storybook/stories/rules",
|
|
15
|
-
mainRules: "vdustr/storybook/main/rules"
|
|
16
|
-
};
|
|
17
|
-
const storybookInternal = async options => {
|
|
12
|
+
const storybook = async options => {
|
|
18
13
|
await (0, _eslintConfig.ensurePackages)(["eslint-plugin-storybook"]);
|
|
19
14
|
const storybookPlugin = await (0, _eslintConfig.interopDefault)(Promise.resolve().then(() => require("eslint-plugin-storybook")));
|
|
20
15
|
const inheritingConfigs = storybookPlugin.configs["flat/csf-strict"];
|
|
@@ -28,10 +23,10 @@ const storybookInternal = async options => {
|
|
|
28
23
|
if (!originalCsfStrictConfig) throw new Error("Missing csf strict config");
|
|
29
24
|
const setupConfig = {
|
|
30
25
|
...(0, _esToolkit.pick)(originalSetupConfig, ["plugins"]),
|
|
31
|
-
name:
|
|
26
|
+
name: "vdustr/stroybook/setup"
|
|
32
27
|
};
|
|
33
28
|
const storyRulesConfig = (0, _defu.default)(options?.stories, {
|
|
34
|
-
name:
|
|
29
|
+
name: "vdustr/storybook/stories/rules",
|
|
35
30
|
rules: {
|
|
36
31
|
"import/no-default-export": "off"
|
|
37
32
|
}
|
|
@@ -44,13 +39,11 @@ const storybookInternal = async options => {
|
|
|
44
39
|
})
|
|
45
40
|
});
|
|
46
41
|
const mainRulesConfig = (0, _defu.default)(options?.main, {
|
|
47
|
-
name:
|
|
42
|
+
name: "vdustr/storybook/main/rules"
|
|
48
43
|
}, {
|
|
49
44
|
...originalMainRulesConfig,
|
|
50
45
|
rules: (0, _renameRules.renameRules)(originalMainRulesConfig.rules ?? {})
|
|
51
46
|
});
|
|
52
47
|
return [setupConfig, storyRulesConfig, mainRulesConfig];
|
|
53
48
|
};
|
|
54
|
-
|
|
55
|
-
configNamesMapSource
|
|
56
|
-
});
|
|
49
|
+
exports.storybook = storybook;
|
package/dist/eslint-typegen.d.ts
CHANGED
|
@@ -2,12 +2,6 @@
|
|
|
2
2
|
/* prettier-ignore */
|
|
3
3
|
import type { Linter } from 'eslint'
|
|
4
4
|
|
|
5
|
-
declare module 'eslint' {
|
|
6
|
-
namespace Linter {
|
|
7
|
-
interface RulesRecord extends RuleOptions {}
|
|
8
|
-
}
|
|
9
|
-
}
|
|
10
|
-
|
|
11
5
|
export interface RuleOptions {
|
|
12
6
|
/**
|
|
13
7
|
* Linter integration with remark plugins
|
|
@@ -103,4 +97,7 @@ type StorybookNoUninstalledAddons = []|[{
|
|
|
103
97
|
packageJsonLocation?: string
|
|
104
98
|
ignore?: string[]
|
|
105
99
|
[k: string]: unknown | undefined
|
|
106
|
-
}]
|
|
100
|
+
}]
|
|
101
|
+
// Names of all the configs
|
|
102
|
+
export type ConfigNames = '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'
|
|
103
|
+
|
|
@@ -1,29 +1,10 @@
|
|
|
1
|
-
import type { TypedFlatConfigItem } from "
|
|
2
|
-
import type { ConfigOverrides, ResolveConfigNamesMap } from "../types";
|
|
3
|
-
declare const configNamesMapSource: {
|
|
4
|
-
readonly setup: "vdustr/mdx/setup";
|
|
5
|
-
readonly processor: "vdustr/mdx/processor";
|
|
6
|
-
readonly rules: "vdustr/mdx/rules";
|
|
7
|
-
readonly codeBlocks: "vdustr/mdx/code-blocks";
|
|
8
|
-
};
|
|
9
|
-
declare module "../types" {
|
|
10
|
-
interface ConfigNamesMap extends ResolveConfigNamesMap<mdx.ConfigNamesMapSource> {
|
|
11
|
-
}
|
|
12
|
-
}
|
|
1
|
+
import type { ConfigOverrides, TypedFlatConfigItem } from "../types";
|
|
13
2
|
declare namespace mdx {
|
|
14
|
-
type ConfigNamesMapSource = typeof configNamesMapSource;
|
|
15
3
|
interface Options {
|
|
16
4
|
mdx?: ConfigOverrides;
|
|
17
5
|
processorOptions?: Omit<import("eslint-plugin-mdx").ProcessorOptions, "lintCodeBlocks">;
|
|
18
6
|
codeBlocks?: boolean | ConfigOverrides;
|
|
19
7
|
}
|
|
20
8
|
}
|
|
21
|
-
declare const mdx: (
|
|
22
|
-
configNamesMapSource: {
|
|
23
|
-
readonly setup: "vdustr/mdx/setup";
|
|
24
|
-
readonly processor: "vdustr/mdx/processor";
|
|
25
|
-
readonly rules: "vdustr/mdx/rules";
|
|
26
|
-
readonly codeBlocks: "vdustr/mdx/code-blocks";
|
|
27
|
-
};
|
|
28
|
-
};
|
|
9
|
+
declare const mdx: ({ codeBlocks, processorOptions, ...options }?: mdx.Options) => Promise<Array<TypedFlatConfigItem>>;
|
|
29
10
|
export { mdx };
|
package/dist/esm/configs/mdx.mjs
CHANGED
|
@@ -7,13 +7,7 @@ import {
|
|
|
7
7
|
import defu from "defu";
|
|
8
8
|
import { omit, pick } from "es-toolkit";
|
|
9
9
|
import { renameRules } from "../utils/renameRules.mjs";
|
|
10
|
-
const
|
|
11
|
-
setup: "vdustr/mdx/setup",
|
|
12
|
-
processor: "vdustr/mdx/processor",
|
|
13
|
-
rules: "vdustr/mdx/rules",
|
|
14
|
-
codeBlocks: "vdustr/mdx/code-blocks"
|
|
15
|
-
};
|
|
16
|
-
const mdxInternal = async ({
|
|
10
|
+
const mdx = async ({
|
|
17
11
|
codeBlocks = true,
|
|
18
12
|
processorOptions,
|
|
19
13
|
...options
|
|
@@ -23,20 +17,20 @@ const mdxInternal = async ({
|
|
|
23
17
|
const codeBlocksOptions = typeof codeBlocks !== "object" ? {} : codeBlocks;
|
|
24
18
|
const setupConfig = {
|
|
25
19
|
...pick(mdxPlugin.flat, ["plugins"]),
|
|
26
|
-
name:
|
|
20
|
+
name: "vdustr/mdx/setup"
|
|
27
21
|
};
|
|
28
22
|
const processorConfig = {
|
|
29
23
|
processor: mdxPlugin.createRemarkProcessor({
|
|
30
24
|
...processorOptions,
|
|
31
25
|
lintCodeBlocks: Boolean(codeBlocks)
|
|
32
26
|
}),
|
|
33
|
-
name:
|
|
27
|
+
name: "vdustr/mdx/processor"
|
|
34
28
|
};
|
|
35
29
|
const rulesConfig = defu(
|
|
36
30
|
options.mdx,
|
|
37
31
|
{
|
|
38
32
|
...omit(mdxPlugin.flat, ["plugins", "processor"]),
|
|
39
|
-
name:
|
|
33
|
+
name: "vdustr/mdx/rules",
|
|
40
34
|
rules: renameRules(mdxPlugin.flat.rules ?? {}),
|
|
41
35
|
/**
|
|
42
36
|
* Handled by `@eslint/markdown`.
|
|
@@ -48,7 +42,7 @@ const mdxInternal = async ({
|
|
|
48
42
|
if (codeBlocks) {
|
|
49
43
|
const codeBlocksConfig = defu(codeBlocksOptions, {
|
|
50
44
|
...mdxPlugin.flatCodeBlocks,
|
|
51
|
-
name:
|
|
45
|
+
name: "vdustr/mdx/code-blocks",
|
|
52
46
|
rules: renameRules(mdxPlugin.flatCodeBlocks.rules ?? {}),
|
|
53
47
|
/**
|
|
54
48
|
* Handled by `@eslint/markdown`.
|
|
@@ -62,7 +56,4 @@ const mdxInternal = async ({
|
|
|
62
56
|
}
|
|
63
57
|
return configs;
|
|
64
58
|
};
|
|
65
|
-
const mdx = Object.assign(mdxInternal, {
|
|
66
|
-
configNamesMapSource
|
|
67
|
-
});
|
|
68
59
|
export { mdx };
|
|
@@ -1,21 +1,8 @@
|
|
|
1
|
-
import type { TypedFlatConfigItem } from "
|
|
2
|
-
import type { ConfigOverrides, ResolveConfigNamesMap } from "../types";
|
|
3
|
-
declare const configNamesMapSource: {
|
|
4
|
-
readonly rules: "vdustr/prettier/rules";
|
|
5
|
-
};
|
|
6
|
-
declare module "../types" {
|
|
7
|
-
interface ConfigNamesMap extends ResolveConfigNamesMap<prettier.ConfigNamesMapSource> {
|
|
8
|
-
}
|
|
9
|
-
}
|
|
1
|
+
import type { ConfigOverrides, TypedFlatConfigItem } from "../types";
|
|
10
2
|
declare namespace prettier {
|
|
11
|
-
type ConfigNamesMapSource = typeof configNamesMapSource;
|
|
12
3
|
interface Options {
|
|
13
4
|
prettier?: ConfigOverrides;
|
|
14
5
|
}
|
|
15
6
|
}
|
|
16
|
-
declare const prettier: (
|
|
17
|
-
configNamesMapSource: {
|
|
18
|
-
readonly rules: "vdustr/prettier/rules";
|
|
19
|
-
};
|
|
20
|
-
};
|
|
7
|
+
declare const prettier: (options?: prettier.Options) => Promise<TypedFlatConfigItem>;
|
|
21
8
|
export { prettier };
|
|
@@ -1,10 +1,7 @@
|
|
|
1
1
|
import { ensurePackages, interopDefault } from "@antfu/eslint-config";
|
|
2
2
|
import defu from "defu";
|
|
3
3
|
import { renameRules } from "../utils/renameRules.mjs";
|
|
4
|
-
const
|
|
5
|
-
rules: "vdustr/prettier/rules"
|
|
6
|
-
};
|
|
7
|
-
const prettierInternal = async (options) => {
|
|
4
|
+
const prettier = async (options) => {
|
|
8
5
|
await ensurePackages(["eslint-config-prettier"]);
|
|
9
6
|
const eslintConfigPrettier = await interopDefault(
|
|
10
7
|
import("eslint-config-prettier")
|
|
@@ -14,12 +11,9 @@ const prettierInternal = async (options) => {
|
|
|
14
11
|
{
|
|
15
12
|
...eslintConfigPrettier,
|
|
16
13
|
rules: renameRules(eslintConfigPrettier.rules),
|
|
17
|
-
name:
|
|
14
|
+
name: "vdustr/prettier/rules"
|
|
18
15
|
}
|
|
19
16
|
);
|
|
20
17
|
return rulesConfig;
|
|
21
18
|
};
|
|
22
|
-
const prettier = Object.assign(prettierInternal, {
|
|
23
|
-
configNamesMapSource
|
|
24
|
-
});
|
|
25
19
|
export { prettier };
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { ConfigOverrides, TypedFlatConfigItem } from "../types";
|
|
2
|
+
declare namespace reactCompiler {
|
|
3
|
+
interface Options {
|
|
4
|
+
setup?: ConfigOverrides;
|
|
5
|
+
reactCompiler?: ConfigOverrides;
|
|
6
|
+
}
|
|
7
|
+
}
|
|
8
|
+
declare const reactCompiler: (options?: reactCompiler.Options) => Promise<TypedFlatConfigItem[]>;
|
|
9
|
+
export { reactCompiler };
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import defu from "defu";
|
|
2
|
+
import { reactCompiler as importLib } from "../lib/eslint-plugin-react-compiler.mjs";
|
|
3
|
+
const reactCompiler = async (options) => {
|
|
4
|
+
const reactCompilerSetupConfig = defu(options?.setup, {
|
|
5
|
+
name: "vdustr/react/react-compiler/setup",
|
|
6
|
+
plugins: {
|
|
7
|
+
"react-compiler": await importLib()
|
|
8
|
+
}
|
|
9
|
+
});
|
|
10
|
+
const reactCompilerRulesConfig = defu(options?.reactCompiler, {
|
|
11
|
+
name: "vdustr/react/react-compiler/rules",
|
|
12
|
+
rules: {
|
|
13
|
+
"react-compiler/react-compiler": "error"
|
|
14
|
+
}
|
|
15
|
+
});
|
|
16
|
+
return [reactCompilerSetupConfig, reactCompilerRulesConfig];
|
|
17
|
+
};
|
|
18
|
+
export { reactCompiler };
|
|
@@ -1,26 +1,9 @@
|
|
|
1
|
-
import type { TypedFlatConfigItem } from "
|
|
2
|
-
import type { ConfigOverrides, ResolveConfigNamesMap } from "../types";
|
|
3
|
-
declare const configNamesMapSource: {
|
|
4
|
-
readonly setup: "vdustr/stroybook/setup";
|
|
5
|
-
readonly storiesRules: "vdustr/storybook/stories/rules";
|
|
6
|
-
readonly mainRules: "vdustr/storybook/main/rules";
|
|
7
|
-
};
|
|
8
|
-
declare module "../types" {
|
|
9
|
-
interface ConfigNamesMap extends ResolveConfigNamesMap<storybook.ConfigNamesMapSource> {
|
|
10
|
-
}
|
|
11
|
-
}
|
|
1
|
+
import type { ConfigOverrides, TypedFlatConfigItem } from "../types";
|
|
12
2
|
declare namespace storybook {
|
|
13
|
-
type ConfigNamesMapSource = typeof configNamesMapSource;
|
|
14
3
|
interface Options {
|
|
15
4
|
stories?: ConfigOverrides;
|
|
16
5
|
main?: ConfigOverrides;
|
|
17
6
|
}
|
|
18
7
|
}
|
|
19
|
-
declare const storybook: (
|
|
20
|
-
configNamesMapSource: {
|
|
21
|
-
readonly setup: "vdustr/stroybook/setup";
|
|
22
|
-
readonly storiesRules: "vdustr/storybook/stories/rules";
|
|
23
|
-
readonly mainRules: "vdustr/storybook/main/rules";
|
|
24
|
-
};
|
|
25
|
-
};
|
|
8
|
+
declare const storybook: (options?: storybook.Options) => Promise<Array<TypedFlatConfigItem>>;
|
|
26
9
|
export { storybook };
|
|
@@ -2,12 +2,7 @@ import { ensurePackages, interopDefault } from "@antfu/eslint-config";
|
|
|
2
2
|
import defu from "defu";
|
|
3
3
|
import { pick } from "es-toolkit";
|
|
4
4
|
import { renameRules } from "../utils/renameRules.mjs";
|
|
5
|
-
const
|
|
6
|
-
setup: "vdustr/stroybook/setup",
|
|
7
|
-
storiesRules: "vdustr/storybook/stories/rules",
|
|
8
|
-
mainRules: "vdustr/storybook/main/rules"
|
|
9
|
-
};
|
|
10
|
-
const storybookInternal = async (options) => {
|
|
5
|
+
const storybook = async (options) => {
|
|
11
6
|
await ensurePackages(["eslint-plugin-storybook"]);
|
|
12
7
|
const storybookPlugin = await interopDefault(
|
|
13
8
|
import("eslint-plugin-storybook")
|
|
@@ -23,12 +18,12 @@ const storybookInternal = async (options) => {
|
|
|
23
18
|
if (!originalCsfStrictConfig) throw new Error("Missing csf strict config");
|
|
24
19
|
const setupConfig = {
|
|
25
20
|
...pick(originalSetupConfig, ["plugins"]),
|
|
26
|
-
name:
|
|
21
|
+
name: "vdustr/stroybook/setup"
|
|
27
22
|
};
|
|
28
23
|
const storyRulesConfig = defu(
|
|
29
24
|
options?.stories,
|
|
30
25
|
{
|
|
31
|
-
name:
|
|
26
|
+
name: "vdustr/storybook/stories/rules",
|
|
32
27
|
rules: {
|
|
33
28
|
"import/no-default-export": "off"
|
|
34
29
|
}
|
|
@@ -45,7 +40,7 @@ const storybookInternal = async (options) => {
|
|
|
45
40
|
const mainRulesConfig = defu(
|
|
46
41
|
options?.main,
|
|
47
42
|
{
|
|
48
|
-
name:
|
|
43
|
+
name: "vdustr/storybook/main/rules"
|
|
49
44
|
},
|
|
50
45
|
{
|
|
51
46
|
...originalMainRulesConfig,
|
|
@@ -58,7 +53,4 @@ const storybookInternal = async (options) => {
|
|
|
58
53
|
mainRulesConfig
|
|
59
54
|
];
|
|
60
55
|
};
|
|
61
|
-
const storybook = Object.assign(storybookInternal, {
|
|
62
|
-
configNamesMapSource
|
|
63
|
-
});
|
|
64
56
|
export { storybook };
|
|
@@ -2,12 +2,6 @@
|
|
|
2
2
|
/* prettier-ignore */
|
|
3
3
|
import type { Linter } from 'eslint'
|
|
4
4
|
|
|
5
|
-
declare module 'eslint' {
|
|
6
|
-
namespace Linter {
|
|
7
|
-
interface RulesRecord extends RuleOptions {}
|
|
8
|
-
}
|
|
9
|
-
}
|
|
10
|
-
|
|
11
5
|
export interface RuleOptions {
|
|
12
6
|
/**
|
|
13
7
|
* Linter integration with remark plugins
|
|
@@ -103,4 +97,7 @@ type StorybookNoUninstalledAddons = []|[{
|
|
|
103
97
|
packageJsonLocation?: string
|
|
104
98
|
ignore?: string[]
|
|
105
99
|
[k: string]: unknown | undefined
|
|
106
|
-
}]
|
|
100
|
+
}]
|
|
101
|
+
// Names of all the configs
|
|
102
|
+
export type ConfigNames = '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'
|
|
103
|
+
|
|
@@ -1,25 +1,9 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
import type { FlatConfigComposer } from "eslint-flat-config-utils";
|
|
3
|
-
import type { ConfigOverrides, ResolveConfigNamesMap } from "../types";
|
|
4
|
-
declare const configNamesMapSource: {
|
|
5
|
-
readonly imports: "vdustr/imports/rules";
|
|
6
|
-
readonly noDefaultExport: "vdustr/imports/no-default-export/rules";
|
|
7
|
-
};
|
|
8
|
-
declare module "../types" {
|
|
9
|
-
interface ConfigNamesMap extends ResolveConfigNamesMap<imports.ConfigNamesMapSource> {
|
|
10
|
-
}
|
|
11
|
-
}
|
|
1
|
+
import type { ConfigOverrides, VpComposer } from "../types";
|
|
12
2
|
declare namespace imports {
|
|
13
|
-
type ConfigNamesMapSource = typeof configNamesMapSource;
|
|
14
3
|
interface Options {
|
|
15
4
|
imports?: ConfigOverrides;
|
|
16
5
|
noDefaultExport?: ConfigOverrides;
|
|
17
6
|
}
|
|
18
7
|
}
|
|
19
|
-
declare const imports: (
|
|
20
|
-
configNamesMapSource: {
|
|
21
|
-
readonly imports: "vdustr/imports/rules";
|
|
22
|
-
readonly noDefaultExport: "vdustr/imports/no-default-export/rules";
|
|
23
|
-
};
|
|
24
|
-
};
|
|
8
|
+
declare const imports: (composer: VpComposer, options?: imports.Options) => void;
|
|
25
9
|
export { imports };
|
|
@@ -11,18 +11,14 @@ import { omit, pick } from "es-toolkit";
|
|
|
11
11
|
import { GLOB_CONFIG_JS } from "../globs.mjs";
|
|
12
12
|
import { extendsConfig } from "../utils/extendsConfig.mjs";
|
|
13
13
|
import { ignoreKeys } from "./_utils.mjs";
|
|
14
|
-
const
|
|
15
|
-
imports: "vdustr/imports/rules",
|
|
16
|
-
noDefaultExport: "vdustr/imports/no-default-export/rules"
|
|
17
|
-
};
|
|
18
|
-
const importsInternal = (composer, options) => {
|
|
14
|
+
const imports = (composer, options) => {
|
|
19
15
|
extendsConfig(composer, "antfu/imports/rules", (config) => {
|
|
20
16
|
const modifiedConfig = defu(pick(options?.imports ?? {}, ["files", "ignores"]), config);
|
|
21
17
|
const omittedConfig = omit(modifiedConfig, ignoreKeys);
|
|
22
18
|
const rulesConfig = defu(
|
|
23
19
|
omit(options?.imports ?? {}, ["files", "ignores"]),
|
|
24
20
|
{
|
|
25
|
-
name:
|
|
21
|
+
name: "vdustr/imports/rules",
|
|
26
22
|
rules: {
|
|
27
23
|
/**
|
|
28
24
|
* Forbid `import {} from "module"`.
|
|
@@ -40,7 +36,7 @@ const importsInternal = (composer, options) => {
|
|
|
40
36
|
const noDefaultExportConfig = defu(
|
|
41
37
|
options?.noDefaultExport,
|
|
42
38
|
{
|
|
43
|
-
name:
|
|
39
|
+
name: "vdustr/imports/no-default-export/rules",
|
|
44
40
|
rules: {
|
|
45
41
|
/**
|
|
46
42
|
* Enforcing named exports improves consistency, enhances
|
|
@@ -70,7 +66,4 @@ const importsInternal = (composer, options) => {
|
|
|
70
66
|
return [modifiedConfig, rulesConfig, noDefaultExportConfig];
|
|
71
67
|
});
|
|
72
68
|
};
|
|
73
|
-
const imports = Object.assign(importsInternal, {
|
|
74
|
-
configNamesMapSource
|
|
75
|
-
});
|
|
76
69
|
export { imports };
|