@kazupon/eslint-config 0.6.0 → 0.7.0
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 +4 -2
- package/dist/configs/index.d.cts +1 -0
- package/dist/configs/index.d.ts +1 -0
- package/dist/configs/yml.d.cts +7 -0
- package/dist/configs/yml.d.ts +7 -0
- package/dist/globs.d.cts +2 -1
- package/dist/globs.d.ts +2 -1
- package/dist/index.cjs +37 -3
- package/dist/index.js +35 -3
- package/package.json +10 -5
package/README.md
CHANGED
|
@@ -17,7 +17,8 @@ ESLint config for @kazupon
|
|
|
17
17
|
- `unicorn`
|
|
18
18
|
- `prettier`
|
|
19
19
|
- `jsonc`
|
|
20
|
-
- `vue
|
|
20
|
+
- `vue`,
|
|
21
|
+
- `yml`
|
|
21
22
|
- Support primitive eslint flat configuration
|
|
22
23
|
- Support overrides for built-in configurations
|
|
23
24
|
- `rules`
|
|
@@ -85,7 +86,7 @@ Add the following settings to your `.vscode/settings.json`:
|
|
|
85
86
|
"source.fixAll.eslint": "explicit"
|
|
86
87
|
},
|
|
87
88
|
// Enable eslint for supported languages
|
|
88
|
-
"eslint.validate": ["javascript", "typescript", "json", "jsonc", "json5", "vue"],
|
|
89
|
+
"eslint.validate": ["javascript", "typescript", "json", "jsonc", "json5", "vue", "yaml"],
|
|
89
90
|
// Enable flat configuration
|
|
90
91
|
"eslint.useFlatConfig": true
|
|
91
92
|
}
|
|
@@ -106,6 +107,7 @@ The following built-in configurations are supported:
|
|
|
106
107
|
| `prettier` | [`eslint-config-prettier`](https://www.npmjs.com/package/eslint-config-prettier) | yes |
|
|
107
108
|
| `jsonc` | [`eslint-plugin-jsonc`](https://www.npmjs.com/package/eslint-plugin-jsonc) | yes |
|
|
108
109
|
| `vue` | [`eslint-plugin-vue`](https://www.npmjs.com/package/eslint-plugin-vue) | yes |
|
|
110
|
+
| `yml` | [`eslint-plugin-yml`](https://www.npmjs.com/package/eslint-plugin-yml) | yes |
|
|
109
111
|
|
|
110
112
|
You can use `import` syntax:
|
|
111
113
|
|
package/dist/configs/index.d.cts
CHANGED
package/dist/configs/index.d.ts
CHANGED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { Linter } from 'eslint';
|
|
2
|
+
import type { OverridesOptions } from '../types';
|
|
3
|
+
export interface YmlOptions {
|
|
4
|
+
prettier?: boolean;
|
|
5
|
+
}
|
|
6
|
+
export declare function yml(options?: ((YmlOptions) & (OverridesOptions))): Promise<(Linter.FlatConfig)[]>;
|
|
7
|
+
export declare const yaml: typeof yml;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { Linter } from 'eslint';
|
|
2
|
+
import type { OverridesOptions } from '../types';
|
|
3
|
+
export interface YmlOptions {
|
|
4
|
+
prettier?: boolean;
|
|
5
|
+
}
|
|
6
|
+
export declare function yml(options?: ((YmlOptions) & (OverridesOptions))): Promise<(Linter.FlatConfig)[]>;
|
|
7
|
+
export declare const yaml: typeof yml;
|
package/dist/globs.d.cts
CHANGED
|
@@ -2,7 +2,8 @@ export declare const GLOB_JS = '**/*.?([cm])js';
|
|
|
2
2
|
export declare const GLOB_JSX = '**/*.?([cm])jsx';
|
|
3
3
|
export declare const GLOB_TS = '**/*.?([cm])ts';
|
|
4
4
|
export declare const GLOB_TSX = '**/*.?([cm])tsx';
|
|
5
|
-
export declare const GLOB_VUE = '**/*.vue';
|
|
6
5
|
export declare const GLOB_JSON = '**/*.json';
|
|
7
6
|
export declare const GLOB_JSON5 = '**/*.json5';
|
|
8
7
|
export declare const GLOB_JSONC = '**/*.jsonc';
|
|
8
|
+
export declare const GLOB_YAML = '**/*.y?(a)ml';
|
|
9
|
+
export declare const GLOB_VUE = '**/*.vue';
|
package/dist/globs.d.ts
CHANGED
|
@@ -2,7 +2,8 @@ export declare const GLOB_JS = '**/*.?([cm])js';
|
|
|
2
2
|
export declare const GLOB_JSX = '**/*.?([cm])jsx';
|
|
3
3
|
export declare const GLOB_TS = '**/*.?([cm])ts';
|
|
4
4
|
export declare const GLOB_TSX = '**/*.?([cm])tsx';
|
|
5
|
-
export declare const GLOB_VUE = '**/*.vue';
|
|
6
5
|
export declare const GLOB_JSON = '**/*.json';
|
|
7
6
|
export declare const GLOB_JSON5 = '**/*.json5';
|
|
8
7
|
export declare const GLOB_JSONC = '**/*.jsonc';
|
|
8
|
+
export declare const GLOB_YAML = '**/*.y?(a)ml';
|
|
9
|
+
export declare const GLOB_VUE = '**/*.vue';
|
package/dist/index.cjs
CHANGED
|
@@ -99,10 +99,11 @@ const GLOB_JS = '**/*.?([cm])js';
|
|
|
99
99
|
const GLOB_JSX = '**/*.?([cm])jsx';
|
|
100
100
|
const GLOB_TS = '**/*.?([cm])ts';
|
|
101
101
|
const GLOB_TSX = '**/*.?([cm])tsx';
|
|
102
|
-
const GLOB_VUE = '**/*.vue';
|
|
103
102
|
const GLOB_JSON = '**/*.json';
|
|
104
103
|
const GLOB_JSON5 = '**/*.json5';
|
|
105
104
|
const GLOB_JSONC = '**/*.jsonc';
|
|
105
|
+
const GLOB_YAML = '**/*.y?(a)ml';
|
|
106
|
+
const GLOB_VUE = '**/*.vue';
|
|
106
107
|
|
|
107
108
|
//#endregion
|
|
108
109
|
//#region src/configs/typescript.ts
|
|
@@ -111,7 +112,7 @@ async function typescript(options = {}) {
|
|
|
111
112
|
const ts = await loadPlugin('typescript-eslint');
|
|
112
113
|
const files = options.files ?? [GLOB_TS, GLOB_TSX, ...extraFileExtensions.map((ext) => `**/*${ext}`)];
|
|
113
114
|
return [...(ts.configs.recommendedTypeChecked), {
|
|
114
|
-
files: [GLOB_JS, GLOB_JSX, GLOB_JSON, GLOB_JSON5, GLOB_JSONC],
|
|
115
|
+
files: [GLOB_JS, GLOB_JSX, GLOB_JSON, GLOB_JSON5, GLOB_JSONC, GLOB_YAML],
|
|
115
116
|
...(ts.configs.disableTypeChecked)
|
|
116
117
|
}, {
|
|
117
118
|
name: '@kazupon/typescipt/typescript-eslint',
|
|
@@ -242,6 +243,37 @@ async function jsonc(options = {}) {
|
|
|
242
243
|
return configs;
|
|
243
244
|
}
|
|
244
245
|
|
|
246
|
+
//#endregion
|
|
247
|
+
//#region src/configs/yml.ts
|
|
248
|
+
async function yml(options = {}) {
|
|
249
|
+
const { rules: overrideRules = {} } = options;
|
|
250
|
+
const usePrettier = !!options.prettier;
|
|
251
|
+
const yml$1 = await loadPlugin('eslint-plugin-yml');
|
|
252
|
+
const configs = [];
|
|
253
|
+
configs.push(...yml$1.configs['flat/standard'].map((config, index) => {
|
|
254
|
+
return config.name ? config : {
|
|
255
|
+
name: `yml/flat/standard/${index}`,
|
|
256
|
+
...config
|
|
257
|
+
};
|
|
258
|
+
}));
|
|
259
|
+
if (usePrettier) {
|
|
260
|
+
configs.push(...yml$1.configs['flat/prettier'].map((config, index) => {
|
|
261
|
+
return config.name ? config : {
|
|
262
|
+
name: `yml/flat/prettier/${index}`,
|
|
263
|
+
...config
|
|
264
|
+
};
|
|
265
|
+
}));
|
|
266
|
+
}
|
|
267
|
+
const overriddenConfig = {
|
|
268
|
+
name: '@kazupon/yml',
|
|
269
|
+
files: [GLOB_YAML],
|
|
270
|
+
rules: {...overrideRules}
|
|
271
|
+
};
|
|
272
|
+
configs.push(overriddenConfig);
|
|
273
|
+
return configs;
|
|
274
|
+
}
|
|
275
|
+
const yaml = yml;
|
|
276
|
+
|
|
245
277
|
//#endregion
|
|
246
278
|
//#region src/configs/vue.ts
|
|
247
279
|
async function vue(options = {}) {
|
|
@@ -284,4 +316,6 @@ exports.prettier = prettier;
|
|
|
284
316
|
exports.regexp = regexp;
|
|
285
317
|
exports.typescript = typescript;
|
|
286
318
|
exports.unicorn = unicorn;
|
|
287
|
-
exports.vue = vue;
|
|
319
|
+
exports.vue = vue;
|
|
320
|
+
exports.yaml = yaml;
|
|
321
|
+
exports.yml = yml;
|
package/dist/index.js
CHANGED
|
@@ -74,10 +74,11 @@ const GLOB_JS = '**/*.?([cm])js';
|
|
|
74
74
|
const GLOB_JSX = '**/*.?([cm])jsx';
|
|
75
75
|
const GLOB_TS = '**/*.?([cm])ts';
|
|
76
76
|
const GLOB_TSX = '**/*.?([cm])tsx';
|
|
77
|
-
const GLOB_VUE = '**/*.vue';
|
|
78
77
|
const GLOB_JSON = '**/*.json';
|
|
79
78
|
const GLOB_JSON5 = '**/*.json5';
|
|
80
79
|
const GLOB_JSONC = '**/*.jsonc';
|
|
80
|
+
const GLOB_YAML = '**/*.y?(a)ml';
|
|
81
|
+
const GLOB_VUE = '**/*.vue';
|
|
81
82
|
|
|
82
83
|
//#endregion
|
|
83
84
|
//#region src/configs/typescript.ts
|
|
@@ -86,7 +87,7 @@ async function typescript(options = {}) {
|
|
|
86
87
|
const ts = await loadPlugin('typescript-eslint');
|
|
87
88
|
const files = options.files ?? [GLOB_TS, GLOB_TSX, ...extraFileExtensions.map((ext) => `**/*${ext}`)];
|
|
88
89
|
return [...(ts.configs.recommendedTypeChecked), {
|
|
89
|
-
files: [GLOB_JS, GLOB_JSX, GLOB_JSON, GLOB_JSON5, GLOB_JSONC],
|
|
90
|
+
files: [GLOB_JS, GLOB_JSX, GLOB_JSON, GLOB_JSON5, GLOB_JSONC, GLOB_YAML],
|
|
90
91
|
...(ts.configs.disableTypeChecked)
|
|
91
92
|
}, {
|
|
92
93
|
name: '@kazupon/typescipt/typescript-eslint',
|
|
@@ -217,6 +218,37 @@ async function jsonc(options = {}) {
|
|
|
217
218
|
return configs;
|
|
218
219
|
}
|
|
219
220
|
|
|
221
|
+
//#endregion
|
|
222
|
+
//#region src/configs/yml.ts
|
|
223
|
+
async function yml(options = {}) {
|
|
224
|
+
const { rules: overrideRules = {} } = options;
|
|
225
|
+
const usePrettier = !!options.prettier;
|
|
226
|
+
const yml$1 = await loadPlugin('eslint-plugin-yml');
|
|
227
|
+
const configs = [];
|
|
228
|
+
configs.push(...yml$1.configs['flat/standard'].map((config, index) => {
|
|
229
|
+
return config.name ? config : {
|
|
230
|
+
name: `yml/flat/standard/${index}`,
|
|
231
|
+
...config
|
|
232
|
+
};
|
|
233
|
+
}));
|
|
234
|
+
if (usePrettier) {
|
|
235
|
+
configs.push(...yml$1.configs['flat/prettier'].map((config, index) => {
|
|
236
|
+
return config.name ? config : {
|
|
237
|
+
name: `yml/flat/prettier/${index}`,
|
|
238
|
+
...config
|
|
239
|
+
};
|
|
240
|
+
}));
|
|
241
|
+
}
|
|
242
|
+
const overriddenConfig = {
|
|
243
|
+
name: '@kazupon/yml',
|
|
244
|
+
files: [GLOB_YAML],
|
|
245
|
+
rules: {...overrideRules}
|
|
246
|
+
};
|
|
247
|
+
configs.push(overriddenConfig);
|
|
248
|
+
return configs;
|
|
249
|
+
}
|
|
250
|
+
const yaml = yml;
|
|
251
|
+
|
|
220
252
|
//#endregion
|
|
221
253
|
//#region src/configs/vue.ts
|
|
222
254
|
async function vue(options = {}) {
|
|
@@ -249,4 +281,4 @@ async function vue(options = {}) {
|
|
|
249
281
|
}
|
|
250
282
|
|
|
251
283
|
//#endregion
|
|
252
|
-
export { comments, defineConfig, javascript, jsdoc, jsonc, prettier, regexp, typescript, unicorn, vue };
|
|
284
|
+
export { comments, defineConfig, javascript, jsdoc, jsonc, prettier, regexp, typescript, unicorn, vue, yaml, yml };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@kazupon/eslint-config",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.7.0",
|
|
4
4
|
"description": "ESLint config for @kazupon",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"config",
|
|
@@ -49,12 +49,10 @@
|
|
|
49
49
|
"eslint-plugin-regexp": ">=2.6.0",
|
|
50
50
|
"eslint-plugin-unicorn": ">=54.0.0",
|
|
51
51
|
"eslint-plugin-vue": ">=9.24.0",
|
|
52
|
+
"eslint-plugin-yml": ">=1.14.0",
|
|
52
53
|
"typescript-eslint": ">=7.0.0"
|
|
53
54
|
},
|
|
54
55
|
"peerDependenciesMeta": {
|
|
55
|
-
"typescript-eslint": {
|
|
56
|
-
"optional": true
|
|
57
|
-
},
|
|
58
56
|
"eslint-config-prettier": {
|
|
59
57
|
"optional": true
|
|
60
58
|
},
|
|
@@ -72,6 +70,12 @@
|
|
|
72
70
|
},
|
|
73
71
|
"eslint-plugin-vue": {
|
|
74
72
|
"optional": true
|
|
73
|
+
},
|
|
74
|
+
"eslint-plugin-yml": {
|
|
75
|
+
"optional": true
|
|
76
|
+
},
|
|
77
|
+
"typescript-eslint": {
|
|
78
|
+
"optional": true
|
|
75
79
|
}
|
|
76
80
|
},
|
|
77
81
|
"devDependencies": {
|
|
@@ -86,6 +90,7 @@
|
|
|
86
90
|
"eslint-plugin-regexp": "^2.6.0",
|
|
87
91
|
"eslint-plugin-unicorn": "^54.0.0",
|
|
88
92
|
"eslint-plugin-vue": "^9.27.0",
|
|
93
|
+
"eslint-plugin-yml": "^1.14.0",
|
|
89
94
|
"gh-changelogen": "^0.2.8",
|
|
90
95
|
"lint-staged": "^15.2.7",
|
|
91
96
|
"npm-run-all2": "^6.2.2",
|
|
@@ -97,7 +102,7 @@
|
|
|
97
102
|
"vitest": "^2.0.0"
|
|
98
103
|
},
|
|
99
104
|
"lint-staged": {
|
|
100
|
-
"*.{json,md,yml}": [
|
|
105
|
+
"*.{json,jsonc,json5,md,yml,yaml}": [
|
|
101
106
|
"prettier --write"
|
|
102
107
|
],
|
|
103
108
|
"*.{js,mjs,cjs}": [
|