@kazupon/eslint-config 0.3.0 → 0.4.1
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 +3 -1
- package/dist/configs/index.d.cts +1 -0
- package/dist/configs/index.d.ts +1 -0
- package/dist/configs/jsdoc.d.cts +7 -0
- package/dist/configs/jsdoc.d.ts +7 -0
- package/dist/index.cjs +28 -5
- package/dist/index.js +28 -6
- package/package.json +11 -4
package/README.md
CHANGED
|
@@ -7,11 +7,12 @@ ESLint config for @kazupon
|
|
|
7
7
|
|
|
8
8
|
## 🌟 Features
|
|
9
9
|
|
|
10
|
-
- Flat configuration via
|
|
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
|
|
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 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
|
@@ -39,12 +39,11 @@ async function interopDefault(mod) {
|
|
|
39
39
|
return (resolved).default || resolved;
|
|
40
40
|
}
|
|
41
41
|
async function loadPlugin(name) {
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
} catch (e) {
|
|
45
|
-
console.error(e);
|
|
42
|
+
const mod = await import(name).catch((err) => {
|
|
43
|
+
console.error(err);
|
|
46
44
|
throw new Error(`Failed to load eslint plugin '${name}'. Please install it!`);
|
|
47
|
-
}
|
|
45
|
+
});
|
|
46
|
+
return interopDefault(mod);
|
|
48
47
|
}
|
|
49
48
|
|
|
50
49
|
//#endregion
|
|
@@ -137,6 +136,29 @@ async function typescript(options = {}) {
|
|
|
137
136
|
}];
|
|
138
137
|
}
|
|
139
138
|
|
|
139
|
+
//#endregion
|
|
140
|
+
//#region src/configs/jsdoc.ts
|
|
141
|
+
async function jsdoc(options = {}) {
|
|
142
|
+
const { rules: overrideRules = {}, typescript: typescript$1, error = false } = options;
|
|
143
|
+
const jsdoc$1 = await loadPlugin('eslint-plugin-jsdoc');
|
|
144
|
+
function resolvePreset() {
|
|
145
|
+
let preset = 'recommended';
|
|
146
|
+
if (typescript$1 === 'syntax') {
|
|
147
|
+
preset = `${preset}-typescript`;
|
|
148
|
+
} else if (typescript$1 === 'flavor') {
|
|
149
|
+
preset = `${preset}-typescript-flavor`;
|
|
150
|
+
}
|
|
151
|
+
if (error) {
|
|
152
|
+
preset = `${preset}-error`;
|
|
153
|
+
}
|
|
154
|
+
return preset;
|
|
155
|
+
}
|
|
156
|
+
return [jsdoc$1.configs[`flat/${resolvePreset()}`], {
|
|
157
|
+
name: '@kazupon/jsdoc',
|
|
158
|
+
rules: {...overrideRules}
|
|
159
|
+
}];
|
|
160
|
+
}
|
|
161
|
+
|
|
140
162
|
//#endregion
|
|
141
163
|
//#region src/configs/prettier.ts
|
|
142
164
|
async function prettier(options = {}) {
|
|
@@ -184,6 +206,7 @@ Object.defineProperty(exports, '__esModule', { value: true });
|
|
|
184
206
|
exports.comments = comments;
|
|
185
207
|
exports.defineConfig = defineConfig;
|
|
186
208
|
exports.javascript = javascript;
|
|
209
|
+
exports.jsdoc = jsdoc;
|
|
187
210
|
exports.prettier = prettier;
|
|
188
211
|
exports.typescript = typescript;
|
|
189
212
|
exports.vue = vue;
|
package/dist/index.js
CHANGED
|
@@ -14,12 +14,11 @@ async function interopDefault(mod) {
|
|
|
14
14
|
return (resolved).default || resolved;
|
|
15
15
|
}
|
|
16
16
|
async function loadPlugin(name) {
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
} catch (e) {
|
|
20
|
-
console.error(e);
|
|
17
|
+
const mod = await import(name).catch((err) => {
|
|
18
|
+
console.error(err);
|
|
21
19
|
throw new Error(`Failed to load eslint plugin '${name}'. Please install it!`);
|
|
22
|
-
}
|
|
20
|
+
});
|
|
21
|
+
return interopDefault(mod);
|
|
23
22
|
}
|
|
24
23
|
|
|
25
24
|
//#endregion
|
|
@@ -112,6 +111,29 @@ async function typescript(options = {}) {
|
|
|
112
111
|
}];
|
|
113
112
|
}
|
|
114
113
|
|
|
114
|
+
//#endregion
|
|
115
|
+
//#region src/configs/jsdoc.ts
|
|
116
|
+
async function jsdoc(options = {}) {
|
|
117
|
+
const { rules: overrideRules = {}, typescript: typescript$1, error = false } = options;
|
|
118
|
+
const jsdoc$1 = await loadPlugin('eslint-plugin-jsdoc');
|
|
119
|
+
function resolvePreset() {
|
|
120
|
+
let preset = 'recommended';
|
|
121
|
+
if (typescript$1 === 'syntax') {
|
|
122
|
+
preset = `${preset}-typescript`;
|
|
123
|
+
} else if (typescript$1 === 'flavor') {
|
|
124
|
+
preset = `${preset}-typescript-flavor`;
|
|
125
|
+
}
|
|
126
|
+
if (error) {
|
|
127
|
+
preset = `${preset}-error`;
|
|
128
|
+
}
|
|
129
|
+
return preset;
|
|
130
|
+
}
|
|
131
|
+
return [jsdoc$1.configs[`flat/${resolvePreset()}`], {
|
|
132
|
+
name: '@kazupon/jsdoc',
|
|
133
|
+
rules: {...overrideRules}
|
|
134
|
+
}];
|
|
135
|
+
}
|
|
136
|
+
|
|
115
137
|
//#endregion
|
|
116
138
|
//#region src/configs/prettier.ts
|
|
117
139
|
async function prettier(options = {}) {
|
|
@@ -155,4 +177,4 @@ async function vue(options = {}) {
|
|
|
155
177
|
}
|
|
156
178
|
|
|
157
179
|
//#endregion
|
|
158
|
-
export { comments, defineConfig, javascript, prettier, typescript, vue };
|
|
180
|
+
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
|
+
"version": "0.4.1",
|
|
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-
|
|
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",
|
|
@@ -73,7 +78,8 @@
|
|
|
73
78
|
"tsdown": "^0.2.3",
|
|
74
79
|
"tsx": "^4.16.2",
|
|
75
80
|
"typescript": "^5.5.3",
|
|
76
|
-
"typescript-eslint": "^7.15.0"
|
|
81
|
+
"typescript-eslint": "^7.15.0",
|
|
82
|
+
"vitest": "^1.6.0"
|
|
77
83
|
},
|
|
78
84
|
"lint-staged": {
|
|
79
85
|
"*.{json,md,yml}": [
|
|
@@ -99,6 +105,7 @@
|
|
|
99
105
|
"fix:prettier": "prettier . --write",
|
|
100
106
|
"fix:eslint": "eslint . --fix",
|
|
101
107
|
"dev": "pnpx @eslint/config-inspector --config eslint.config.ts",
|
|
108
|
+
"test": "vitest",
|
|
102
109
|
"build": "tsdown",
|
|
103
110
|
"build:inspector": "pnpm build && pnpx @eslint/config-inspector build",
|
|
104
111
|
"typecheck": "tsc -p ."
|