@vp-tw/eslint-config 0.0.24 → 0.0.26
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 +40 -0
- package/dist/eslint-typegen.d.ts +1 -1
- package/dist/esm/eslint-typegen.d.ts +1 -1
- package/dist/esm/extends/jsonc.mjs +2 -2
- package/dist/esm/extends/sort.d.ts +9 -20
- package/dist/esm/extends/sort.mjs +11 -14
- package/dist/esm/utils/extendsConfig.mjs +3 -1
- package/dist/esm/utils/mergeConfig.mjs +1 -1
- package/dist/esm/vdustr.d.ts +2 -5
- package/dist/esm/vdustr.mjs +4 -4
- package/dist/extends/jsonc.js +3 -2
- package/dist/extends/sort.d.ts +9 -20
- package/dist/extends/sort.js +6 -6
- package/dist/utils/extendsConfig.js +3 -1
- package/dist/utils/mergeConfig.js +1 -1
- package/dist/vdustr.d.ts +2 -5
- package/dist/vdustr.js +4 -4
- package/package.json +11 -11
package/README.md
CHANGED
|
@@ -56,6 +56,46 @@ pnpm -w v:major
|
|
|
56
56
|
pnpm -r publish
|
|
57
57
|
```
|
|
58
58
|
|
|
59
|
+
## Known Issues
|
|
60
|
+
|
|
61
|
+
### `eslint-plugin-unicorn@^57.0.0`
|
|
62
|
+
|
|
63
|
+
Getting the following error when call `typegen`:
|
|
64
|
+
|
|
65
|
+
<!-- cSpell:disable -->
|
|
66
|
+
|
|
67
|
+
```
|
|
68
|
+
/eslint-config/node_modules/.pnpm/eslint-plugin-unicorn@57.0.0_eslint@9.21.0_jiti@2.4.2_/node_modules/eslint-plugin-unicorn/rules…
|
|
69
|
+
│ atisIdentifierName,
|
|
70
|
+
│ at^
|
|
71
|
+
│ TypeError: Cannot destructure property 'isIdentifierName' of 'import_helper_validator_identifier.default' as it is undefined.
|
|
72
|
+
│ at resolveVariableName (/eslint-config/node_modules/.pnpm/eslint-plugin-unicorn@57.0.0_eslint@9.21.0_jiti@2.4.2_/node_modules…
|
|
73
|
+
│ at Object.<anonymous> (/eslint-config/node_modules/.pnpm/eslint-plugin-unicorn@57.0.0_eslint@9.21.0_jiti@2.4.2_/node_modules/…
|
|
74
|
+
│ at Module._compile (node:internal/modules/cjs/loader:1739:14)
|
|
75
|
+
│ at Object.transformer (/eslint-config/node_modules/.pnpm/tsx@4.19.3/node_modules/tsx/dist/register-DCnOAxY2.cjs:2:1186)
|
|
76
|
+
│ at Module.load (node:internal/modules/cjs/loader:1473:32)
|
|
77
|
+
│ at Function._load (node:internal/modules/cjs/loader:1285:12)
|
|
78
|
+
│ at TracingChannel.traceSync (node:diagnostics_channel:322:14)
|
|
79
|
+
│ at wrapModuleLoad (node:internal/modules/cjs/loader:234:24)
|
|
80
|
+
│ at Module.require (node:internal/modules/cjs/loader:1495:12)
|
|
81
|
+
│ at require (node:internal/modules/helpers:135:16)
|
|
82
|
+
```
|
|
83
|
+
|
|
84
|
+
<!-- cSpell:enable -->
|
|
85
|
+
|
|
86
|
+
Workaround: downgrade `eslint-plugin-unicorn` to `^56.0.1`.
|
|
87
|
+
|
|
88
|
+
```jsonc
|
|
89
|
+
// package.json
|
|
90
|
+
{
|
|
91
|
+
"pnpm": {
|
|
92
|
+
"overrides": {
|
|
93
|
+
"eslint-plugin-unicorn": "^56.0.1",
|
|
94
|
+
},
|
|
95
|
+
},
|
|
96
|
+
}
|
|
97
|
+
```
|
|
98
|
+
|
|
59
99
|
## License
|
|
60
100
|
|
|
61
101
|
MIT © ViPro <vdustr@gmail.com> (<http://vdustr.dev>)
|
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' | 'vdustr/
|
|
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/imports/rules' | 'vdustr/imports/no-default-export/rules' | 'vdustr/javascript/rules' | 'vdustr/jsonc/rules' | 'vdustr/sort/json-keys' | 'vdustr/sort/json-array-values' | 'vdustr/react/rules' | 'vdustr/react/react-compiler/setup' | 'vdustr/react/react-compiler/rules' | 'vdustr/typescript/rules' | 'vdustr/yaml/rules' | 'vdustr/yaml/sort-keys/rules'
|
|
103
103
|
|
|
@@ -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' | 'vdustr/
|
|
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/imports/rules' | 'vdustr/imports/no-default-export/rules' | 'vdustr/javascript/rules' | 'vdustr/jsonc/rules' | 'vdustr/sort/json-keys' | 'vdustr/sort/json-array-values' | 'vdustr/react/rules' | 'vdustr/react/react-compiler/setup' | 'vdustr/react/react-compiler/rules' | 'vdustr/typescript/rules' | 'vdustr/yaml/rules' | 'vdustr/yaml/sort-keys/rules'
|
|
103
103
|
|
|
@@ -7,9 +7,9 @@ const jsonc = async (composer, options) => {
|
|
|
7
7
|
extendsConfig(composer, "antfu/jsonc/rules", (config) => {
|
|
8
8
|
const modifiedConfig = mergeConfig(
|
|
9
9
|
pick(options?.jsonc ?? {}, ["files", "ignores"]),
|
|
10
|
-
config,
|
|
11
10
|
{
|
|
12
|
-
|
|
11
|
+
...config,
|
|
12
|
+
files: [...config.files ?? [], GLOB_CODE_WORKSPACE]
|
|
13
13
|
}
|
|
14
14
|
);
|
|
15
15
|
const omittedConfig = omit(modifiedConfig, ignoreKeys);
|
|
@@ -1,29 +1,18 @@
|
|
|
1
1
|
import type { ConfigOverrides, VpComposer } from "../types";
|
|
2
|
-
declare namespace
|
|
3
|
-
interface Options {
|
|
4
|
-
sortKeys?: ConfigOverrides;
|
|
5
|
-
}
|
|
6
|
-
}
|
|
7
|
-
declare const sortJsonKeys: (composer: VpComposer, options?: sortJsonKeys.Options) => Promise<void>;
|
|
8
|
-
declare namespace sortPackageJson {
|
|
2
|
+
declare namespace sort {
|
|
9
3
|
interface Options {
|
|
4
|
+
jsoncSortKeys?: ConfigOverrides;
|
|
5
|
+
jsoncSortArrayValues?: ConfigOverrides;
|
|
10
6
|
packageJson?: ConfigOverrides;
|
|
7
|
+
tsconfigJson?: ConfigOverrides;
|
|
11
8
|
}
|
|
12
9
|
}
|
|
10
|
+
declare const sortJsonKeys: (composer: VpComposer, options?: sort.Options["jsoncSortKeys"]) => Promise<void>;
|
|
13
11
|
/**
|
|
14
12
|
* Disable rules conflicting with `eslint-config-package-json`.
|
|
15
13
|
*/
|
|
16
|
-
declare const sortPackageJson: (composer: VpComposer, options?:
|
|
17
|
-
declare
|
|
18
|
-
|
|
19
|
-
|
|
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>;
|
|
14
|
+
declare const sortPackageJson: (composer: VpComposer, options?: sort.Options["packageJson"]) => Promise<void>;
|
|
15
|
+
declare const sortTsconfigJson: (composer: VpComposer, options?: sort.Options["tsconfigJson"]) => Promise<void>;
|
|
16
|
+
declare const sortJsonArrayValues: (composer: VpComposer, options?: sort.Options["jsoncSortArrayValues"]) => Promise<void>;
|
|
17
|
+
export type { sort };
|
|
29
18
|
export { sortJsonArrayValues, sortJsonKeys, sortPackageJson, sortTsconfigJson };
|
|
@@ -29,7 +29,7 @@ const sortJsonKeys = async (composer, options) => {
|
|
|
29
29
|
extendsConfig(composer, "vdustr/jsonc/rules", async (config) => {
|
|
30
30
|
const omittedConfig = omit(config, ignoreKeys);
|
|
31
31
|
const rulesConfig = mergeConfig(
|
|
32
|
-
options
|
|
32
|
+
options,
|
|
33
33
|
{
|
|
34
34
|
name: "vdustr/sort/json-keys",
|
|
35
35
|
rules: {
|
|
@@ -44,12 +44,12 @@ const sortJsonKeys = async (composer, options) => {
|
|
|
44
44
|
const sortPackageJson = async (composer, options) => {
|
|
45
45
|
extendsConfig(composer, "antfu/sort/package-json", (config) => {
|
|
46
46
|
const modifiedConfig = mergeConfig(
|
|
47
|
-
pick(options
|
|
47
|
+
pick(options ?? {}, ["files", "ignores"]),
|
|
48
48
|
config
|
|
49
49
|
);
|
|
50
50
|
const omittedConfig = omit(modifiedConfig, ignoreKeys);
|
|
51
51
|
const rulesConfig = mergeConfig(
|
|
52
|
-
options
|
|
52
|
+
options,
|
|
53
53
|
{
|
|
54
54
|
name: "vdustr/sort/package-json",
|
|
55
55
|
rules: {
|
|
@@ -65,12 +65,12 @@ const sortPackageJson = async (composer, options) => {
|
|
|
65
65
|
const sortTsconfigJson = async (composer, options) => {
|
|
66
66
|
extendsConfig(composer, "antfu/sort/tsconfig-json", (config) => {
|
|
67
67
|
const modifiedConfig = mergeConfig(
|
|
68
|
-
pick(options
|
|
68
|
+
pick(options ?? {}, ["files", "ignores"]),
|
|
69
69
|
config
|
|
70
70
|
);
|
|
71
71
|
const omittedConfig = omit(modifiedConfig, ignoreKeys);
|
|
72
72
|
const rulesConfig = mergeConfig(
|
|
73
|
-
options
|
|
73
|
+
options,
|
|
74
74
|
{
|
|
75
75
|
name: "vdustr/sort/tsconfig-json",
|
|
76
76
|
rules: {
|
|
@@ -84,16 +84,13 @@ const sortTsconfigJson = async (composer, options) => {
|
|
|
84
84
|
};
|
|
85
85
|
const sortJsonArrayValues = async (composer, options) => {
|
|
86
86
|
extendsConfig(composer, "vdustr/sort/json-keys", async (config) => {
|
|
87
|
-
const sortArrayValuesConfig = mergeConfig(
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
rules: {
|
|
93
|
-
"jsonc/sort-array-values": defaultSortJsonArrayValues
|
|
94
|
-
}
|
|
87
|
+
const sortArrayValuesConfig = mergeConfig(options, {
|
|
88
|
+
name: "vdustr/sort/json-array-values",
|
|
89
|
+
files: [GLOB_CSPELL_JSON],
|
|
90
|
+
rules: {
|
|
91
|
+
"jsonc/sort-array-values": defaultSortJsonArrayValues
|
|
95
92
|
}
|
|
96
|
-
);
|
|
93
|
+
});
|
|
97
94
|
return [config, sortArrayValuesConfig];
|
|
98
95
|
});
|
|
99
96
|
};
|
|
@@ -41,7 +41,9 @@ function extendsConfigInternal(composer, sourceOrIndex, config) {
|
|
|
41
41
|
const awaited = typeof config === "function" ? await config(source) : await config;
|
|
42
42
|
return Array.isArray(awaited) ? awaited : [awaited];
|
|
43
43
|
})();
|
|
44
|
-
|
|
44
|
+
const updatedItems = [...items];
|
|
45
|
+
updatedItems.splice(index, 1, ...newConfigs);
|
|
46
|
+
return updatedItems;
|
|
45
47
|
}
|
|
46
48
|
]);
|
|
47
49
|
}
|
|
@@ -2,7 +2,7 @@ import { omit } from "es-toolkit";
|
|
|
2
2
|
const objectMergeKeys = ["rules", "plugins"];
|
|
3
3
|
const mutableMergeKeys = ["files", "ignores"];
|
|
4
4
|
function mergeConfig(source, ...[def, ...defs]) {
|
|
5
|
-
const reversedDefs = [def, ...defs].
|
|
5
|
+
const reversedDefs = [def, ...defs].reverse();
|
|
6
6
|
const mergedDef = {
|
|
7
7
|
...Object.fromEntries(reversedDefs.flatMap((def2) => Object.entries(def2))),
|
|
8
8
|
...Object.fromEntries(
|
package/dist/esm/vdustr.d.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { sort } from "./extends/sort";
|
|
1
2
|
import type { Config, ReplaceAntfuEslintRulesWithVpRulesDeeply, VpComposer } from "./types";
|
|
2
3
|
import antfu from "@antfu/eslint-config";
|
|
3
4
|
import { mdx } from "./configs/mdx";
|
|
@@ -8,7 +9,6 @@ import { imports } from "./extends/imports";
|
|
|
8
9
|
import { javascript } from "./extends/javascript";
|
|
9
10
|
import { jsonc } from "./extends/jsonc";
|
|
10
11
|
import { react } from "./extends/react";
|
|
11
|
-
import { sortJsonArrayValues, sortJsonKeys, sortPackageJson, sortTsconfigJson } from "./extends/sort";
|
|
12
12
|
import { typescript } from "./extends/typescript";
|
|
13
13
|
import { yaml } from "./extends/yaml";
|
|
14
14
|
type Options = ReplaceAntfuEslintRulesWithVpRulesDeeply<NonNullable<Parameters<typeof antfu>[0]>> & {
|
|
@@ -17,10 +17,7 @@ type Options = ReplaceAntfuEslintRulesWithVpRulesDeeply<NonNullable<Parameters<t
|
|
|
17
17
|
imports?: imports.Options;
|
|
18
18
|
typescript?: typescript.Options;
|
|
19
19
|
jsonc?: jsonc.Options;
|
|
20
|
-
|
|
21
|
-
sortTsConfigJson?: sortTsconfigJson.Options;
|
|
22
|
-
sortJsonKeys?: sortJsonKeys.Options;
|
|
23
|
-
sortJsonArrayValues?: sortJsonArrayValues.Options;
|
|
20
|
+
sort?: sort.Options;
|
|
24
21
|
yaml?: yaml.Options;
|
|
25
22
|
react?: react.Options;
|
|
26
23
|
};
|
package/dist/esm/vdustr.mjs
CHANGED
|
@@ -45,10 +45,10 @@ const vdustr = (options, ...userConfigs) => {
|
|
|
45
45
|
typescript(config, vpOptions?.extends?.typescript);
|
|
46
46
|
jsonc(config, vpOptions?.extends?.jsonc);
|
|
47
47
|
if (packageJsonEnabled)
|
|
48
|
-
sortPackageJson(config, vpOptions?.extends?.
|
|
49
|
-
sortTsconfigJson(config, vpOptions?.extends?.
|
|
50
|
-
sortJsonKeys(config, vpOptions?.extends?.
|
|
51
|
-
sortJsonArrayValues(config, vpOptions?.extends?.
|
|
48
|
+
sortPackageJson(config, vpOptions?.extends?.sort?.packageJson);
|
|
49
|
+
sortTsconfigJson(config, vpOptions?.extends?.sort?.tsconfigJson);
|
|
50
|
+
sortJsonKeys(config, vpOptions?.extends?.sort?.jsoncSortKeys);
|
|
51
|
+
sortJsonArrayValues(config, vpOptions?.extends?.sort?.jsoncSortArrayValues);
|
|
52
52
|
yaml(config, vpOptions?.extends?.yaml);
|
|
53
53
|
react(config, vpOptions?.extends?.react);
|
|
54
54
|
if (packageJsonEnabled) {
|
package/dist/extends/jsonc.js
CHANGED
|
@@ -11,8 +11,9 @@ var _mergeConfig = require("../utils/mergeConfig");
|
|
|
11
11
|
var _utils = require("./_utils");
|
|
12
12
|
const jsonc = async (composer, options) => {
|
|
13
13
|
(0, _extendsConfig.extendsConfig)(composer, "antfu/jsonc/rules", config => {
|
|
14
|
-
const modifiedConfig = (0, _mergeConfig.mergeConfig)((0, _esToolkit.pick)(options?.jsonc ?? {}, ["files", "ignores"]),
|
|
15
|
-
|
|
14
|
+
const modifiedConfig = (0, _mergeConfig.mergeConfig)((0, _esToolkit.pick)(options?.jsonc ?? {}, ["files", "ignores"]), {
|
|
15
|
+
...config,
|
|
16
|
+
files: [...(config.files ?? []), _globs.GLOB_CODE_WORKSPACE]
|
|
16
17
|
});
|
|
17
18
|
const omittedConfig = (0, _esToolkit.omit)(modifiedConfig, _utils.ignoreKeys);
|
|
18
19
|
const rulesConfig = (0, _mergeConfig.mergeConfig)((0, _esToolkit.omit)(options?.jsonc ?? {}, ["files", "ignores"]), {
|
package/dist/extends/sort.d.ts
CHANGED
|
@@ -1,29 +1,18 @@
|
|
|
1
1
|
import type { ConfigOverrides, VpComposer } from "../types";
|
|
2
|
-
declare namespace
|
|
3
|
-
interface Options {
|
|
4
|
-
sortKeys?: ConfigOverrides;
|
|
5
|
-
}
|
|
6
|
-
}
|
|
7
|
-
declare const sortJsonKeys: (composer: VpComposer, options?: sortJsonKeys.Options) => Promise<void>;
|
|
8
|
-
declare namespace sortPackageJson {
|
|
2
|
+
declare namespace sort {
|
|
9
3
|
interface Options {
|
|
4
|
+
jsoncSortKeys?: ConfigOverrides;
|
|
5
|
+
jsoncSortArrayValues?: ConfigOverrides;
|
|
10
6
|
packageJson?: ConfigOverrides;
|
|
7
|
+
tsconfigJson?: ConfigOverrides;
|
|
11
8
|
}
|
|
12
9
|
}
|
|
10
|
+
declare const sortJsonKeys: (composer: VpComposer, options?: sort.Options["jsoncSortKeys"]) => Promise<void>;
|
|
13
11
|
/**
|
|
14
12
|
* Disable rules conflicting with `eslint-config-package-json`.
|
|
15
13
|
*/
|
|
16
|
-
declare const sortPackageJson: (composer: VpComposer, options?:
|
|
17
|
-
declare
|
|
18
|
-
|
|
19
|
-
|
|
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>;
|
|
14
|
+
declare const sortPackageJson: (composer: VpComposer, options?: sort.Options["packageJson"]) => Promise<void>;
|
|
15
|
+
declare const sortTsconfigJson: (composer: VpComposer, options?: sort.Options["tsconfigJson"]) => Promise<void>;
|
|
16
|
+
declare const sortJsonArrayValues: (composer: VpComposer, options?: sort.Options["jsoncSortArrayValues"]) => Promise<void>;
|
|
17
|
+
export type { sort };
|
|
29
18
|
export { sortJsonArrayValues, sortJsonKeys, sortPackageJson, sortTsconfigJson };
|
package/dist/extends/sort.js
CHANGED
|
@@ -28,7 +28,7 @@ const defaultSortJsonArrayValues = ["error", {
|
|
|
28
28
|
const sortJsonKeys = async (composer, options) => {
|
|
29
29
|
(0, _extendsConfig.extendsConfig)(composer, "vdustr/jsonc/rules", async config => {
|
|
30
30
|
const omittedConfig = (0, _esToolkit.omit)(config, _utils.ignoreKeys);
|
|
31
|
-
const rulesConfig = (0, _mergeConfig.mergeConfig)(options
|
|
31
|
+
const rulesConfig = (0, _mergeConfig.mergeConfig)(options, {
|
|
32
32
|
name: "vdustr/sort/json-keys",
|
|
33
33
|
rules: {
|
|
34
34
|
"jsonc/sort-keys": defaultSortJsonKeys
|
|
@@ -40,9 +40,9 @@ const sortJsonKeys = async (composer, options) => {
|
|
|
40
40
|
exports.sortJsonKeys = sortJsonKeys;
|
|
41
41
|
const sortPackageJson = async (composer, options) => {
|
|
42
42
|
(0, _extendsConfig.extendsConfig)(composer, "antfu/sort/package-json", config => {
|
|
43
|
-
const modifiedConfig = (0, _mergeConfig.mergeConfig)((0, _esToolkit.pick)(options
|
|
43
|
+
const modifiedConfig = (0, _mergeConfig.mergeConfig)((0, _esToolkit.pick)(options ?? {}, ["files", "ignores"]), config);
|
|
44
44
|
const omittedConfig = (0, _esToolkit.omit)(modifiedConfig, _utils.ignoreKeys);
|
|
45
|
-
const rulesConfig = (0, _mergeConfig.mergeConfig)(options
|
|
45
|
+
const rulesConfig = (0, _mergeConfig.mergeConfig)(options, {
|
|
46
46
|
name: "vdustr/sort/package-json",
|
|
47
47
|
rules: {
|
|
48
48
|
"jsonc/sort-array-values": "off",
|
|
@@ -55,9 +55,9 @@ const sortPackageJson = async (composer, options) => {
|
|
|
55
55
|
exports.sortPackageJson = sortPackageJson;
|
|
56
56
|
const sortTsconfigJson = async (composer, options) => {
|
|
57
57
|
(0, _extendsConfig.extendsConfig)(composer, "antfu/sort/tsconfig-json", config => {
|
|
58
|
-
const modifiedConfig = (0, _mergeConfig.mergeConfig)((0, _esToolkit.pick)(options
|
|
58
|
+
const modifiedConfig = (0, _mergeConfig.mergeConfig)((0, _esToolkit.pick)(options ?? {}, ["files", "ignores"]), config);
|
|
59
59
|
const omittedConfig = (0, _esToolkit.omit)(modifiedConfig, _utils.ignoreKeys);
|
|
60
|
-
const rulesConfig = (0, _mergeConfig.mergeConfig)(options
|
|
60
|
+
const rulesConfig = (0, _mergeConfig.mergeConfig)(options, {
|
|
61
61
|
name: "vdustr/sort/tsconfig-json",
|
|
62
62
|
rules: {
|
|
63
63
|
"jsonc/sort-keys": defaultSortJsonKeys
|
|
@@ -69,7 +69,7 @@ const sortTsconfigJson = async (composer, options) => {
|
|
|
69
69
|
exports.sortTsconfigJson = sortTsconfigJson;
|
|
70
70
|
const sortJsonArrayValues = async (composer, options) => {
|
|
71
71
|
(0, _extendsConfig.extendsConfig)(composer, "vdustr/sort/json-keys", async config => {
|
|
72
|
-
const sortArrayValuesConfig = (0, _mergeConfig.mergeConfig)(options
|
|
72
|
+
const sortArrayValuesConfig = (0, _mergeConfig.mergeConfig)(options, {
|
|
73
73
|
name: "vdustr/sort/json-array-values",
|
|
74
74
|
files: [_globs.GLOB_CSPELL_JSON],
|
|
75
75
|
rules: {
|
|
@@ -39,7 +39,9 @@ function extendsConfigInternal(composer, sourceOrIndex, config) {
|
|
|
39
39
|
const awaited = typeof config === "function" ? await config(source) : await config;
|
|
40
40
|
return Array.isArray(awaited) ? awaited : [awaited];
|
|
41
41
|
})();
|
|
42
|
-
|
|
42
|
+
const updatedItems = [...items];
|
|
43
|
+
updatedItems.splice(index, 1, ...newConfigs);
|
|
44
|
+
return updatedItems;
|
|
43
45
|
}]);
|
|
44
46
|
}
|
|
45
47
|
const extendsConfig = exports.extendsConfig = Object.assign(extendsConfigInternal, {
|
|
@@ -8,7 +8,7 @@ var _esToolkit = require("es-toolkit");
|
|
|
8
8
|
const objectMergeKeys = ["rules", "plugins"];
|
|
9
9
|
const mutableMergeKeys = ["files", "ignores"];
|
|
10
10
|
function mergeConfig(source, ...[def, ...defs]) {
|
|
11
|
-
const reversedDefs = [def, ...defs].
|
|
11
|
+
const reversedDefs = [def, ...defs].reverse();
|
|
12
12
|
const mergedDef = {
|
|
13
13
|
...Object.fromEntries(reversedDefs.flatMap(def2 => Object.entries(def2))),
|
|
14
14
|
...Object.fromEntries(objectMergeKeys.flatMap(key => {
|
package/dist/vdustr.d.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { sort } from "./extends/sort";
|
|
1
2
|
import type { Config, ReplaceAntfuEslintRulesWithVpRulesDeeply, VpComposer } from "./types";
|
|
2
3
|
import antfu from "@antfu/eslint-config";
|
|
3
4
|
import { mdx } from "./configs/mdx";
|
|
@@ -8,7 +9,6 @@ import { imports } from "./extends/imports";
|
|
|
8
9
|
import { javascript } from "./extends/javascript";
|
|
9
10
|
import { jsonc } from "./extends/jsonc";
|
|
10
11
|
import { react } from "./extends/react";
|
|
11
|
-
import { sortJsonArrayValues, sortJsonKeys, sortPackageJson, sortTsconfigJson } from "./extends/sort";
|
|
12
12
|
import { typescript } from "./extends/typescript";
|
|
13
13
|
import { yaml } from "./extends/yaml";
|
|
14
14
|
type Options = ReplaceAntfuEslintRulesWithVpRulesDeeply<NonNullable<Parameters<typeof antfu>[0]>> & {
|
|
@@ -17,10 +17,7 @@ type Options = ReplaceAntfuEslintRulesWithVpRulesDeeply<NonNullable<Parameters<t
|
|
|
17
17
|
imports?: imports.Options;
|
|
18
18
|
typescript?: typescript.Options;
|
|
19
19
|
jsonc?: jsonc.Options;
|
|
20
|
-
|
|
21
|
-
sortTsConfigJson?: sortTsconfigJson.Options;
|
|
22
|
-
sortJsonKeys?: sortJsonKeys.Options;
|
|
23
|
-
sortJsonArrayValues?: sortJsonArrayValues.Options;
|
|
20
|
+
sort?: sort.Options;
|
|
24
21
|
yaml?: yaml.Options;
|
|
25
22
|
react?: react.Options;
|
|
26
23
|
};
|
package/dist/vdustr.js
CHANGED
|
@@ -37,10 +37,10 @@ const vdustr = (options, ...userConfigs) => {
|
|
|
37
37
|
(0, _imports.imports)(config, vpOptions?.extends?.imports);
|
|
38
38
|
(0, _typescript.typescript)(config, vpOptions?.extends?.typescript);
|
|
39
39
|
(0, _jsonc.jsonc)(config, vpOptions?.extends?.jsonc);
|
|
40
|
-
if (packageJsonEnabled) (0, _sort.sortPackageJson)(config, vpOptions?.extends?.
|
|
41
|
-
(0, _sort.sortTsconfigJson)(config, vpOptions?.extends?.
|
|
42
|
-
(0, _sort.sortJsonKeys)(config, vpOptions?.extends?.
|
|
43
|
-
(0, _sort.sortJsonArrayValues)(config, vpOptions?.extends?.
|
|
40
|
+
if (packageJsonEnabled) (0, _sort.sortPackageJson)(config, vpOptions?.extends?.sort?.packageJson);
|
|
41
|
+
(0, _sort.sortTsconfigJson)(config, vpOptions?.extends?.sort?.tsconfigJson);
|
|
42
|
+
(0, _sort.sortJsonKeys)(config, vpOptions?.extends?.sort?.jsoncSortKeys);
|
|
43
|
+
(0, _sort.sortJsonArrayValues)(config, vpOptions?.extends?.sort?.jsoncSortArrayValues);
|
|
44
44
|
(0, _yaml.yaml)(config, vpOptions?.extends?.yaml);
|
|
45
45
|
(0, _react.react)(config, vpOptions?.extends?.react);
|
|
46
46
|
if (packageJsonEnabled) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vp-tw/eslint-config",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.26",
|
|
4
4
|
"description": "ViPro's ESLint configuration",
|
|
5
5
|
"homepage": "https://github.com/vdustr/eslint-config",
|
|
6
6
|
"author": {
|
|
@@ -40,23 +40,23 @@
|
|
|
40
40
|
],
|
|
41
41
|
"dependencies": {
|
|
42
42
|
"@mui/types": "^7.2.21",
|
|
43
|
-
"es-toolkit": "^1.
|
|
44
|
-
"eslint-flat-config-utils": "^2.0.
|
|
45
|
-
"local-pkg": "^1.
|
|
43
|
+
"es-toolkit": "^1.32.0",
|
|
44
|
+
"eslint-flat-config-utils": "^2.0.1",
|
|
45
|
+
"local-pkg": "^1.1.0"
|
|
46
46
|
},
|
|
47
47
|
"devDependencies": {
|
|
48
|
-
"eslint-typegen": "^
|
|
48
|
+
"eslint-typegen": "^2.0.0",
|
|
49
49
|
"unbuild": "^3.3.1"
|
|
50
50
|
},
|
|
51
51
|
"peerDependencies": {
|
|
52
|
-
"@antfu/eslint-config": "^4.
|
|
52
|
+
"@antfu/eslint-config": "^4.3.0",
|
|
53
53
|
"@types/eslint-config-prettier": "^6.11.3",
|
|
54
|
-
"eslint": "^9.
|
|
55
|
-
"eslint-config-prettier": "^10.0.
|
|
54
|
+
"eslint": "^9.21.0",
|
|
55
|
+
"eslint-config-prettier": "^10.0.2",
|
|
56
56
|
"eslint-plugin-mdx": "^3.1.5",
|
|
57
|
-
"eslint-plugin-package-json": "^0.
|
|
58
|
-
"eslint-plugin-react-compiler": "^19.0.0-beta-
|
|
59
|
-
"eslint-plugin-storybook": "^0.11.
|
|
57
|
+
"eslint-plugin-package-json": "^0.26.0",
|
|
58
|
+
"eslint-plugin-react-compiler": "^19.0.0-beta-e1e972c-20250221",
|
|
59
|
+
"eslint-plugin-storybook": "^0.11.3"
|
|
60
60
|
},
|
|
61
61
|
"peerDependenciesMeta": {
|
|
62
62
|
"@types/eslint-config-prettier": {
|