@vp-tw/eslint-config 0.0.22 → 0.0.24
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/dist/configs/mdx.js +3 -4
- package/dist/configs/packageJson.d.ts +9 -0
- package/dist/configs/packageJson.js +25 -0
- package/dist/configs/prettier.js +2 -3
- package/dist/configs/reactCompiler.d.ts +2 -2
- package/dist/configs/reactCompiler.js +3 -4
- package/dist/configs/storybook.js +3 -4
- package/dist/eslint-typegen.d.ts +1 -1
- package/dist/esm/configs/mdx.mjs +3 -3
- package/dist/esm/configs/packageJson.d.ts +9 -0
- package/dist/esm/configs/packageJson.mjs +21 -0
- package/dist/esm/configs/prettier.mjs +6 -9
- package/dist/esm/configs/reactCompiler.d.ts +2 -2
- package/dist/esm/configs/reactCompiler.mjs +3 -3
- package/dist/esm/configs/storybook.mjs +3 -3
- package/dist/esm/eslint-typegen.d.ts +1 -1
- package/dist/esm/extends/imports.mjs +10 -13
- package/dist/esm/extends/javascript.mjs +6 -3
- package/dist/esm/extends/jsonc.d.ts +0 -2
- package/dist/esm/extends/jsonc.mjs +23 -76
- package/dist/esm/extends/react.mjs +7 -4
- package/dist/esm/extends/sort.d.ts +29 -0
- package/dist/esm/extends/sort.mjs +100 -0
- package/dist/esm/extends/typescript.mjs +6 -3
- package/dist/esm/extends/yaml.mjs +7 -4
- package/dist/esm/globs.d.ts +2 -1
- package/dist/esm/globs.mjs +3 -1
- package/dist/esm/types.d.ts +9 -3
- package/dist/esm/utils/extendsConfig.d.ts +14 -1
- package/dist/esm/utils/extendsConfig.mjs +21 -24
- package/dist/esm/utils/mergeConfig.d.ts +3 -0
- package/dist/esm/utils/mergeConfig.mjs +56 -0
- package/dist/esm/vdustr.d.ts +15 -6
- package/dist/esm/vdustr.mjs +49 -15
- package/dist/extends/imports.js +6 -7
- package/dist/extends/javascript.js +3 -4
- package/dist/extends/jsonc.d.ts +0 -2
- package/dist/extends/jsonc.js +7 -42
- package/dist/extends/react.js +4 -5
- package/dist/extends/sort.d.ts +29 -0
- package/dist/extends/sort.js +82 -0
- package/dist/extends/typescript.js +3 -4
- package/dist/extends/yaml.js +4 -4
- package/dist/globs.d.ts +2 -1
- package/dist/globs.js +3 -2
- package/dist/types.d.ts +9 -3
- package/dist/utils/extendsConfig.d.ts +14 -1
- package/dist/utils/extendsConfig.js +14 -18
- package/dist/utils/mergeConfig.d.ts +3 -0
- package/dist/utils/mergeConfig.js +47 -0
- package/dist/vdustr.d.ts +15 -6
- package/dist/vdustr.js +32 -15
- package/package.json +1 -2
package/dist/configs/mdx.js
CHANGED
|
@@ -5,10 +5,9 @@ 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"));
|
|
9
8
|
var _esToolkit = require("es-toolkit");
|
|
9
|
+
var _mergeConfig = require("../utils/mergeConfig");
|
|
10
10
|
var _renameRules = require("../utils/renameRules");
|
|
11
|
-
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
12
11
|
const mdx = async ({
|
|
13
12
|
codeBlocks = true,
|
|
14
13
|
processorOptions,
|
|
@@ -28,7 +27,7 @@ const mdx = async ({
|
|
|
28
27
|
}),
|
|
29
28
|
name: "vdustr/mdx/processor"
|
|
30
29
|
};
|
|
31
|
-
const rulesConfig = (0,
|
|
30
|
+
const rulesConfig = (0, _mergeConfig.mergeConfig)(options.mdx, {
|
|
32
31
|
ignores: [
|
|
33
32
|
/**
|
|
34
33
|
* Handled by `@eslint/markdown`.
|
|
@@ -42,7 +41,7 @@ const mdx = async ({
|
|
|
42
41
|
});
|
|
43
42
|
const configs = [setupConfig, processorConfig, rulesConfig];
|
|
44
43
|
if (codeBlocks) {
|
|
45
|
-
const codeBlocksConfig = (0,
|
|
44
|
+
const codeBlocksConfig = (0, _mergeConfig.mergeConfig)(codeBlocksOptions, {
|
|
46
45
|
rules: {
|
|
47
46
|
"import/no-default-export": "off"
|
|
48
47
|
},
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { ConfigOverrides, TypedFlatConfigItem } from "../types";
|
|
2
|
+
declare namespace packageJson {
|
|
3
|
+
interface Options {
|
|
4
|
+
setup?: ConfigOverrides;
|
|
5
|
+
packageJson?: ConfigOverrides;
|
|
6
|
+
}
|
|
7
|
+
}
|
|
8
|
+
declare const packageJson: (options?: packageJson.Options) => Promise<TypedFlatConfigItem[]>;
|
|
9
|
+
export { packageJson };
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.packageJson = void 0;
|
|
7
|
+
var _eslintConfig = require("@antfu/eslint-config");
|
|
8
|
+
var _esToolkit = require("es-toolkit");
|
|
9
|
+
var _mergeConfig = require("../utils/mergeConfig");
|
|
10
|
+
var _renameRules = require("../utils/renameRules");
|
|
11
|
+
const packageJson = async options => {
|
|
12
|
+
await (0, _eslintConfig.ensurePackages)(["eslint-plugin-package-json"]);
|
|
13
|
+
const packageJson2 = await (0, _eslintConfig.interopDefault)(Promise.resolve().then(() => require("eslint-plugin-package-json/configs/recommended")));
|
|
14
|
+
const packageJsonSetupConfig = {
|
|
15
|
+
plugins: packageJson2.plugins,
|
|
16
|
+
name: "vdustr/package-json/setup"
|
|
17
|
+
};
|
|
18
|
+
const packageJsonRulesConfig = (0, _mergeConfig.mergeConfig)(options?.packageJson, {
|
|
19
|
+
...(0, _esToolkit.omit)(packageJson2, ["name", "plugins"]),
|
|
20
|
+
rules: (0, _renameRules.renameRules)(packageJson2.rules),
|
|
21
|
+
name: "vdustr/package-json/rules"
|
|
22
|
+
});
|
|
23
|
+
return [packageJsonSetupConfig, packageJsonRulesConfig];
|
|
24
|
+
};
|
|
25
|
+
exports.packageJson = packageJson;
|
package/dist/configs/prettier.js
CHANGED
|
@@ -5,13 +5,12 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
});
|
|
6
6
|
exports.prettier = void 0;
|
|
7
7
|
var _eslintConfig = require("@antfu/eslint-config");
|
|
8
|
-
var
|
|
8
|
+
var _mergeConfig = require("../utils/mergeConfig");
|
|
9
9
|
var _renameRules = require("../utils/renameRules");
|
|
10
|
-
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
11
10
|
const prettier = async options => {
|
|
12
11
|
await (0, _eslintConfig.ensurePackages)(["eslint-config-prettier"]);
|
|
13
12
|
const eslintConfigPrettier = await (0, _eslintConfig.interopDefault)(Promise.resolve().then(() => require("eslint-config-prettier")));
|
|
14
|
-
const rulesConfig = (0,
|
|
13
|
+
const rulesConfig = (0, _mergeConfig.mergeConfig)(options?.prettier, {
|
|
15
14
|
...eslintConfigPrettier,
|
|
16
15
|
rules: (0, _renameRules.renameRules)(eslintConfigPrettier.rules),
|
|
17
16
|
name: "vdustr/prettier/rules"
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import type { ConfigOverrides
|
|
1
|
+
import type { ConfigOverrides } from "../types";
|
|
2
2
|
declare namespace reactCompiler {
|
|
3
3
|
interface Options {
|
|
4
4
|
setup?: ConfigOverrides;
|
|
5
5
|
reactCompiler?: ConfigOverrides;
|
|
6
6
|
}
|
|
7
7
|
}
|
|
8
|
-
declare const reactCompiler: (options?: reactCompiler.Options) => Promise<TypedFlatConfigItem[]>;
|
|
8
|
+
declare const reactCompiler: (options?: reactCompiler.Options) => Promise<import("../types").TypedFlatConfigItem[]>;
|
|
9
9
|
export { reactCompiler };
|
|
@@ -4,17 +4,16 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.reactCompiler = void 0;
|
|
7
|
-
var _defu = _interopRequireDefault(require("defu"));
|
|
8
7
|
var _eslintPluginReactCompiler = require("../lib/eslint-plugin-react-compiler");
|
|
9
|
-
|
|
8
|
+
var _mergeConfig = require("../utils/mergeConfig");
|
|
10
9
|
const reactCompiler = async options => {
|
|
11
|
-
const reactCompilerSetupConfig = (0,
|
|
10
|
+
const reactCompilerSetupConfig = (0, _mergeConfig.mergeConfig)(options?.setup, {
|
|
12
11
|
name: "vdustr/react/react-compiler/setup",
|
|
13
12
|
plugins: {
|
|
14
13
|
"react-compiler": await (0, _eslintPluginReactCompiler.reactCompiler)()
|
|
15
14
|
}
|
|
16
15
|
});
|
|
17
|
-
const reactCompilerRulesConfig = (0,
|
|
16
|
+
const reactCompilerRulesConfig = (0, _mergeConfig.mergeConfig)(options?.reactCompiler, {
|
|
18
17
|
name: "vdustr/react/react-compiler/rules",
|
|
19
18
|
rules: {
|
|
20
19
|
"react-compiler/react-compiler": "error"
|
|
@@ -5,10 +5,9 @@ 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"));
|
|
9
8
|
var _esToolkit = require("es-toolkit");
|
|
9
|
+
var _mergeConfig = require("../utils/mergeConfig");
|
|
10
10
|
var _renameRules = require("../utils/renameRules");
|
|
11
|
-
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
12
11
|
const storybook = async options => {
|
|
13
12
|
await (0, _eslintConfig.ensurePackages)(["eslint-plugin-storybook"]);
|
|
14
13
|
const storybookPlugin = await (0, _eslintConfig.interopDefault)(Promise.resolve().then(() => require("eslint-plugin-storybook")));
|
|
@@ -25,7 +24,7 @@ const storybook = async options => {
|
|
|
25
24
|
...(0, _esToolkit.pick)(originalSetupConfig, ["plugins"]),
|
|
26
25
|
name: "vdustr/stroybook/setup"
|
|
27
26
|
};
|
|
28
|
-
const storyRulesConfig = (0,
|
|
27
|
+
const storyRulesConfig = (0, _mergeConfig.mergeConfig)(options?.stories, {
|
|
29
28
|
name: "vdustr/storybook/stories/rules",
|
|
30
29
|
rules: {
|
|
31
30
|
"import/no-default-export": "off"
|
|
@@ -38,7 +37,7 @@ const storybook = async options => {
|
|
|
38
37
|
...originalCsfStrictConfig.rules
|
|
39
38
|
})
|
|
40
39
|
});
|
|
41
|
-
const mainRulesConfig = (0,
|
|
40
|
+
const mainRulesConfig = (0, _mergeConfig.mergeConfig)(options?.main, {
|
|
42
41
|
name: "vdustr/storybook/main/rules"
|
|
43
42
|
}, {
|
|
44
43
|
...originalMainRulesConfig,
|
package/dist/eslint-typegen.d.ts
CHANGED
|
@@ -99,5 +99,5 @@ type StorybookNoUninstalledAddons = []|[{
|
|
|
99
99
|
[k: string]: unknown | undefined
|
|
100
100
|
}]
|
|
101
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'
|
|
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' | 'vdustr/javascript/rules' | 'vdustr/imports/rules' | 'vdustr/imports/no-default-export/rules' | 'vdustr/typescript/rules' | 'vdustr/jsonc/rules' | 'vdustr/sort/json-keys' | 'vdustr/sort/json-array-values' | 'vdustr/sort/tsconfig-json' | 'vdustr/yaml/rules' | 'vdustr/yaml/sort-keys/rules'
|
|
103
103
|
|
package/dist/esm/configs/mdx.mjs
CHANGED
|
@@ -4,8 +4,8 @@ import {
|
|
|
4
4
|
GLOB_MARKDOWN_CODE,
|
|
5
5
|
interopDefault
|
|
6
6
|
} from "@antfu/eslint-config";
|
|
7
|
-
import defu from "defu";
|
|
8
7
|
import { omit, pick } from "es-toolkit";
|
|
8
|
+
import { mergeConfig } from "../utils/mergeConfig.mjs";
|
|
9
9
|
import { renameRules } from "../utils/renameRules.mjs";
|
|
10
10
|
const mdx = async ({
|
|
11
11
|
codeBlocks = true,
|
|
@@ -26,7 +26,7 @@ const mdx = async ({
|
|
|
26
26
|
}),
|
|
27
27
|
name: "vdustr/mdx/processor"
|
|
28
28
|
};
|
|
29
|
-
const rulesConfig =
|
|
29
|
+
const rulesConfig = mergeConfig(
|
|
30
30
|
options.mdx,
|
|
31
31
|
{
|
|
32
32
|
ignores: [
|
|
@@ -45,7 +45,7 @@ const mdx = async ({
|
|
|
45
45
|
);
|
|
46
46
|
const configs = [setupConfig, processorConfig, rulesConfig];
|
|
47
47
|
if (codeBlocks) {
|
|
48
|
-
const codeBlocksConfig =
|
|
48
|
+
const codeBlocksConfig = mergeConfig(
|
|
49
49
|
codeBlocksOptions,
|
|
50
50
|
{
|
|
51
51
|
rules: {
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { ConfigOverrides, TypedFlatConfigItem } from "../types";
|
|
2
|
+
declare namespace packageJson {
|
|
3
|
+
interface Options {
|
|
4
|
+
setup?: ConfigOverrides;
|
|
5
|
+
packageJson?: ConfigOverrides;
|
|
6
|
+
}
|
|
7
|
+
}
|
|
8
|
+
declare const packageJson: (options?: packageJson.Options) => Promise<TypedFlatConfigItem[]>;
|
|
9
|
+
export { packageJson };
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { ensurePackages, interopDefault } from "@antfu/eslint-config";
|
|
2
|
+
import { omit } from "es-toolkit";
|
|
3
|
+
import { mergeConfig } from "../utils/mergeConfig.mjs";
|
|
4
|
+
import { renameRules } from "../utils/renameRules.mjs";
|
|
5
|
+
const packageJson = async (options) => {
|
|
6
|
+
await ensurePackages(["eslint-plugin-package-json"]);
|
|
7
|
+
const packageJson2 = await interopDefault(
|
|
8
|
+
import("eslint-plugin-package-json/configs/recommended")
|
|
9
|
+
);
|
|
10
|
+
const packageJsonSetupConfig = {
|
|
11
|
+
plugins: packageJson2.plugins,
|
|
12
|
+
name: "vdustr/package-json/setup"
|
|
13
|
+
};
|
|
14
|
+
const packageJsonRulesConfig = mergeConfig(options?.packageJson, {
|
|
15
|
+
...omit(packageJson2, ["name", "plugins"]),
|
|
16
|
+
rules: renameRules(packageJson2.rules),
|
|
17
|
+
name: "vdustr/package-json/rules"
|
|
18
|
+
});
|
|
19
|
+
return [packageJsonSetupConfig, packageJsonRulesConfig];
|
|
20
|
+
};
|
|
21
|
+
export { packageJson };
|
|
@@ -1,19 +1,16 @@
|
|
|
1
1
|
import { ensurePackages, interopDefault } from "@antfu/eslint-config";
|
|
2
|
-
import
|
|
2
|
+
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
6
|
const eslintConfigPrettier = await interopDefault(
|
|
7
7
|
import("eslint-config-prettier")
|
|
8
8
|
);
|
|
9
|
-
const rulesConfig =
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
name: "vdustr/prettier/rules"
|
|
15
|
-
}
|
|
16
|
-
);
|
|
9
|
+
const rulesConfig = mergeConfig(options?.prettier, {
|
|
10
|
+
...eslintConfigPrettier,
|
|
11
|
+
rules: renameRules(eslintConfigPrettier.rules),
|
|
12
|
+
name: "vdustr/prettier/rules"
|
|
13
|
+
});
|
|
17
14
|
return rulesConfig;
|
|
18
15
|
};
|
|
19
16
|
export { prettier };
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import type { ConfigOverrides
|
|
1
|
+
import type { ConfigOverrides } from "../types";
|
|
2
2
|
declare namespace reactCompiler {
|
|
3
3
|
interface Options {
|
|
4
4
|
setup?: ConfigOverrides;
|
|
5
5
|
reactCompiler?: ConfigOverrides;
|
|
6
6
|
}
|
|
7
7
|
}
|
|
8
|
-
declare const reactCompiler: (options?: reactCompiler.Options) => Promise<TypedFlatConfigItem[]>;
|
|
8
|
+
declare const reactCompiler: (options?: reactCompiler.Options) => Promise<import("../types").TypedFlatConfigItem[]>;
|
|
9
9
|
export { reactCompiler };
|
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
import defu from "defu";
|
|
2
1
|
import { reactCompiler as importLib } from "../lib/eslint-plugin-react-compiler.mjs";
|
|
2
|
+
import { mergeConfig } from "../utils/mergeConfig.mjs";
|
|
3
3
|
const reactCompiler = async (options) => {
|
|
4
|
-
const reactCompilerSetupConfig =
|
|
4
|
+
const reactCompilerSetupConfig = mergeConfig(options?.setup, {
|
|
5
5
|
name: "vdustr/react/react-compiler/setup",
|
|
6
6
|
plugins: {
|
|
7
7
|
"react-compiler": await importLib()
|
|
8
8
|
}
|
|
9
9
|
});
|
|
10
|
-
const reactCompilerRulesConfig =
|
|
10
|
+
const reactCompilerRulesConfig = mergeConfig(options?.reactCompiler, {
|
|
11
11
|
name: "vdustr/react/react-compiler/rules",
|
|
12
12
|
rules: {
|
|
13
13
|
"react-compiler/react-compiler": "error"
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { ensurePackages, interopDefault } from "@antfu/eslint-config";
|
|
2
|
-
import defu from "defu";
|
|
3
2
|
import { pick } from "es-toolkit";
|
|
3
|
+
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"]);
|
|
@@ -20,7 +20,7 @@ const storybook = async (options) => {
|
|
|
20
20
|
...pick(originalSetupConfig, ["plugins"]),
|
|
21
21
|
name: "vdustr/stroybook/setup"
|
|
22
22
|
};
|
|
23
|
-
const storyRulesConfig =
|
|
23
|
+
const storyRulesConfig = mergeConfig(
|
|
24
24
|
options?.stories,
|
|
25
25
|
{
|
|
26
26
|
name: "vdustr/storybook/stories/rules",
|
|
@@ -37,7 +37,7 @@ const storybook = async (options) => {
|
|
|
37
37
|
})
|
|
38
38
|
}
|
|
39
39
|
);
|
|
40
|
-
const mainRulesConfig =
|
|
40
|
+
const mainRulesConfig = mergeConfig(
|
|
41
41
|
options?.main,
|
|
42
42
|
{
|
|
43
43
|
name: "vdustr/storybook/main/rules"
|
|
@@ -99,5 +99,5 @@ type StorybookNoUninstalledAddons = []|[{
|
|
|
99
99
|
[k: string]: unknown | undefined
|
|
100
100
|
}]
|
|
101
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'
|
|
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' | 'vdustr/javascript/rules' | 'vdustr/imports/rules' | 'vdustr/imports/no-default-export/rules' | 'vdustr/typescript/rules' | 'vdustr/jsonc/rules' | 'vdustr/sort/json-keys' | 'vdustr/sort/json-array-values' | 'vdustr/sort/tsconfig-json' | 'vdustr/yaml/rules' | 'vdustr/yaml/sort-keys/rules'
|
|
103
103
|
|
|
@@ -6,16 +6,19 @@ import {
|
|
|
6
6
|
GLOB_TS,
|
|
7
7
|
GLOB_TSX
|
|
8
8
|
} from "@antfu/eslint-config";
|
|
9
|
-
import defu from "defu";
|
|
10
9
|
import { omit, pick } from "es-toolkit";
|
|
11
|
-
import { GLOB_CONFIG_JS } from "../globs.mjs";
|
|
10
|
+
import { GLOB_CONFIG_JS, GLOB_VITEST_WORKSPACE } from "../globs.mjs";
|
|
12
11
|
import { extendsConfig } from "../utils/extendsConfig.mjs";
|
|
12
|
+
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 =
|
|
16
|
+
const modifiedConfig = mergeConfig(
|
|
17
|
+
pick(options?.imports ?? {}, ["files", "ignores"]),
|
|
18
|
+
config
|
|
19
|
+
);
|
|
17
20
|
const omittedConfig = omit(modifiedConfig, ignoreKeys);
|
|
18
|
-
const rulesConfig =
|
|
21
|
+
const rulesConfig = mergeConfig(
|
|
19
22
|
omit(options?.imports ?? {}, ["files", "ignores"]),
|
|
20
23
|
{
|
|
21
24
|
name: "vdustr/imports/rules",
|
|
@@ -33,7 +36,7 @@ const imports = (composer, options) => {
|
|
|
33
36
|
},
|
|
34
37
|
omittedConfig
|
|
35
38
|
);
|
|
36
|
-
const noDefaultExportConfig =
|
|
39
|
+
const noDefaultExportConfig = mergeConfig(
|
|
37
40
|
options?.noDefaultExport,
|
|
38
41
|
{
|
|
39
42
|
name: "vdustr/imports/no-default-export/rules",
|
|
@@ -46,19 +49,13 @@ const imports = (composer, options) => {
|
|
|
46
49
|
*/
|
|
47
50
|
"import/no-default-export": "error"
|
|
48
51
|
},
|
|
49
|
-
files: [
|
|
50
|
-
GLOB_JS,
|
|
51
|
-
GLOB_JSX,
|
|
52
|
-
GLOB_TS,
|
|
53
|
-
GLOB_TSX,
|
|
54
|
-
...options?.noDefaultExport?.files || []
|
|
55
|
-
],
|
|
52
|
+
files: [GLOB_JS, GLOB_JSX, GLOB_TS, GLOB_TSX],
|
|
56
53
|
ignores: [
|
|
57
54
|
// Configuration files
|
|
58
55
|
GLOB_CONFIG_JS,
|
|
59
56
|
GLOB_MARKDOWN_CODE,
|
|
60
57
|
GLOB_ASTRO_TS,
|
|
61
|
-
|
|
58
|
+
GLOB_VITEST_WORKSPACE
|
|
62
59
|
]
|
|
63
60
|
},
|
|
64
61
|
omit(omittedConfig, ["files", "ignores"])
|
|
@@ -1,12 +1,15 @@
|
|
|
1
|
-
import defu from "defu";
|
|
2
1
|
import { omit, pick } from "es-toolkit";
|
|
3
2
|
import { extendsConfig } from "../utils/extendsConfig.mjs";
|
|
3
|
+
import { mergeConfig } from "../utils/mergeConfig.mjs";
|
|
4
4
|
import { ignoreKeys } from "./_utils.mjs";
|
|
5
5
|
const javascript = (composer, options) => {
|
|
6
6
|
extendsConfig(composer, "antfu/javascript/rules", (config) => {
|
|
7
|
-
const modifiedConfig =
|
|
7
|
+
const modifiedConfig = mergeConfig(
|
|
8
|
+
pick(options?.javascript ?? {}, ["files", "ignores"]),
|
|
9
|
+
config
|
|
10
|
+
);
|
|
8
11
|
const omittedConfig = omit(modifiedConfig, ignoreKeys);
|
|
9
|
-
const rulesConfig =
|
|
12
|
+
const rulesConfig = mergeConfig(
|
|
10
13
|
omit(options?.javascript ?? {}, ["files", "ignores"]),
|
|
11
14
|
{
|
|
12
15
|
name: "vdustr/javascript/rules",
|
|
@@ -2,8 +2,6 @@ import type { ConfigOverrides, VpComposer } from "../types";
|
|
|
2
2
|
declare namespace jsonc {
|
|
3
3
|
interface Options {
|
|
4
4
|
jsonc?: ConfigOverrides;
|
|
5
|
-
sortArrayValues?: ConfigOverrides;
|
|
6
|
-
packageJson?: ConfigOverrides;
|
|
7
5
|
}
|
|
8
6
|
}
|
|
9
7
|
declare const jsonc: (composer: VpComposer, options?: jsonc.Options) => Promise<void>;
|
|
@@ -1,84 +1,31 @@
|
|
|
1
|
-
import { ensurePackages, interopDefault } from "@antfu/eslint-config";
|
|
2
|
-
import defu from "defu";
|
|
3
1
|
import { omit, pick } from "es-toolkit";
|
|
4
|
-
import {
|
|
5
|
-
GLOB_CODE_WORKSPACE,
|
|
6
|
-
GLOB_CSPELL_JSON,
|
|
7
|
-
GLOB_PACKAGE_JSON
|
|
8
|
-
} from "../globs.mjs";
|
|
2
|
+
import { GLOB_CODE_WORKSPACE } from "../globs.mjs";
|
|
9
3
|
import { extendsConfig } from "../utils/extendsConfig.mjs";
|
|
4
|
+
import { mergeConfig } from "../utils/mergeConfig.mjs";
|
|
10
5
|
import { ignoreKeys } from "./_utils.mjs";
|
|
11
6
|
const jsonc = async (composer, options) => {
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
const rulesConfig = defu(
|
|
26
|
-
omit(options?.jsonc ?? {}, ["files", "ignores"]),
|
|
27
|
-
{
|
|
28
|
-
name: "vdustr/jsonc/rules",
|
|
29
|
-
rules: {
|
|
30
|
-
/**
|
|
31
|
-
* Default.
|
|
32
|
-
*/
|
|
33
|
-
"jsonc/sort-keys": [
|
|
34
|
-
"error",
|
|
35
|
-
{
|
|
36
|
-
pathPattern: ".*",
|
|
37
|
-
order: {
|
|
38
|
-
type: "asc",
|
|
39
|
-
caseSensitive: false,
|
|
40
|
-
natural: true
|
|
41
|
-
}
|
|
42
|
-
}
|
|
43
|
-
]
|
|
44
|
-
}
|
|
45
|
-
},
|
|
46
|
-
omittedConfig
|
|
47
|
-
);
|
|
48
|
-
const sortArrayValuesConfig = defu(options?.sortArrayValues, {
|
|
49
|
-
name: "vdustr/jsonc/sort-array-values/rules",
|
|
50
|
-
files: [GLOB_CSPELL_JSON],
|
|
7
|
+
extendsConfig(composer, "antfu/jsonc/rules", (config) => {
|
|
8
|
+
const modifiedConfig = mergeConfig(
|
|
9
|
+
pick(options?.jsonc ?? {}, ["files", "ignores"]),
|
|
10
|
+
config,
|
|
11
|
+
{
|
|
12
|
+
files: [GLOB_CODE_WORKSPACE]
|
|
13
|
+
}
|
|
14
|
+
);
|
|
15
|
+
const omittedConfig = omit(modifiedConfig, ignoreKeys);
|
|
16
|
+
const rulesConfig = mergeConfig(
|
|
17
|
+
omit(options?.jsonc ?? {}, ["files", "ignores"]),
|
|
18
|
+
{
|
|
19
|
+
name: "vdustr/jsonc/rules",
|
|
51
20
|
rules: {
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
pathPattern: ".*",
|
|
56
|
-
order: {
|
|
57
|
-
type: "asc",
|
|
58
|
-
caseSensitive: false,
|
|
59
|
-
natural: true
|
|
60
|
-
}
|
|
61
|
-
}
|
|
62
|
-
]
|
|
21
|
+
/**
|
|
22
|
+
* No overrides for now.
|
|
23
|
+
*/
|
|
63
24
|
}
|
|
64
|
-
}
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
const packageJsonRulesConfig = defu(options?.packageJson, {
|
|
70
|
-
...omit(packageJson, ["name", "plugins"]),
|
|
71
|
-
name: "vdustr/package-json/rules"
|
|
72
|
-
});
|
|
73
|
-
return [
|
|
74
|
-
modifiedConfig,
|
|
75
|
-
rulesConfig,
|
|
76
|
-
sortArrayValuesConfig,
|
|
77
|
-
packageJsonSetupConfig,
|
|
78
|
-
packageJsonRulesConfig
|
|
79
|
-
];
|
|
80
|
-
},
|
|
81
|
-
["antfu/sort/package-json", "antfu/sort/tsconfig-json"]
|
|
82
|
-
);
|
|
25
|
+
},
|
|
26
|
+
omittedConfig
|
|
27
|
+
);
|
|
28
|
+
return [modifiedConfig, rulesConfig];
|
|
29
|
+
});
|
|
83
30
|
};
|
|
84
31
|
export { jsonc };
|
|
@@ -1,13 +1,16 @@
|
|
|
1
|
-
import defu from "defu";
|
|
2
1
|
import { omit, pick } from "es-toolkit";
|
|
3
2
|
import { reactCompiler } from "../configs/reactCompiler.mjs";
|
|
4
3
|
import { extendsConfig } from "../utils/extendsConfig.mjs";
|
|
4
|
+
import { mergeConfig } from "../utils/mergeConfig.mjs";
|
|
5
5
|
import { ignoreKeys } from "./_utils.mjs";
|
|
6
6
|
const react = (composer, options) => {
|
|
7
7
|
extendsConfig(composer, "antfu/react/rules", async (config) => {
|
|
8
|
-
const modifiedConfig =
|
|
8
|
+
const modifiedConfig = mergeConfig(
|
|
9
|
+
pick(options?.react ?? {}, ["files", "ignores"]),
|
|
10
|
+
config
|
|
11
|
+
);
|
|
9
12
|
const omittedConfig = omit(modifiedConfig, ignoreKeys);
|
|
10
|
-
const rulesConfig =
|
|
13
|
+
const rulesConfig = mergeConfig(
|
|
11
14
|
omit(options?.react ?? {}, ["files", "ignores"]),
|
|
12
15
|
{
|
|
13
16
|
name: "vdustr/react/rules",
|
|
@@ -19,7 +22,7 @@ const react = (composer, options) => {
|
|
|
19
22
|
);
|
|
20
23
|
const reactCompilerConfigs = await reactCompiler({
|
|
21
24
|
setup: options?.reactCompilerSetup ?? {},
|
|
22
|
-
reactCompiler:
|
|
25
|
+
reactCompiler: mergeConfig(
|
|
23
26
|
options?.reactCompiler,
|
|
24
27
|
pick(omittedConfig, ["files", "ignores"])
|
|
25
28
|
)
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import type { ConfigOverrides, VpComposer } from "../types";
|
|
2
|
+
declare namespace sortJsonKeys {
|
|
3
|
+
interface Options {
|
|
4
|
+
sortKeys?: ConfigOverrides;
|
|
5
|
+
}
|
|
6
|
+
}
|
|
7
|
+
declare const sortJsonKeys: (composer: VpComposer, options?: sortJsonKeys.Options) => Promise<void>;
|
|
8
|
+
declare namespace sortPackageJson {
|
|
9
|
+
interface Options {
|
|
10
|
+
packageJson?: ConfigOverrides;
|
|
11
|
+
}
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* Disable rules conflicting with `eslint-config-package-json`.
|
|
15
|
+
*/
|
|
16
|
+
declare const sortPackageJson: (composer: VpComposer, options?: sortPackageJson.Options) => Promise<void>;
|
|
17
|
+
declare namespace sortTsconfigJson {
|
|
18
|
+
interface Options {
|
|
19
|
+
tsconfigJson?: ConfigOverrides;
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
declare const sortTsconfigJson: (composer: VpComposer, options?: sortTsconfigJson.Options) => Promise<void>;
|
|
23
|
+
declare namespace sortJsonArrayValues {
|
|
24
|
+
interface Options {
|
|
25
|
+
sortJsonArrayValues?: ConfigOverrides;
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
declare const sortJsonArrayValues: (composer: VpComposer, options?: sortJsonArrayValues.Options) => Promise<void>;
|
|
29
|
+
export { sortJsonArrayValues, sortJsonKeys, sortPackageJson, sortTsconfigJson };
|