@tofrankie/eslint 0.0.4 → 0.0.5
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/CHANGELOG.md +5 -1
- package/dist/index.cjs +55 -2
- package/dist/index.mjs +55 -2
- package/package.json +2 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,10 +1,14 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## eslint@0.0.5 (2026-02-20)
|
|
4
|
+
|
|
5
|
+
- Add `jsdoc` preset config
|
|
6
|
+
|
|
3
7
|
## eslint@0.0.4 (2026-02-13)
|
|
4
8
|
|
|
5
9
|
### BREAKING CHANGE
|
|
6
10
|
|
|
7
|
-
-
|
|
11
|
+
- `defineConfig(antfuOptions?, ...userFlatConfigs)` - New API signature
|
|
8
12
|
- First param: antfu options (formatters, typescript, rules, etc.), merge with user options
|
|
9
13
|
- Rest params: ESLint flat configs, appended after preset configs
|
|
10
14
|
|
package/dist/index.cjs
CHANGED
|
@@ -29,7 +29,56 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
|
|
|
29
29
|
let _antfu_eslint_config = require("@antfu/eslint-config");
|
|
30
30
|
let lodash_merge = require("lodash.merge");
|
|
31
31
|
lodash_merge = __toESM(lodash_merge);
|
|
32
|
+
let eslint_plugin_jsdoc = require("eslint-plugin-jsdoc");
|
|
32
33
|
|
|
34
|
+
//#region src/preset-configs/jsdoc.ts
|
|
35
|
+
const SHARED_RULES = {
|
|
36
|
+
"jsdoc/check-syntax": "error",
|
|
37
|
+
"jsdoc/no-defaults": "off",
|
|
38
|
+
"jsdoc/require-jsdoc": "off",
|
|
39
|
+
"jsdoc/require-param-description": "off",
|
|
40
|
+
"jsdoc/require-property-description": "off",
|
|
41
|
+
"jsdoc/require-returns": "off",
|
|
42
|
+
"jsdoc/require-returns-type": "off",
|
|
43
|
+
"jsdoc/require-returns-description": "off",
|
|
44
|
+
"jsdoc/newline-after-description": "off"
|
|
45
|
+
};
|
|
46
|
+
const SHARED_SETTINGS = { tagNamePreference: {
|
|
47
|
+
description: "desc",
|
|
48
|
+
property: "prop",
|
|
49
|
+
returns: "return"
|
|
50
|
+
} };
|
|
51
|
+
const JSDOC_JS_CONFIG = (0, eslint_plugin_jsdoc.jsdoc)({
|
|
52
|
+
config: "flat/recommended-typescript-flavor-error",
|
|
53
|
+
files: [
|
|
54
|
+
"**/*.js",
|
|
55
|
+
"**/*.jsx",
|
|
56
|
+
"**/*.cjs",
|
|
57
|
+
"**/*.mjs"
|
|
58
|
+
],
|
|
59
|
+
rules: {
|
|
60
|
+
...SHARED_RULES,
|
|
61
|
+
"jsdoc/require-param-type": "warn"
|
|
62
|
+
},
|
|
63
|
+
settings: SHARED_SETTINGS
|
|
64
|
+
});
|
|
65
|
+
const JSDOC_TS_CONFIG = (0, eslint_plugin_jsdoc.jsdoc)({
|
|
66
|
+
config: "flat/recommended-typescript-error",
|
|
67
|
+
files: [
|
|
68
|
+
"**/*.ts",
|
|
69
|
+
"**/*.tsx",
|
|
70
|
+
"**/*.cts",
|
|
71
|
+
"**/*.mts"
|
|
72
|
+
],
|
|
73
|
+
rules: {
|
|
74
|
+
...SHARED_RULES,
|
|
75
|
+
"jsdoc/require-param-type": "off"
|
|
76
|
+
},
|
|
77
|
+
settings: SHARED_SETTINGS
|
|
78
|
+
});
|
|
79
|
+
const JSDOC_PRESET_CONFIG = [JSDOC_JS_CONFIG, JSDOC_TS_CONFIG];
|
|
80
|
+
|
|
81
|
+
//#endregion
|
|
33
82
|
//#region src/preset-configs/typescript.ts
|
|
34
83
|
const TYPESCRIPT_PRESET_CONFIG = {
|
|
35
84
|
files: ["**/*.ts", "**/*.tsx"],
|
|
@@ -197,7 +246,7 @@ function buildPresetRules(resolvedOptions) {
|
|
|
197
246
|
* 自动检测/默认开启的配置,若不为 false 则加载相关预设 rules
|
|
198
247
|
* 如果默认关闭的配置,若为 true 才加载相关预设 rules
|
|
199
248
|
* @param key - The key of the option to check.
|
|
200
|
-
* @
|
|
249
|
+
* @return A predicate function that checks if the option is not false.
|
|
201
250
|
*/
|
|
202
251
|
function notFalse(key) {
|
|
203
252
|
return (options) => options[key] !== false;
|
|
@@ -229,7 +278,11 @@ function defineConfig(antfuOptions, ...userFlatConfigs) {
|
|
|
229
278
|
} },
|
|
230
279
|
typescript: true
|
|
231
280
|
}, userOptionsWithoutRules);
|
|
232
|
-
|
|
281
|
+
const resolvedOptions = (0, lodash_merge.default)({}, mergedOptions, { rules: (0, lodash_merge.default)({}, buildPresetRules(mergedOptions), userRules ?? {}) });
|
|
282
|
+
const presetConfigs = [];
|
|
283
|
+
if (mergedOptions.typescript) presetConfigs.push(TYPESCRIPT_PRESET_CONFIG);
|
|
284
|
+
if (mergedOptions.jsdoc !== false) presetConfigs.push(...JSDOC_PRESET_CONFIG);
|
|
285
|
+
return (0, _antfu_eslint_config.antfu)(resolvedOptions, ...presetConfigs, ...userFlatConfigs);
|
|
233
286
|
}
|
|
234
287
|
|
|
235
288
|
//#endregion
|
package/dist/index.mjs
CHANGED
|
@@ -1,6 +1,55 @@
|
|
|
1
1
|
import { antfu } from "@antfu/eslint-config";
|
|
2
2
|
import merge from "lodash.merge";
|
|
3
|
+
import { jsdoc } from "eslint-plugin-jsdoc";
|
|
3
4
|
|
|
5
|
+
//#region src/preset-configs/jsdoc.ts
|
|
6
|
+
const SHARED_RULES = {
|
|
7
|
+
"jsdoc/check-syntax": "error",
|
|
8
|
+
"jsdoc/no-defaults": "off",
|
|
9
|
+
"jsdoc/require-jsdoc": "off",
|
|
10
|
+
"jsdoc/require-param-description": "off",
|
|
11
|
+
"jsdoc/require-property-description": "off",
|
|
12
|
+
"jsdoc/require-returns": "off",
|
|
13
|
+
"jsdoc/require-returns-type": "off",
|
|
14
|
+
"jsdoc/require-returns-description": "off",
|
|
15
|
+
"jsdoc/newline-after-description": "off"
|
|
16
|
+
};
|
|
17
|
+
const SHARED_SETTINGS = { tagNamePreference: {
|
|
18
|
+
description: "desc",
|
|
19
|
+
property: "prop",
|
|
20
|
+
returns: "return"
|
|
21
|
+
} };
|
|
22
|
+
const JSDOC_JS_CONFIG = jsdoc({
|
|
23
|
+
config: "flat/recommended-typescript-flavor-error",
|
|
24
|
+
files: [
|
|
25
|
+
"**/*.js",
|
|
26
|
+
"**/*.jsx",
|
|
27
|
+
"**/*.cjs",
|
|
28
|
+
"**/*.mjs"
|
|
29
|
+
],
|
|
30
|
+
rules: {
|
|
31
|
+
...SHARED_RULES,
|
|
32
|
+
"jsdoc/require-param-type": "warn"
|
|
33
|
+
},
|
|
34
|
+
settings: SHARED_SETTINGS
|
|
35
|
+
});
|
|
36
|
+
const JSDOC_TS_CONFIG = jsdoc({
|
|
37
|
+
config: "flat/recommended-typescript-error",
|
|
38
|
+
files: [
|
|
39
|
+
"**/*.ts",
|
|
40
|
+
"**/*.tsx",
|
|
41
|
+
"**/*.cts",
|
|
42
|
+
"**/*.mts"
|
|
43
|
+
],
|
|
44
|
+
rules: {
|
|
45
|
+
...SHARED_RULES,
|
|
46
|
+
"jsdoc/require-param-type": "off"
|
|
47
|
+
},
|
|
48
|
+
settings: SHARED_SETTINGS
|
|
49
|
+
});
|
|
50
|
+
const JSDOC_PRESET_CONFIG = [JSDOC_JS_CONFIG, JSDOC_TS_CONFIG];
|
|
51
|
+
|
|
52
|
+
//#endregion
|
|
4
53
|
//#region src/preset-configs/typescript.ts
|
|
5
54
|
const TYPESCRIPT_PRESET_CONFIG = {
|
|
6
55
|
files: ["**/*.ts", "**/*.tsx"],
|
|
@@ -168,7 +217,7 @@ function buildPresetRules(resolvedOptions) {
|
|
|
168
217
|
* 自动检测/默认开启的配置,若不为 false 则加载相关预设 rules
|
|
169
218
|
* 如果默认关闭的配置,若为 true 才加载相关预设 rules
|
|
170
219
|
* @param key - The key of the option to check.
|
|
171
|
-
* @
|
|
220
|
+
* @return A predicate function that checks if the option is not false.
|
|
172
221
|
*/
|
|
173
222
|
function notFalse(key) {
|
|
174
223
|
return (options) => options[key] !== false;
|
|
@@ -200,7 +249,11 @@ function defineConfig(antfuOptions, ...userFlatConfigs) {
|
|
|
200
249
|
} },
|
|
201
250
|
typescript: true
|
|
202
251
|
}, userOptionsWithoutRules);
|
|
203
|
-
|
|
252
|
+
const resolvedOptions = merge({}, mergedOptions, { rules: merge({}, buildPresetRules(mergedOptions), userRules ?? {}) });
|
|
253
|
+
const presetConfigs = [];
|
|
254
|
+
if (mergedOptions.typescript) presetConfigs.push(TYPESCRIPT_PRESET_CONFIG);
|
|
255
|
+
if (mergedOptions.jsdoc !== false) presetConfigs.push(...JSDOC_PRESET_CONFIG);
|
|
256
|
+
return antfu(resolvedOptions, ...presetConfigs, ...userFlatConfigs);
|
|
204
257
|
}
|
|
205
258
|
|
|
206
259
|
//#endregion
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tofrankie/eslint",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "0.0.
|
|
4
|
+
"version": "0.0.5",
|
|
5
5
|
"description": "Shared ESLint configuration for @tofrankie projects",
|
|
6
6
|
"author": "Frankie <1426203851@qq.com>",
|
|
7
7
|
"license": "MIT",
|
|
@@ -40,6 +40,7 @@
|
|
|
40
40
|
"dependencies": {
|
|
41
41
|
"@eslint-react/eslint-plugin": "^2.12.4",
|
|
42
42
|
"eslint-plugin-format": "^1.4.0",
|
|
43
|
+
"eslint-plugin-jsdoc": "^62.5.4",
|
|
43
44
|
"eslint-plugin-react-hooks": "^7.0.1",
|
|
44
45
|
"eslint-plugin-react-refresh": "^0.5.0",
|
|
45
46
|
"lodash.merge": "^4.6.2"
|