@kazupon/eslint-config 0.6.0 → 0.8.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 CHANGED
@@ -14,10 +14,12 @@ ESLint config for @kazupon
14
14
  - `typescript`
15
15
  - `jsdoc`
16
16
  - `regexp`
17
+ - `promise`
17
18
  - `unicorn`
18
19
  - `prettier`
19
20
  - `jsonc`
20
- - `vue`
21
+ - `vue`,
22
+ - `yml`
21
23
  - Support primitive eslint flat configuration
22
24
  - Support overrides for built-in configurations
23
25
  - `rules`
@@ -85,7 +87,7 @@ Add the following settings to your `.vscode/settings.json`:
85
87
  "source.fixAll.eslint": "explicit"
86
88
  },
87
89
  // Enable eslint for supported languages
88
- "eslint.validate": ["javascript", "typescript", "json", "jsonc", "json5", "vue"],
90
+ "eslint.validate": ["javascript", "typescript", "json", "jsonc", "json5", "vue", "yaml"],
89
91
  // Enable flat configuration
90
92
  "eslint.useFlatConfig": true
91
93
  }
@@ -95,17 +97,19 @@ Add the following settings to your `.vscode/settings.json`:
95
97
 
96
98
  The following built-in configurations are supported:
97
99
 
98
- | Configuration | Powered by eslint plugin or package | Need to install eslint plugin or package? |
99
- | ------------- | ---------------------------------------------------------------------------------------------- | ----------------------------------------- |
100
- | `javascript` | [`@eslint/js`](https://www.npmjs.com/package/@eslint/js) | no (built-in) |
101
- | `comments` | [`eslint-plugin-eslint-comments`](https://www.npmjs.com/package/eslint-plugin-eslint-comments) | no (built-in) |
102
- | `typescript` | [`typescript-eslint`](https://www.npmjs.com/package/typescript-eslint) | yes |
103
- | `jsdoc` | [`eslint-plugin-jsdoc`](https://www.npmjs.com/package/eslint-plugin-jsdoc) | yes |
104
- | `regexp` | [`eslint-plugin-regexp`](https://www.npmjs.com/package/eslint-plugin-regexp) | yes |
105
- | `unicorn` | [`eslint-plugin-unicorn`](https://www.npmjs.com/package/eslint-plugin-unicorn) | yes |
106
- | `prettier` | [`eslint-config-prettier`](https://www.npmjs.com/package/eslint-config-prettier) | yes |
107
- | `jsonc` | [`eslint-plugin-jsonc`](https://www.npmjs.com/package/eslint-plugin-jsonc) | yes |
108
- | `vue` | [`eslint-plugin-vue`](https://www.npmjs.com/package/eslint-plugin-vue) | yes |
100
+ | Configuration | Powered by eslint plugin or package | Need to install eslint plugin or package? |
101
+ | ------------- | ---------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------- |
102
+ | `javascript` | [`@eslint/js`](https://www.npmjs.com/package/@eslint/js) | no (built-in) |
103
+ | `comments` | [`@eslint-community/eslint-plugin-eslint-comments`](https://www.npmjs.com/package/@eslint-community/eslint-plugin-eslint-comments) | no (built-in) |
104
+ | `typescript` | [`typescript-eslint`](https://www.npmjs.com/package/typescript-eslint) | yes |
105
+ | `jsdoc` | [`eslint-plugin-jsdoc`](https://www.npmjs.com/package/eslint-plugin-jsdoc) | yes |
106
+ | `regexp` | [`eslint-plugin-regexp`](https://www.npmjs.com/package/eslint-plugin-regexp) | yes |
107
+ | `promise` | [`eslint-plugin-promise`](https://www.npmjs.com/package/eslint-plugin-promise) | yes |
108
+ | `unicorn` | [`eslint-plugin-unicorn`](https://www.npmjs.com/package/eslint-plugin-unicorn) | yes |
109
+ | `prettier` | [`eslint-config-prettier`](https://www.npmjs.com/package/eslint-config-prettier) | yes |
110
+ | `jsonc` | [`eslint-plugin-jsonc`](https://www.npmjs.com/package/eslint-plugin-jsonc) | yes |
111
+ | `vue` | [`eslint-plugin-vue`](https://www.npmjs.com/package/eslint-plugin-vue) | yes |
112
+ | `yml` | [`eslint-plugin-yml`](https://www.npmjs.com/package/eslint-plugin-yml) | yes |
109
113
 
110
114
  You can use `import` syntax:
111
115
 
@@ -2,8 +2,10 @@ export * from './javascript';
2
2
  export * from './comments';
3
3
  export * from './typescript';
4
4
  export * from './jsdoc';
5
+ export * from './promise';
5
6
  export * from './regexp';
6
7
  export * from './unicorn';
7
8
  export * from './prettier';
8
9
  export * from './jsonc';
10
+ export * from './yml';
9
11
  export * from './vue';
@@ -2,8 +2,10 @@ export * from './javascript';
2
2
  export * from './comments';
3
3
  export * from './typescript';
4
4
  export * from './jsdoc';
5
+ export * from './promise';
5
6
  export * from './regexp';
6
7
  export * from './unicorn';
7
8
  export * from './prettier';
8
9
  export * from './jsonc';
10
+ export * from './yml';
9
11
  export * from './vue';
@@ -0,0 +1,4 @@
1
+ import type { Linter } from 'eslint';
2
+ import type { OverridesOptions } from '../types';
3
+ export interface PromiseOptions {}
4
+ export declare function promise(options?: ((PromiseOptions) & (OverridesOptions))): Promise<(Linter.FlatConfig)[]>;
@@ -0,0 +1,4 @@
1
+ import type { Linter } from 'eslint';
2
+ import type { OverridesOptions } from '../types';
3
+ export interface PromiseOptions {}
4
+ export declare function promise(options?: ((PromiseOptions) & (OverridesOptions))): Promise<(Linter.FlatConfig)[]>;
@@ -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
@@ -82,10 +82,10 @@ async function javascript(options = {}) {
82
82
  //#region src/configs/comments.ts
83
83
  async function comments(options = {}) {
84
84
  const { rules: overrideRules = {} } = options;
85
- const comments$1 = await loadPlugin('eslint-plugin-eslint-comments');
85
+ const comments$1 = await loadPlugin('@eslint-community/eslint-plugin-eslint-comments');
86
86
  return [{
87
- name: 'eslint-comments/recommended',
88
- plugins: {'eslint-comments': comments$1},
87
+ name: '@eslint-community/eslint-comments/recommended',
88
+ plugins: {'@eslint-community/eslint-comments': comments$1},
89
89
  rules: {...(comments$1.configs.recommended.rules)}
90
90
  }, {
91
91
  name: '@kazupon/eslint-comments',
@@ -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',
@@ -162,6 +163,20 @@ async function jsdoc(options = {}) {
162
163
  }];
163
164
  }
164
165
 
166
+ //#endregion
167
+ //#region src/configs/promise.ts
168
+ async function promise(options = {}) {
169
+ const { rules: overrideRules = {} } = options;
170
+ const promise$1 = await loadPlugin('eslint-plugin-promise');
171
+ return [{
172
+ name: 'promise/flat/recommended',
173
+ ...(promise$1.configs['flat/recommended'])
174
+ }, {
175
+ name: '@kazupon/promise',
176
+ rules: {...overrideRules}
177
+ }];
178
+ }
179
+
165
180
  //#endregion
166
181
  //#region src/configs/regexp.ts
167
182
  async function regexp(options = {}) {
@@ -242,6 +257,37 @@ async function jsonc(options = {}) {
242
257
  return configs;
243
258
  }
244
259
 
260
+ //#endregion
261
+ //#region src/configs/yml.ts
262
+ async function yml(options = {}) {
263
+ const { rules: overrideRules = {} } = options;
264
+ const usePrettier = !!options.prettier;
265
+ const yml$1 = await loadPlugin('eslint-plugin-yml');
266
+ const configs = [];
267
+ configs.push(...yml$1.configs['flat/standard'].map((config, index) => {
268
+ return config.name ? config : {
269
+ name: `yml/flat/standard/${index}`,
270
+ ...config
271
+ };
272
+ }));
273
+ if (usePrettier) {
274
+ configs.push(...yml$1.configs['flat/prettier'].map((config, index) => {
275
+ return config.name ? config : {
276
+ name: `yml/flat/prettier/${index}`,
277
+ ...config
278
+ };
279
+ }));
280
+ }
281
+ const overriddenConfig = {
282
+ name: '@kazupon/yml',
283
+ files: [GLOB_YAML],
284
+ rules: {...overrideRules}
285
+ };
286
+ configs.push(overriddenConfig);
287
+ return configs;
288
+ }
289
+ const yaml = yml;
290
+
245
291
  //#endregion
246
292
  //#region src/configs/vue.ts
247
293
  async function vue(options = {}) {
@@ -281,7 +327,10 @@ exports.javascript = javascript;
281
327
  exports.jsdoc = jsdoc;
282
328
  exports.jsonc = jsonc;
283
329
  exports.prettier = prettier;
330
+ exports.promise = promise;
284
331
  exports.regexp = regexp;
285
332
  exports.typescript = typescript;
286
333
  exports.unicorn = unicorn;
287
- exports.vue = vue;
334
+ exports.vue = vue;
335
+ exports.yaml = yaml;
336
+ exports.yml = yml;
package/dist/index.js CHANGED
@@ -57,10 +57,10 @@ async function javascript(options = {}) {
57
57
  //#region src/configs/comments.ts
58
58
  async function comments(options = {}) {
59
59
  const { rules: overrideRules = {} } = options;
60
- const comments$1 = await loadPlugin('eslint-plugin-eslint-comments');
60
+ const comments$1 = await loadPlugin('@eslint-community/eslint-plugin-eslint-comments');
61
61
  return [{
62
- name: 'eslint-comments/recommended',
63
- plugins: {'eslint-comments': comments$1},
62
+ name: '@eslint-community/eslint-comments/recommended',
63
+ plugins: {'@eslint-community/eslint-comments': comments$1},
64
64
  rules: {...(comments$1.configs.recommended.rules)}
65
65
  }, {
66
66
  name: '@kazupon/eslint-comments',
@@ -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',
@@ -137,6 +138,20 @@ async function jsdoc(options = {}) {
137
138
  }];
138
139
  }
139
140
 
141
+ //#endregion
142
+ //#region src/configs/promise.ts
143
+ async function promise(options = {}) {
144
+ const { rules: overrideRules = {} } = options;
145
+ const promise$1 = await loadPlugin('eslint-plugin-promise');
146
+ return [{
147
+ name: 'promise/flat/recommended',
148
+ ...(promise$1.configs['flat/recommended'])
149
+ }, {
150
+ name: '@kazupon/promise',
151
+ rules: {...overrideRules}
152
+ }];
153
+ }
154
+
140
155
  //#endregion
141
156
  //#region src/configs/regexp.ts
142
157
  async function regexp(options = {}) {
@@ -217,6 +232,37 @@ async function jsonc(options = {}) {
217
232
  return configs;
218
233
  }
219
234
 
235
+ //#endregion
236
+ //#region src/configs/yml.ts
237
+ async function yml(options = {}) {
238
+ const { rules: overrideRules = {} } = options;
239
+ const usePrettier = !!options.prettier;
240
+ const yml$1 = await loadPlugin('eslint-plugin-yml');
241
+ const configs = [];
242
+ configs.push(...yml$1.configs['flat/standard'].map((config, index) => {
243
+ return config.name ? config : {
244
+ name: `yml/flat/standard/${index}`,
245
+ ...config
246
+ };
247
+ }));
248
+ if (usePrettier) {
249
+ configs.push(...yml$1.configs['flat/prettier'].map((config, index) => {
250
+ return config.name ? config : {
251
+ name: `yml/flat/prettier/${index}`,
252
+ ...config
253
+ };
254
+ }));
255
+ }
256
+ const overriddenConfig = {
257
+ name: '@kazupon/yml',
258
+ files: [GLOB_YAML],
259
+ rules: {...overrideRules}
260
+ };
261
+ configs.push(overriddenConfig);
262
+ return configs;
263
+ }
264
+ const yaml = yml;
265
+
220
266
  //#endregion
221
267
  //#region src/configs/vue.ts
222
268
  async function vue(options = {}) {
@@ -249,4 +295,4 @@ async function vue(options = {}) {
249
295
  }
250
296
 
251
297
  //#endregion
252
- export { comments, defineConfig, javascript, jsdoc, jsonc, prettier, regexp, typescript, unicorn, vue };
298
+ export { comments, defineConfig, javascript, jsdoc, jsonc, prettier, promise, 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.6.0",
3
+ "version": "0.8.0",
4
4
  "description": "ESLint config for @kazupon",
5
5
  "keywords": [
6
6
  "config",
@@ -37,8 +37,8 @@
37
37
  },
38
38
  "dependencies": {
39
39
  "@eslint/js": "^9.0.0",
40
+ "@eslint-community/eslint-plugin-eslint-comments": "^4.3.0",
40
41
  "eslint-flat-config-utils": "^0.2.5",
41
- "eslint-plugin-eslint-comments": "^3.2.0",
42
42
  "globals": "^15.8.0"
43
43
  },
44
44
  "peerDependencies": {
@@ -46,15 +46,14 @@
46
46
  "eslint-config-prettier": ">=9.1.0",
47
47
  "eslint-plugin-jsdoc": ">=48.5.0",
48
48
  "eslint-plugin-jsonc": ">=2.16.0",
49
+ "eslint-plugin-promise": ">=6.4.0",
49
50
  "eslint-plugin-regexp": ">=2.6.0",
50
51
  "eslint-plugin-unicorn": ">=54.0.0",
51
52
  "eslint-plugin-vue": ">=9.24.0",
53
+ "eslint-plugin-yml": ">=1.14.0",
52
54
  "typescript-eslint": ">=7.0.0"
53
55
  },
54
56
  "peerDependenciesMeta": {
55
- "typescript-eslint": {
56
- "optional": true
57
- },
58
57
  "eslint-config-prettier": {
59
58
  "optional": true
60
59
  },
@@ -64,6 +63,9 @@
64
63
  "eslint-plugin-jsonc": {
65
64
  "optional": true
66
65
  },
66
+ "eslint-plugin-promise": {
67
+ "optional": true
68
+ },
67
69
  "eslint-plugin-regexp": {
68
70
  "optional": true
69
71
  },
@@ -72,6 +74,12 @@
72
74
  },
73
75
  "eslint-plugin-vue": {
74
76
  "optional": true
77
+ },
78
+ "eslint-plugin-yml": {
79
+ "optional": true
80
+ },
81
+ "typescript-eslint": {
82
+ "optional": true
75
83
  }
76
84
  },
77
85
  "devDependencies": {
@@ -83,9 +91,11 @@
83
91
  "eslint-config-prettier": "^9.1.0",
84
92
  "eslint-plugin-jsdoc": "^48.5.2",
85
93
  "eslint-plugin-jsonc": "^2.16.0",
94
+ "eslint-plugin-promise": "^6.4.0",
86
95
  "eslint-plugin-regexp": "^2.6.0",
87
96
  "eslint-plugin-unicorn": "^54.0.0",
88
97
  "eslint-plugin-vue": "^9.27.0",
98
+ "eslint-plugin-yml": "^1.14.0",
89
99
  "gh-changelogen": "^0.2.8",
90
100
  "lint-staged": "^15.2.7",
91
101
  "npm-run-all2": "^6.2.2",
@@ -97,7 +107,7 @@
97
107
  "vitest": "^2.0.0"
98
108
  },
99
109
  "lint-staged": {
100
- "*.{json,md,yml}": [
110
+ "*.{json,jsonc,json5,md,yml,yaml}": [
101
111
  "prettier --write"
102
112
  ],
103
113
  "*.{js,mjs,cjs}": [