@vp-tw/eslint-config 0.0.13 → 0.0.15
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/esm/extends/jsonc.d.ts +1 -1
- package/dist/esm/extends/jsonc.mjs +20 -4
- package/dist/esm/extends/typescript.mjs +6 -0
- package/dist/esm/extends/yaml.mjs +11 -1
- package/dist/extends/jsonc.d.ts +1 -1
- package/dist/extends/jsonc.js +19 -9
- package/dist/extends/typescript.js +6 -0
- package/dist/extends/yaml.js +8 -1
- package/package.json +21 -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.
|
|
@@ -19,7 +19,7 @@ declare namespace jsonc {
|
|
|
19
19
|
sortArrayValues: ConfigOverrides;
|
|
20
20
|
}
|
|
21
21
|
}
|
|
22
|
-
declare const jsonc: ((composer: FlatConfigComposer<TypedFlatConfigItem, ConfigNames>, options?: jsonc.Options) => void) & {
|
|
22
|
+
declare const jsonc: ((composer: FlatConfigComposer<TypedFlatConfigItem, ConfigNames>, options?: jsonc.Options) => Promise<void>) & {
|
|
23
23
|
configNamesMapSource: {
|
|
24
24
|
readonly rules: "vdustr/jsonc/rules";
|
|
25
25
|
readonly sortArrayValues: "vdustr/jsonc/sortArrayValues";
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
+
import { ensurePackages, interopDefault } from "@antfu/eslint-config";
|
|
1
2
|
import { omit } from "es-toolkit";
|
|
2
|
-
import packageJson from "eslint-plugin-package-json/configs/recommended";
|
|
3
3
|
import {
|
|
4
4
|
GLOB_CODE_WORKSPACE,
|
|
5
5
|
GLOB_CSPELL_JSON,
|
|
@@ -13,7 +13,11 @@ const configNamesMapSource = {
|
|
|
13
13
|
packageJsonSetup: "vdustr/package-json/setup",
|
|
14
14
|
packageJsonRules: "vdustr/package-json/rules"
|
|
15
15
|
};
|
|
16
|
-
const jsoncInternal = (composer, options) => {
|
|
16
|
+
const jsoncInternal = async (composer, options) => {
|
|
17
|
+
await ensurePackages(["eslint-plugin-package-json"]);
|
|
18
|
+
const packageJson = await interopDefault(
|
|
19
|
+
import("eslint-plugin-package-json/configs/recommended")
|
|
20
|
+
);
|
|
17
21
|
extendsConfig(
|
|
18
22
|
composer,
|
|
19
23
|
"antfu/jsonc/rules",
|
|
@@ -70,7 +74,17 @@ const jsoncInternal = (composer, options) => {
|
|
|
70
74
|
/**
|
|
71
75
|
* Default.
|
|
72
76
|
*/
|
|
73
|
-
"jsonc/sort-keys":
|
|
77
|
+
"jsonc/sort-keys": [
|
|
78
|
+
"error",
|
|
79
|
+
{
|
|
80
|
+
pathPattern: ".*",
|
|
81
|
+
order: {
|
|
82
|
+
type: "asc",
|
|
83
|
+
caseSensitive: false,
|
|
84
|
+
natural: true
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
],
|
|
74
88
|
/**
|
|
75
89
|
* Overridable.
|
|
76
90
|
*/
|
|
@@ -131,7 +145,9 @@ const jsoncInternal = (composer, options) => {
|
|
|
131
145
|
{
|
|
132
146
|
pathPattern: ".*",
|
|
133
147
|
order: {
|
|
134
|
-
type: "asc"
|
|
148
|
+
type: "asc",
|
|
149
|
+
caseSensitive: false,
|
|
150
|
+
natural: true
|
|
135
151
|
}
|
|
136
152
|
}
|
|
137
153
|
],
|
|
@@ -24,6 +24,12 @@ const typescriptInternal = (composer, options) => {
|
|
|
24
24
|
/**
|
|
25
25
|
* Default.
|
|
26
26
|
*/
|
|
27
|
+
/**
|
|
28
|
+
* Use `Array<T>` instead of `T[]` for better DX.
|
|
29
|
+
*
|
|
30
|
+
* - [Array<T> vs T[]: Which is better?](https://www.totaltypescript.com/array-types-in-typescript)
|
|
31
|
+
* - [Array Types in TypeScript](https://tkdodo.eu/blog/array-types-in-type-script)
|
|
32
|
+
*/
|
|
27
33
|
"ts/array-type": ["error", { default: "generic" }],
|
|
28
34
|
/**
|
|
29
35
|
* Namespaces are useful for centralizing the management of types. Just avoid
|
|
@@ -59,7 +59,17 @@ const yamlInternal = (composer, options) => {
|
|
|
59
59
|
...options?.sortKeys,
|
|
60
60
|
files: [GLOB_PNPM_WORKSPACE_YAML, ...options?.sortKeys?.files ?? []],
|
|
61
61
|
rules: {
|
|
62
|
-
"yaml/sort-keys": [
|
|
62
|
+
"yaml/sort-keys": [
|
|
63
|
+
"error",
|
|
64
|
+
{
|
|
65
|
+
pathPattern: ".*",
|
|
66
|
+
order: {
|
|
67
|
+
type: "asc",
|
|
68
|
+
caseSensitive: false,
|
|
69
|
+
natural: true
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
],
|
|
63
73
|
...options?.sortKeys?.rules
|
|
64
74
|
}
|
|
65
75
|
}
|
package/dist/extends/jsonc.d.ts
CHANGED
|
@@ -19,7 +19,7 @@ declare namespace jsonc {
|
|
|
19
19
|
sortArrayValues: ConfigOverrides;
|
|
20
20
|
}
|
|
21
21
|
}
|
|
22
|
-
declare const jsonc: ((composer: FlatConfigComposer<TypedFlatConfigItem, ConfigNames>, options?: jsonc.Options) => void) & {
|
|
22
|
+
declare const jsonc: ((composer: FlatConfigComposer<TypedFlatConfigItem, ConfigNames>, options?: jsonc.Options) => Promise<void>) & {
|
|
23
23
|
configNamesMapSource: {
|
|
24
24
|
readonly rules: "vdustr/jsonc/rules";
|
|
25
25
|
readonly sortArrayValues: "vdustr/jsonc/sortArrayValues";
|
package/dist/extends/jsonc.js
CHANGED
|
@@ -4,19 +4,20 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.jsonc = void 0;
|
|
7
|
+
var _eslintConfig = require("@antfu/eslint-config");
|
|
7
8
|
var _esToolkit = require("es-toolkit");
|
|
8
|
-
var _recommended = _interopRequireDefault(require("eslint-plugin-package-json/configs/recommended"));
|
|
9
9
|
var _globs = require("../globs");
|
|
10
10
|
var _extendsConfig = require("../utils/extendsConfig");
|
|
11
11
|
var _utils = require("./_utils");
|
|
12
|
-
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
13
12
|
const configNamesMapSource = {
|
|
14
13
|
rules: "vdustr/jsonc/rules",
|
|
15
14
|
sortArrayValues: "vdustr/jsonc/sortArrayValues",
|
|
16
15
|
packageJsonSetup: "vdustr/package-json/setup",
|
|
17
16
|
packageJsonRules: "vdustr/package-json/rules"
|
|
18
17
|
};
|
|
19
|
-
const jsoncInternal = (composer, options) => {
|
|
18
|
+
const jsoncInternal = async (composer, options) => {
|
|
19
|
+
await (0, _eslintConfig.ensurePackages)(["eslint-plugin-package-json"]);
|
|
20
|
+
const packageJson = await (0, _eslintConfig.interopDefault)(Promise.resolve().then(() => require("eslint-plugin-package-json/configs/recommended")));
|
|
20
21
|
(0, _extendsConfig.extendsConfig)(composer, "antfu/jsonc/rules", config => {
|
|
21
22
|
config = {
|
|
22
23
|
...config,
|
|
@@ -66,20 +67,27 @@ const jsoncInternal = (composer, options) => {
|
|
|
66
67
|
/**
|
|
67
68
|
* Default.
|
|
68
69
|
*/
|
|
69
|
-
"jsonc/sort-keys": "error",
|
|
70
|
+
"jsonc/sort-keys": ["error", {
|
|
71
|
+
pathPattern: ".*",
|
|
72
|
+
order: {
|
|
73
|
+
type: "asc",
|
|
74
|
+
caseSensitive: false,
|
|
75
|
+
natural: true
|
|
76
|
+
}
|
|
77
|
+
}],
|
|
70
78
|
/**
|
|
71
79
|
* Overridable.
|
|
72
80
|
*/
|
|
73
81
|
...options?.jsonc?.rules
|
|
74
82
|
}
|
|
75
83
|
}, {
|
|
76
|
-
plugins:
|
|
84
|
+
plugins: packageJson.plugins,
|
|
77
85
|
name: configNamesMapSource.packageJsonSetup
|
|
78
86
|
}, {
|
|
79
87
|
/**
|
|
80
88
|
* Inherited.
|
|
81
89
|
*/
|
|
82
|
-
...(0, _esToolkit.omit)(
|
|
90
|
+
...(0, _esToolkit.omit)(packageJson, ["plugins"]),
|
|
83
91
|
/**
|
|
84
92
|
* Default.
|
|
85
93
|
*/
|
|
@@ -92,7 +100,7 @@ const jsoncInternal = (composer, options) => {
|
|
|
92
100
|
/**
|
|
93
101
|
* Inherited.
|
|
94
102
|
*/
|
|
95
|
-
...
|
|
103
|
+
...packageJson.plugins,
|
|
96
104
|
/**
|
|
97
105
|
* Overridable.
|
|
98
106
|
*/
|
|
@@ -102,7 +110,7 @@ const jsoncInternal = (composer, options) => {
|
|
|
102
110
|
/**
|
|
103
111
|
* Inherited.
|
|
104
112
|
*/
|
|
105
|
-
...
|
|
113
|
+
...packageJson.rules,
|
|
106
114
|
/**
|
|
107
115
|
* Overridable.
|
|
108
116
|
*/
|
|
@@ -122,7 +130,9 @@ const jsoncInternal = (composer, options) => {
|
|
|
122
130
|
"jsonc/sort-array-values": ["error", {
|
|
123
131
|
pathPattern: ".*",
|
|
124
132
|
order: {
|
|
125
|
-
type: "asc"
|
|
133
|
+
type: "asc",
|
|
134
|
+
caseSensitive: false,
|
|
135
|
+
natural: true
|
|
126
136
|
}
|
|
127
137
|
}],
|
|
128
138
|
...options?.sortArrayValues?.rules
|
|
@@ -28,6 +28,12 @@ const typescriptInternal = (composer, options) => {
|
|
|
28
28
|
/**
|
|
29
29
|
* Default.
|
|
30
30
|
*/
|
|
31
|
+
/**
|
|
32
|
+
* Use `Array<T>` instead of `T[]` for better DX.
|
|
33
|
+
*
|
|
34
|
+
* - [Array<T> vs T[]: Which is better?](https://www.totaltypescript.com/array-types-in-typescript)
|
|
35
|
+
* - [Array Types in TypeScript](https://tkdodo.eu/blog/array-types-in-type-script)
|
|
36
|
+
*/
|
|
31
37
|
"ts/array-type": ["error", {
|
|
32
38
|
default: "generic"
|
|
33
39
|
}],
|
package/dist/extends/yaml.js
CHANGED
|
@@ -56,7 +56,14 @@ const yamlInternal = (composer, options) => {
|
|
|
56
56
|
...options?.sortKeys,
|
|
57
57
|
files: [_globs.GLOB_PNPM_WORKSPACE_YAML, ...(options?.sortKeys?.files ?? [])],
|
|
58
58
|
rules: {
|
|
59
|
-
"yaml/sort-keys": ["error",
|
|
59
|
+
"yaml/sort-keys": ["error", {
|
|
60
|
+
pathPattern: ".*",
|
|
61
|
+
order: {
|
|
62
|
+
type: "asc",
|
|
63
|
+
caseSensitive: false,
|
|
64
|
+
natural: true
|
|
65
|
+
}
|
|
66
|
+
}],
|
|
60
67
|
...options?.sortKeys?.rules
|
|
61
68
|
}
|
|
62
69
|
}]);
|
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.15",
|
|
4
4
|
"description": "ViPro's ESLint configuration",
|
|
5
5
|
"homepage": "https://github.com/vdustr/eslint-config",
|
|
6
6
|
"author": {
|
|
@@ -44,16 +44,33 @@
|
|
|
44
44
|
"es-toolkit": "^1.31.0",
|
|
45
45
|
"eslint-config-prettier": "^10.0.1",
|
|
46
46
|
"eslint-flat-config-utils": "^2.0.0",
|
|
47
|
-
"eslint-plugin-package-json": "^0.21.1",
|
|
48
47
|
"local-pkg": "^1.0.0"
|
|
49
48
|
},
|
|
50
49
|
"devDependencies": {
|
|
51
|
-
"@antfu/eslint-config": "^4.1.0",
|
|
52
50
|
"eslint-typegen": "^1.0.0",
|
|
53
51
|
"unbuild": "^3.3.1"
|
|
54
52
|
},
|
|
55
53
|
"peerDependencies": {
|
|
56
|
-
"@antfu/eslint-config": "^4.1.0"
|
|
54
|
+
"@antfu/eslint-config": "^4.1.0",
|
|
55
|
+
"eslint": "^9.19.0",
|
|
56
|
+
"eslint-plugin-mdx": "^3.1.5",
|
|
57
|
+
"eslint-plugin-package-json": "^0.21.1",
|
|
58
|
+
"eslint-plugin-react-compiler": "^19.0.0-beta-27714ef-20250124",
|
|
59
|
+
"eslint-plugin-storybook": "^0.11.2"
|
|
60
|
+
},
|
|
61
|
+
"peerDependenciesMeta": {
|
|
62
|
+
"eslint-mdx": {
|
|
63
|
+
"optional": true
|
|
64
|
+
},
|
|
65
|
+
"eslint-plugin-package-json": {
|
|
66
|
+
"optional": true
|
|
67
|
+
},
|
|
68
|
+
"eslint-plugin-react-compiler": {
|
|
69
|
+
"optional": true
|
|
70
|
+
},
|
|
71
|
+
"eslint-plugin-storybook": {
|
|
72
|
+
"optional": true
|
|
73
|
+
}
|
|
57
74
|
},
|
|
58
75
|
"publishConfig": {
|
|
59
76
|
"access": "public"
|