@kazupon/eslint-config 0.3.0 → 0.4.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
@@ -7,11 +7,12 @@ ESLint config for @kazupon
7
7
 
8
8
  ## 🌟 Features
9
9
 
10
- - Flat configuration via `defineConfig` like [vite](https://vitejs.dev/config/)
10
+ - Flat configuration via [vite](https://vitejs.dev/config/) flavor `defineConfig`
11
11
  - Support [built-in configurations](#built-in-configurations)
12
12
  - `javascript`
13
13
  - `comments`
14
14
  - `typescript`
15
+ - `jsdoc`
15
16
  - `prettier`
16
17
  - `vue`
17
18
  - Support primitive eslint flat configuration
@@ -96,6 +97,7 @@ The following built-in configurations are supported:
96
97
  | `javascript` | [`@eslint/js`](https://www.npmjs.com/package/@eslint/js) | no (built-in) |
97
98
  | `comments` | [`eslint-plugin-eslint-comments`](https://www.npmjs.com/package/eslint-plugin-eslint-comments) | no (built-in) |
98
99
  | `typescript` | [`typescript-eslint`](https://www.npmjs.com/package/typescript-eslint) | yes |
100
+ | `jsdoc` | [`eslint-plugin-jsdoc`](https://www.npmjs.com/package/eslint-plugin-jsdoc) | yes |
99
101
  | `prettier` | [`eslint-config-prettier`](https://www.npmjs.com/package/eslint-config-prettier) | yes |
100
102
  | `vue` | [`eslint-plugin-vue`](https://www.npmjs.com/package/eslint-plugin-vue) | yes |
101
103
 
@@ -1,5 +1,6 @@
1
1
  export * from './javascript';
2
2
  export * from './comments';
3
3
  export * from './typescript';
4
+ export * from './jsdoc';
4
5
  export * from './prettier';
5
6
  export * from './vue';
@@ -1,5 +1,6 @@
1
1
  export * from './javascript';
2
2
  export * from './comments';
3
3
  export * from './typescript';
4
+ export * from './jsdoc';
4
5
  export * from './prettier';
5
6
  export * from './vue';
@@ -0,0 +1,7 @@
1
+ import type { Linter } from 'eslint';
2
+ import type { OverridesOptions } from '../types';
3
+ export interface JsDocOptions {
4
+ typescript?: (('syntax') | ('flavor'));
5
+ error?: boolean;
6
+ }
7
+ export declare function jsdoc(options?: ((JsDocOptions) & (OverridesOptions))): Promise<(Linter.FlatConfig)[]>;
@@ -0,0 +1,7 @@
1
+ import type { Linter } from 'eslint';
2
+ import type { OverridesOptions } from '../types';
3
+ export interface JsDocOptions {
4
+ typescript?: (('syntax') | ('flavor'));
5
+ error?: boolean;
6
+ }
7
+ export declare function jsdoc(options?: ((JsDocOptions) & (OverridesOptions))): Promise<(Linter.FlatConfig)[]>;
package/dist/index.cjs CHANGED
@@ -137,6 +137,29 @@ async function typescript(options = {}) {
137
137
  }];
138
138
  }
139
139
 
140
+ //#endregion
141
+ //#region src/configs/jsdoc.ts
142
+ async function jsdoc(options = {}) {
143
+ const { rules: overrideRules = {}, typescript: typescript$1, error = false } = options;
144
+ const jsdoc$1 = await loadPlugin('eslint-plugin-jsdoc');
145
+ function resolvePreset() {
146
+ let preset = 'recommended';
147
+ if (typescript$1 === 'syntax') {
148
+ preset = `${preset}-typescript`;
149
+ } else if (typescript$1 === 'flavor') {
150
+ preset = `${preset}-typescript-flavor`;
151
+ }
152
+ if (error) {
153
+ preset = `${preset}-error`;
154
+ }
155
+ return preset;
156
+ }
157
+ return [jsdoc$1.configs[`flat/${resolvePreset()}`], {
158
+ name: '@kazupon/jsdoc',
159
+ rules: {...overrideRules}
160
+ }];
161
+ }
162
+
140
163
  //#endregion
141
164
  //#region src/configs/prettier.ts
142
165
  async function prettier(options = {}) {
@@ -184,6 +207,7 @@ Object.defineProperty(exports, '__esModule', { value: true });
184
207
  exports.comments = comments;
185
208
  exports.defineConfig = defineConfig;
186
209
  exports.javascript = javascript;
210
+ exports.jsdoc = jsdoc;
187
211
  exports.prettier = prettier;
188
212
  exports.typescript = typescript;
189
213
  exports.vue = vue;
package/dist/index.js CHANGED
@@ -112,6 +112,29 @@ async function typescript(options = {}) {
112
112
  }];
113
113
  }
114
114
 
115
+ //#endregion
116
+ //#region src/configs/jsdoc.ts
117
+ async function jsdoc(options = {}) {
118
+ const { rules: overrideRules = {}, typescript: typescript$1, error = false } = options;
119
+ const jsdoc$1 = await loadPlugin('eslint-plugin-jsdoc');
120
+ function resolvePreset() {
121
+ let preset = 'recommended';
122
+ if (typescript$1 === 'syntax') {
123
+ preset = `${preset}-typescript`;
124
+ } else if (typescript$1 === 'flavor') {
125
+ preset = `${preset}-typescript-flavor`;
126
+ }
127
+ if (error) {
128
+ preset = `${preset}-error`;
129
+ }
130
+ return preset;
131
+ }
132
+ return [jsdoc$1.configs[`flat/${resolvePreset()}`], {
133
+ name: '@kazupon/jsdoc',
134
+ rules: {...overrideRules}
135
+ }];
136
+ }
137
+
115
138
  //#endregion
116
139
  //#region src/configs/prettier.ts
117
140
  async function prettier(options = {}) {
@@ -155,4 +178,4 @@ async function vue(options = {}) {
155
178
  }
156
179
 
157
180
  //#endregion
158
- export { comments, defineConfig, javascript, prettier, typescript, vue };
181
+ export { comments, defineConfig, javascript, jsdoc, prettier, typescript, vue };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kazupon/eslint-config",
3
- "version": "0.3.0",
3
+ "version": "0.4.0",
4
4
  "description": "ESLint config for @kazupon",
5
5
  "keywords": [
6
6
  "config",
@@ -43,9 +43,10 @@
43
43
  },
44
44
  "peerDependencies": {
45
45
  "eslint": ">=8.56.0 || >=9.0.0",
46
- "typescript-eslint": ">=7.0.0",
47
46
  "eslint-config-prettier": ">=9.1.0",
48
- "eslint-plugin-vue": ">=9.24.0"
47
+ "eslint-plugin-jsdoc": ">=48.5.0",
48
+ "eslint-plugin-vue": ">=9.24.0",
49
+ "typescript-eslint": ">=7.0.0"
49
50
  },
50
51
  "peerDependenciesMeta": {
51
52
  "typescript-eslint": {
@@ -54,6 +55,9 @@
54
55
  "eslint-config-prettier": {
55
56
  "optional": true
56
57
  },
58
+ "eslint-plugin-jsdoc": {
59
+ "optional": true
60
+ },
57
61
  "eslint-plugin-vue": {
58
62
  "optional": true
59
63
  }
@@ -65,6 +69,7 @@
65
69
  "bumpp": "^9.4.1",
66
70
  "eslint": "^9.6.0",
67
71
  "eslint-config-prettier": "^9.1.0",
72
+ "eslint-plugin-jsdoc": "^48.5.2",
68
73
  "eslint-plugin-vue": "^9.27.0",
69
74
  "gh-changelogen": "^0.2.8",
70
75
  "lint-staged": "^15.2.7",