@lincy/eslint-config 3.5.2 → 3.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 +31 -17
- package/dist/index.cjs +36 -29
- package/dist/index.d.cts +20 -18
- package/dist/index.d.ts +20 -18
- package/dist/index.js +42 -37
- package/package.json +23 -19
package/README.md
CHANGED
|
@@ -133,9 +133,9 @@ export default lincy({
|
|
|
133
133
|
// 是否启用 stylistic 格式化规则
|
|
134
134
|
stylistic: true, // 默认值: true, 可选: false | { indent: number | 'tab', quotes: 'single' | 'double', jsx: boolean}
|
|
135
135
|
// 是否启用 typescript 规则
|
|
136
|
-
typescript: true, // 默认值: 检测是否安装typescript依赖, 可选: false
|
|
136
|
+
typescript: true, // 默认值: 检测是否安装typescript依赖, 可选: false | true
|
|
137
137
|
// 是否启用 vue 规则
|
|
138
|
-
vue: true, // 默认值: 检测是否安装vue依赖, 可选: false
|
|
138
|
+
vue: true, // 默认值: 检测是否安装vue依赖, 可选: false | true
|
|
139
139
|
// 是否启用 jsx 规则
|
|
140
140
|
jsx: true, // 默认值: true, 可选: false
|
|
141
141
|
// 是否启用 jsonc 规则
|
|
@@ -148,8 +148,6 @@ export default lincy({
|
|
|
148
148
|
test: false, // 默认值: true, 可选: false
|
|
149
149
|
// 是否启用 markdown 规则
|
|
150
150
|
markdown: false, // 默认值: true, 可选: false
|
|
151
|
-
// 是否启用 eslint-plugin-sort-keys 规则
|
|
152
|
-
sortKeys: true, // 默认值: false, 可选: true
|
|
153
151
|
// 覆盖规则
|
|
154
152
|
overrides: {},
|
|
155
153
|
|
|
@@ -203,7 +201,9 @@ export default lincy(
|
|
|
203
201
|
// 你还可以继续配置多个 ESLint Flat Configs
|
|
204
202
|
{
|
|
205
203
|
files: ['**/*.ts'],
|
|
206
|
-
rules: {
|
|
204
|
+
rules: {
|
|
205
|
+
'perfectionist/sort-objects': 'error',
|
|
206
|
+
},
|
|
207
207
|
},
|
|
208
208
|
)
|
|
209
209
|
```
|
|
@@ -221,7 +221,7 @@ import {
|
|
|
221
221
|
jsonc,
|
|
222
222
|
markdown,
|
|
223
223
|
node,
|
|
224
|
-
|
|
224
|
+
perfectionist,
|
|
225
225
|
sortPackageJson,
|
|
226
226
|
sortTsconfig,
|
|
227
227
|
stylistic,
|
|
@@ -232,20 +232,16 @@ import {
|
|
|
232
232
|
} from '@lincy/eslint-config'
|
|
233
233
|
|
|
234
234
|
export default [
|
|
235
|
-
...comments(),
|
|
236
235
|
...ignores(),
|
|
237
|
-
...
|
|
238
|
-
...
|
|
239
|
-
...jsdoc(),
|
|
236
|
+
...javascript(/* Options */),
|
|
237
|
+
...comments(),
|
|
240
238
|
...node(),
|
|
241
|
-
...
|
|
242
|
-
...
|
|
243
|
-
...sortTsconfig(),
|
|
239
|
+
...jsdoc(),
|
|
240
|
+
...imports(),
|
|
244
241
|
...unicorn(),
|
|
245
|
-
|
|
246
|
-
...typescript(),
|
|
242
|
+
...perfectionist(),
|
|
243
|
+
...typescript(/* Options */),
|
|
247
244
|
...stylistic(),
|
|
248
|
-
|
|
249
245
|
...vue(),
|
|
250
246
|
...jsonc(),
|
|
251
247
|
...yaml(),
|
|
@@ -296,7 +292,6 @@ export default lincy(
|
|
|
296
292
|
jsonc: true,
|
|
297
293
|
yaml: true,
|
|
298
294
|
markdown: true,
|
|
299
|
-
sortKeys: true,
|
|
300
295
|
overrides: {}
|
|
301
296
|
},
|
|
302
297
|
{
|
|
@@ -354,6 +349,24 @@ export default lincy({
|
|
|
354
349
|
})
|
|
355
350
|
```
|
|
356
351
|
|
|
352
|
+
#### `perfectionist` (sorting)
|
|
353
|
+
|
|
354
|
+
这个插件 [`eslint-plugin-perfectionist`](https://github.com/azat-io/eslint-plugin-perfectionist) 允许你排序对象键名,导入,自动修复等。
|
|
355
|
+
|
|
356
|
+
安装了插件,但默认情况下没有启用任何规则。
|
|
357
|
+
|
|
358
|
+
建议使用[configuration comments]单独选择每个文件。(https://eslint.org/docs/latest/use/configure/rules#using-configuration-comments-1).
|
|
359
|
+
|
|
360
|
+
```js
|
|
361
|
+
/* eslint perfectionist/sort-objects: "error" */
|
|
362
|
+
const objectWantedToSort = {
|
|
363
|
+
a: 2,
|
|
364
|
+
b: 1,
|
|
365
|
+
c: 3,
|
|
366
|
+
}
|
|
367
|
+
/* eslint perfectionist/sort-objects: "off" */
|
|
368
|
+
```
|
|
369
|
+
|
|
357
370
|
### 类型感知规则
|
|
358
371
|
|
|
359
372
|
您可以选择通过将选项对象传递给“typescript”配置来启用[类型感知规则](https://typescript-eslint.io/linting/typed-linting/):
|
|
@@ -365,6 +378,7 @@ import lincy from '@lincy/eslint-config'
|
|
|
365
378
|
export default lincy({
|
|
366
379
|
typescript: {
|
|
367
380
|
tsconfigPath: 'tsconfig.json',
|
|
381
|
+
// tsconfigPath: ['tsconfig.json'], // 也可以是数组
|
|
368
382
|
},
|
|
369
383
|
})
|
|
370
384
|
```
|
package/dist/index.cjs
CHANGED
|
@@ -66,6 +66,7 @@ __export(src_exports, {
|
|
|
66
66
|
parserTs: () => parserTs,
|
|
67
67
|
parserVue: () => import_vue_eslint_parser.default,
|
|
68
68
|
parserYaml: () => import_yaml_eslint_parser.default,
|
|
69
|
+
perfectionist: () => perfectionist,
|
|
69
70
|
pluginAntfu: () => import_eslint_plugin_antfu.default,
|
|
70
71
|
pluginComments: () => import_eslint_plugin_eslint_comments.default,
|
|
71
72
|
pluginImport: () => pluginImport,
|
|
@@ -74,6 +75,7 @@ __export(src_exports, {
|
|
|
74
75
|
pluginMarkdown: () => import_eslint_plugin_markdown.default,
|
|
75
76
|
pluginNoOnlyTests: () => import_eslint_plugin_no_only_tests.default,
|
|
76
77
|
pluginNode: () => import_eslint_plugin_n.default,
|
|
78
|
+
pluginPerfectionist: () => import_eslint_plugin_perfectionist.default,
|
|
77
79
|
pluginSortKeys: () => import_eslint_plugin_sort_keys.default,
|
|
78
80
|
pluginStylistic: () => import_eslint_plugin.default,
|
|
79
81
|
pluginTs: () => import_eslint_plugin2.default,
|
|
@@ -82,11 +84,11 @@ __export(src_exports, {
|
|
|
82
84
|
pluginVue: () => import_eslint_plugin_vue.default,
|
|
83
85
|
pluginYaml: () => pluginYaml,
|
|
84
86
|
renameRules: () => renameRules,
|
|
85
|
-
sortKeys: () => sortKeys,
|
|
86
87
|
sortPackageJson: () => sortPackageJson,
|
|
87
88
|
sortTsconfig: () => sortTsconfig,
|
|
88
89
|
stylistic: () => stylistic,
|
|
89
90
|
test: () => test,
|
|
91
|
+
toArray: () => toArray,
|
|
90
92
|
typescript: () => typescript,
|
|
91
93
|
unicorn: () => unicorn,
|
|
92
94
|
vue: () => vue,
|
|
@@ -116,6 +118,7 @@ var import_eslint_plugin_vue = __toESM(require("eslint-plugin-vue"), 1);
|
|
|
116
118
|
var pluginYaml = __toESM(require("eslint-plugin-yml"), 1);
|
|
117
119
|
var import_eslint_plugin_no_only_tests = __toESM(require("eslint-plugin-no-only-tests"), 1);
|
|
118
120
|
var import_eslint_plugin_sort_keys = __toESM(require("eslint-plugin-sort-keys"), 1);
|
|
121
|
+
var import_eslint_plugin_perfectionist = __toESM(require("eslint-plugin-perfectionist"), 1);
|
|
119
122
|
var parserTs = __toESM(require("@typescript-eslint/parser"), 1);
|
|
120
123
|
var import_vue_eslint_parser = __toESM(require("vue-eslint-parser"), 1);
|
|
121
124
|
var import_yaml_eslint_parser = __toESM(require("yaml-eslint-parser"), 1);
|
|
@@ -280,7 +283,6 @@ function javascript(options = {}) {
|
|
|
280
283
|
"accessor-pairs": ["error", { enforceForClassMembers: true, setWithoutGet: true }],
|
|
281
284
|
"antfu/top-level-function": "error",
|
|
282
285
|
"array-callback-return": "error",
|
|
283
|
-
"arrow-parens": ["error", "as-needed", { requireForBlockBody: true }],
|
|
284
286
|
"block-scoped-var": "error",
|
|
285
287
|
"constructor-super": "error",
|
|
286
288
|
"default-case-last": "error",
|
|
@@ -439,6 +441,7 @@ function javascript(options = {}) {
|
|
|
439
441
|
memberSyntaxSortOrder: ["none", "all", "multiple", "single"]
|
|
440
442
|
}
|
|
441
443
|
],
|
|
444
|
+
"style/arrow-parens": ["error", "as-needed", { requireForBlockBody: true }],
|
|
442
445
|
"symbol-description": "error",
|
|
443
446
|
"unicode-bom": ["error", "never"],
|
|
444
447
|
"unused-imports/no-unused-imports": isInEditor ? "off" : "error",
|
|
@@ -500,8 +503,8 @@ function jsdoc(options = {}) {
|
|
|
500
503
|
// src/configs/jsonc.ts
|
|
501
504
|
function jsonc(options = {}) {
|
|
502
505
|
const {
|
|
503
|
-
|
|
504
|
-
|
|
506
|
+
overrides = {},
|
|
507
|
+
stylistic: stylistic2 = true
|
|
505
508
|
} = options;
|
|
506
509
|
return [
|
|
507
510
|
{
|
|
@@ -876,8 +879,8 @@ function stylistic(options = {}) {
|
|
|
876
879
|
} = options;
|
|
877
880
|
const {
|
|
878
881
|
indent = 4,
|
|
879
|
-
|
|
880
|
-
|
|
882
|
+
jsx = true,
|
|
883
|
+
quotes = "single"
|
|
881
884
|
} = typeof stylistic2 === "boolean" ? {} : stylistic2;
|
|
882
885
|
return [
|
|
883
886
|
{
|
|
@@ -903,14 +906,9 @@ function stylistic(options = {}) {
|
|
|
903
906
|
"style/indent": ["error", indent, {
|
|
904
907
|
ArrayExpression: 1,
|
|
905
908
|
CallExpression: { arguments: 1 },
|
|
909
|
+
flatTernaryExpressions: false,
|
|
906
910
|
FunctionDeclaration: { body: 1, parameters: 1 },
|
|
907
911
|
FunctionExpression: { body: 1, parameters: 1 },
|
|
908
|
-
ImportDeclaration: 1,
|
|
909
|
-
MemberExpression: 1,
|
|
910
|
-
ObjectExpression: 1,
|
|
911
|
-
SwitchCase: 1,
|
|
912
|
-
VariableDeclarator: 1,
|
|
913
|
-
flatTernaryExpressions: false,
|
|
914
912
|
ignoreComments: false,
|
|
915
913
|
ignoredNodes: [
|
|
916
914
|
"TemplateLiteral *",
|
|
@@ -935,8 +933,13 @@ function stylistic(options = {}) {
|
|
|
935
933
|
"FunctionExpression > .params > :matches(Decorator, :not(:first-child))",
|
|
936
934
|
"ClassBody.body > PropertyDefinition[decorators.length > 0] > .key"
|
|
937
935
|
],
|
|
936
|
+
ImportDeclaration: 1,
|
|
937
|
+
MemberExpression: 1,
|
|
938
|
+
ObjectExpression: 1,
|
|
938
939
|
offsetTernaryExpressions: true,
|
|
939
|
-
outerIIFEBody: 1
|
|
940
|
+
outerIIFEBody: 1,
|
|
941
|
+
SwitchCase: 1,
|
|
942
|
+
VariableDeclarator: 1
|
|
940
943
|
}],
|
|
941
944
|
"style/key-spacing": ["error", { afterColon: true, beforeColon: false }],
|
|
942
945
|
"style/keyword-spacing": ["error", { after: true, before: true }],
|
|
@@ -1032,7 +1035,7 @@ var import_node_process = __toESM(require("process"), 1);
|
|
|
1032
1035
|
|
|
1033
1036
|
// src/utils.ts
|
|
1034
1037
|
function combine(...configs) {
|
|
1035
|
-
return configs.
|
|
1038
|
+
return configs.flat();
|
|
1036
1039
|
}
|
|
1037
1040
|
function renameRules(rules, from, to) {
|
|
1038
1041
|
return Object.fromEntries(
|
|
@@ -1043,14 +1046,16 @@ function renameRules(rules, from, to) {
|
|
|
1043
1046
|
})
|
|
1044
1047
|
);
|
|
1045
1048
|
}
|
|
1049
|
+
function toArray(value) {
|
|
1050
|
+
return Array.isArray(value) ? value : [value];
|
|
1051
|
+
}
|
|
1046
1052
|
|
|
1047
1053
|
// src/configs/typescript.ts
|
|
1048
1054
|
function typescript(options) {
|
|
1049
1055
|
const {
|
|
1050
1056
|
componentExts = [],
|
|
1051
1057
|
overrides = {},
|
|
1052
|
-
parserOptions = {}
|
|
1053
|
-
tsconfigPath
|
|
1058
|
+
parserOptions = {}
|
|
1054
1059
|
} = options ?? {};
|
|
1055
1060
|
const typeAwareRules = {
|
|
1056
1061
|
"dot-notation": "off",
|
|
@@ -1073,6 +1078,7 @@ function typescript(options) {
|
|
|
1073
1078
|
"ts/restrict-template-expressions": "error",
|
|
1074
1079
|
"ts/unbound-method": "error"
|
|
1075
1080
|
};
|
|
1081
|
+
const tsconfigPath = options?.tsconfigPath ? toArray(options.tsconfigPath) : void 0;
|
|
1076
1082
|
return [
|
|
1077
1083
|
{
|
|
1078
1084
|
// Install the plugins without globs, so they can be configured separately.
|
|
@@ -1093,7 +1099,7 @@ function typescript(options) {
|
|
|
1093
1099
|
extraFileExtensions: componentExts.map((ext) => `.${ext}`),
|
|
1094
1100
|
sourceType: "module",
|
|
1095
1101
|
...tsconfigPath ? {
|
|
1096
|
-
project:
|
|
1102
|
+
project: tsconfigPath,
|
|
1097
1103
|
tsconfigRootDir: import_node_process.default.cwd()
|
|
1098
1104
|
} : {},
|
|
1099
1105
|
...parserOptions
|
|
@@ -1415,12 +1421,12 @@ function test(options = {}) {
|
|
|
1415
1421
|
];
|
|
1416
1422
|
}
|
|
1417
1423
|
|
|
1418
|
-
// src/configs/
|
|
1419
|
-
function
|
|
1424
|
+
// src/configs/perfectionist.ts
|
|
1425
|
+
function perfectionist() {
|
|
1420
1426
|
return [
|
|
1421
1427
|
{
|
|
1422
1428
|
plugins: {
|
|
1423
|
-
|
|
1429
|
+
perfectionist: import_eslint_plugin_perfectionist.default
|
|
1424
1430
|
}
|
|
1425
1431
|
}
|
|
1426
1432
|
];
|
|
@@ -1445,13 +1451,12 @@ var VuePackages = [
|
|
|
1445
1451
|
];
|
|
1446
1452
|
function lincy(options = {}, ...userConfigs) {
|
|
1447
1453
|
const {
|
|
1448
|
-
|
|
1449
|
-
vue: enableVue = VuePackages.some((i) => (0, import_local_pkg2.isPackageExists)(i)),
|
|
1450
|
-
typescript: enableTypeScript = (0, import_local_pkg2.isPackageExists)("typescript"),
|
|
1454
|
+
componentExts = [],
|
|
1451
1455
|
gitignore: enableGitignore = true,
|
|
1452
|
-
|
|
1456
|
+
isInEditor = !!((import_node_process2.default.env.VSCODE_PID || import_node_process2.default.env.JETBRAINS_IDE) && !import_node_process2.default.env.CI),
|
|
1453
1457
|
overrides = {},
|
|
1454
|
-
|
|
1458
|
+
typescript: enableTypeScript = (0, import_local_pkg2.isPackageExists)("typescript"),
|
|
1459
|
+
vue: enableVue = VuePackages.some((i) => (0, import_local_pkg2.isPackageExists)(i))
|
|
1455
1460
|
} = options;
|
|
1456
1461
|
const stylisticOptions = options.stylistic === false ? false : typeof options.stylistic === "object" ? options.stylistic : {};
|
|
1457
1462
|
if (stylisticOptions && !("jsx" in stylisticOptions))
|
|
@@ -1481,10 +1486,10 @@ function lincy(options = {}, ...userConfigs) {
|
|
|
1481
1486
|
imports({
|
|
1482
1487
|
stylistic: stylisticOptions
|
|
1483
1488
|
}),
|
|
1484
|
-
unicorn()
|
|
1489
|
+
unicorn(),
|
|
1490
|
+
// Optional plugins (installed but not enabled by default)
|
|
1491
|
+
perfectionist()
|
|
1485
1492
|
);
|
|
1486
|
-
if (enableSortKeys)
|
|
1487
|
-
configs.push(sortKeys());
|
|
1488
1493
|
if (enableVue)
|
|
1489
1494
|
componentExts.push("vue");
|
|
1490
1495
|
if (enableTypeScript) {
|
|
@@ -1588,6 +1593,7 @@ var src_default = lincy;
|
|
|
1588
1593
|
parserTs,
|
|
1589
1594
|
parserVue,
|
|
1590
1595
|
parserYaml,
|
|
1596
|
+
perfectionist,
|
|
1591
1597
|
pluginAntfu,
|
|
1592
1598
|
pluginComments,
|
|
1593
1599
|
pluginImport,
|
|
@@ -1596,6 +1602,7 @@ var src_default = lincy;
|
|
|
1596
1602
|
pluginMarkdown,
|
|
1597
1603
|
pluginNoOnlyTests,
|
|
1598
1604
|
pluginNode,
|
|
1605
|
+
pluginPerfectionist,
|
|
1599
1606
|
pluginSortKeys,
|
|
1600
1607
|
pluginStylistic,
|
|
1601
1608
|
pluginTs,
|
|
@@ -1604,11 +1611,11 @@ var src_default = lincy;
|
|
|
1604
1611
|
pluginVue,
|
|
1605
1612
|
pluginYaml,
|
|
1606
1613
|
renameRules,
|
|
1607
|
-
sortKeys,
|
|
1608
1614
|
sortPackageJson,
|
|
1609
1615
|
sortTsconfig,
|
|
1610
1616
|
stylistic,
|
|
1611
1617
|
test,
|
|
1618
|
+
toArray,
|
|
1612
1619
|
typescript,
|
|
1613
1620
|
unicorn,
|
|
1614
1621
|
vue,
|
package/dist/index.d.cts
CHANGED
|
@@ -2,9 +2,14 @@ import { FlatGitignoreOptions } from 'eslint-config-flat-gitignore';
|
|
|
2
2
|
import { ParserOptions } from '@typescript-eslint/parser';
|
|
3
3
|
import * as parser from '@typescript-eslint/parser';
|
|
4
4
|
export { parser as parserTs };
|
|
5
|
-
import {
|
|
5
|
+
import { RuleConfig, MergeIntersection, RenamePrefix, VitestRules, YmlRules, NRules, Prefix, ImportRules, EslintRules, JsoncRules, VueRules, EslintCommentsRules, FlatESLintConfigItem } from '@antfu/eslint-define-config';
|
|
6
|
+
import { RuleOptions as RuleOptions$1 } from '@eslint-types/jsdoc/types';
|
|
7
|
+
import { RuleOptions } from '@eslint-types/typescript-eslint/types';
|
|
8
|
+
import { RuleOptions as RuleOptions$2 } from '@eslint-types/unicorn/types';
|
|
6
9
|
import { Rules as Rules$1 } from 'eslint-plugin-antfu';
|
|
7
10
|
export { default as pluginAntfu } from 'eslint-plugin-antfu';
|
|
11
|
+
import { UnprefixedRuleOptions } from '@stylistic/eslint-plugin';
|
|
12
|
+
export { default as pluginStylistic } from '@stylistic/eslint-plugin';
|
|
8
13
|
export { default as pluginComments } from 'eslint-plugin-eslint-comments';
|
|
9
14
|
import * as eslintPluginI from 'eslint-plugin-i';
|
|
10
15
|
export { eslintPluginI as pluginImport };
|
|
@@ -13,7 +18,6 @@ import * as eslintPluginJsonc from 'eslint-plugin-jsonc';
|
|
|
13
18
|
export { eslintPluginJsonc as pluginJsonc };
|
|
14
19
|
export { default as pluginMarkdown } from 'eslint-plugin-markdown';
|
|
15
20
|
export { default as pluginNode } from 'eslint-plugin-n';
|
|
16
|
-
export { default as pluginStylistic } from '@stylistic/eslint-plugin';
|
|
17
21
|
export { default as pluginTs } from '@typescript-eslint/eslint-plugin';
|
|
18
22
|
export { default as pluginUnicorn } from 'eslint-plugin-unicorn';
|
|
19
23
|
export { default as pluginUnusedImports } from 'eslint-plugin-unused-imports';
|
|
@@ -22,16 +26,19 @@ import * as eslintPluginYml from 'eslint-plugin-yml';
|
|
|
22
26
|
export { eslintPluginYml as pluginYaml };
|
|
23
27
|
export { default as pluginNoOnlyTests } from 'eslint-plugin-no-only-tests';
|
|
24
28
|
export { default as pluginSortKeys } from 'eslint-plugin-sort-keys';
|
|
29
|
+
export { default as pluginPerfectionist } from 'eslint-plugin-perfectionist';
|
|
25
30
|
export { default as parserVue } from 'vue-eslint-parser';
|
|
26
31
|
export { default as parserYaml } from 'yaml-eslint-parser';
|
|
27
32
|
export { default as parserJsonc } from 'jsonc-eslint-parser';
|
|
28
33
|
|
|
29
|
-
type
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
34
|
+
type WrapRuleConfig<T extends {
|
|
35
|
+
[key: string]: any;
|
|
36
|
+
}> = {
|
|
37
|
+
[K in keyof T]: T[K] extends RuleConfig ? T[K] : RuleConfig<T[K]>;
|
|
38
|
+
};
|
|
39
|
+
type Rules = WrapRuleConfig<MergeIntersection<RenamePrefix<RuleOptions, '@typescript-eslint/', 'ts/'> & RenamePrefix<VitestRules, 'vitest/', 'test/'> & RenamePrefix<YmlRules, 'yml/', 'yaml/'> & RenamePrefix<NRules, 'n/', 'node/'> & Prefix<UnprefixedRuleOptions, 'style/'> & Prefix<Rules$1, 'antfu/'> & RuleOptions$1 & ImportRules & EslintRules & JsoncRules & VueRules & RuleOptions$2 & EslintCommentsRules & {
|
|
33
40
|
'test/no-only-tests': RuleConfig<[]>;
|
|
34
|
-
}
|
|
41
|
+
}>>;
|
|
35
42
|
type ConfigItem = Omit<FlatESLintConfigItem<Rules, false>, 'plugins'> & {
|
|
36
43
|
/**
|
|
37
44
|
* Custom name of each config item
|
|
@@ -64,7 +71,7 @@ interface OptionsTypeScriptWithTypes {
|
|
|
64
71
|
* When this options is provided, type aware rules will be enabled.
|
|
65
72
|
* @see https://typescript-eslint.io/linting/typed-linting/
|
|
66
73
|
*/
|
|
67
|
-
tsconfigPath?: string;
|
|
74
|
+
tsconfigPath?: string | string[];
|
|
68
75
|
}
|
|
69
76
|
interface OptionsHasTypeScript {
|
|
70
77
|
typescript?: boolean;
|
|
@@ -145,12 +152,6 @@ interface OptionsConfig extends OptionsComponentExts {
|
|
|
145
152
|
* @default true
|
|
146
153
|
*/
|
|
147
154
|
markdown?: boolean;
|
|
148
|
-
/**
|
|
149
|
-
* Enable SortKeys support.
|
|
150
|
-
*
|
|
151
|
-
* @default false
|
|
152
|
-
*/
|
|
153
|
-
sortKeys?: boolean;
|
|
154
155
|
/**
|
|
155
156
|
* Enable stylistic rules.
|
|
156
157
|
*
|
|
@@ -225,11 +226,11 @@ declare function yaml(options?: OptionsOverrides & OptionsStylistic): ConfigItem
|
|
|
225
226
|
declare function test(options?: OptionsIsInEditor & OptionsOverrides): ConfigItem[];
|
|
226
227
|
|
|
227
228
|
/**
|
|
228
|
-
* Optional
|
|
229
|
+
* Optional perfectionist plugin for props and items sorting.
|
|
229
230
|
*
|
|
230
|
-
* @see https://github.com/
|
|
231
|
+
* @see https://github.com/azat-io/eslint-plugin-perfectionist
|
|
231
232
|
*/
|
|
232
|
-
declare function
|
|
233
|
+
declare function perfectionist(): ConfigItem[];
|
|
233
234
|
|
|
234
235
|
/**
|
|
235
236
|
* Combine array and non-array configs into a single array.
|
|
@@ -238,6 +239,7 @@ declare function combine(...configs: (ConfigItem | ConfigItem[])[]): ConfigItem[
|
|
|
238
239
|
declare function renameRules(rules: Record<string, any>, from: string, to: string): {
|
|
239
240
|
[k: string]: any;
|
|
240
241
|
};
|
|
242
|
+
declare function toArray<T>(value: T | T[]): T[];
|
|
241
243
|
|
|
242
244
|
declare const GLOB_SRC_EXT = "?([cm])[jt]s?(x)";
|
|
243
245
|
declare const GLOB_SRC = "**/*.?([cm])[jt]s?(x)";
|
|
@@ -261,4 +263,4 @@ declare const GLOB_TESTS: string[];
|
|
|
261
263
|
declare const GLOB_ALL_SRC: string[];
|
|
262
264
|
declare const GLOB_EXCLUDE: string[];
|
|
263
265
|
|
|
264
|
-
export { ConfigItem, GLOB_ALL_SRC, GLOB_CSS, GLOB_EXCLUDE, GLOB_HTML, GLOB_JS, GLOB_JSON, GLOB_JSON5, GLOB_JSONC, GLOB_JSX, GLOB_LESS, GLOB_MARKDOWN, GLOB_MARKDOWN_CODE, GLOB_SCSS, GLOB_SRC, GLOB_SRC_EXT, GLOB_STYLE, GLOB_TESTS, GLOB_TS, GLOB_TSX, GLOB_VUE, GLOB_YAML, OptionsComponentExts, OptionsConfig, OptionsHasTypeScript, OptionsIgnores, OptionsIsInEditor, OptionsOverrides, OptionsStylistic, OptionsTypeScriptParserOptions, OptionsTypeScriptWithTypes, Rules, StylisticConfig, StylisticOverridesConfig, combine, comments, lincy as default, ignores, imports, javascript, jsdoc, jsonc, lincy, markdown, node,
|
|
266
|
+
export { ConfigItem, GLOB_ALL_SRC, GLOB_CSS, GLOB_EXCLUDE, GLOB_HTML, GLOB_JS, GLOB_JSON, GLOB_JSON5, GLOB_JSONC, GLOB_JSX, GLOB_LESS, GLOB_MARKDOWN, GLOB_MARKDOWN_CODE, GLOB_SCSS, GLOB_SRC, GLOB_SRC_EXT, GLOB_STYLE, GLOB_TESTS, GLOB_TS, GLOB_TSX, GLOB_VUE, GLOB_YAML, OptionsComponentExts, OptionsConfig, OptionsHasTypeScript, OptionsIgnores, OptionsIsInEditor, OptionsOverrides, OptionsStylistic, OptionsTypeScriptParserOptions, OptionsTypeScriptWithTypes, Rules, StylisticConfig, StylisticOverridesConfig, WrapRuleConfig, combine, comments, lincy as default, ignores, imports, javascript, jsdoc, jsonc, lincy, markdown, node, perfectionist, renameRules, sortPackageJson, sortTsconfig, stylistic, test, toArray, typescript, unicorn, vue, yaml };
|
package/dist/index.d.ts
CHANGED
|
@@ -2,9 +2,14 @@ import { FlatGitignoreOptions } from 'eslint-config-flat-gitignore';
|
|
|
2
2
|
import { ParserOptions } from '@typescript-eslint/parser';
|
|
3
3
|
import * as parser from '@typescript-eslint/parser';
|
|
4
4
|
export { parser as parserTs };
|
|
5
|
-
import {
|
|
5
|
+
import { RuleConfig, MergeIntersection, RenamePrefix, VitestRules, YmlRules, NRules, Prefix, ImportRules, EslintRules, JsoncRules, VueRules, EslintCommentsRules, FlatESLintConfigItem } from '@antfu/eslint-define-config';
|
|
6
|
+
import { RuleOptions as RuleOptions$1 } from '@eslint-types/jsdoc/types';
|
|
7
|
+
import { RuleOptions } from '@eslint-types/typescript-eslint/types';
|
|
8
|
+
import { RuleOptions as RuleOptions$2 } from '@eslint-types/unicorn/types';
|
|
6
9
|
import { Rules as Rules$1 } from 'eslint-plugin-antfu';
|
|
7
10
|
export { default as pluginAntfu } from 'eslint-plugin-antfu';
|
|
11
|
+
import { UnprefixedRuleOptions } from '@stylistic/eslint-plugin';
|
|
12
|
+
export { default as pluginStylistic } from '@stylistic/eslint-plugin';
|
|
8
13
|
export { default as pluginComments } from 'eslint-plugin-eslint-comments';
|
|
9
14
|
import * as eslintPluginI from 'eslint-plugin-i';
|
|
10
15
|
export { eslintPluginI as pluginImport };
|
|
@@ -13,7 +18,6 @@ import * as eslintPluginJsonc from 'eslint-plugin-jsonc';
|
|
|
13
18
|
export { eslintPluginJsonc as pluginJsonc };
|
|
14
19
|
export { default as pluginMarkdown } from 'eslint-plugin-markdown';
|
|
15
20
|
export { default as pluginNode } from 'eslint-plugin-n';
|
|
16
|
-
export { default as pluginStylistic } from '@stylistic/eslint-plugin';
|
|
17
21
|
export { default as pluginTs } from '@typescript-eslint/eslint-plugin';
|
|
18
22
|
export { default as pluginUnicorn } from 'eslint-plugin-unicorn';
|
|
19
23
|
export { default as pluginUnusedImports } from 'eslint-plugin-unused-imports';
|
|
@@ -22,16 +26,19 @@ import * as eslintPluginYml from 'eslint-plugin-yml';
|
|
|
22
26
|
export { eslintPluginYml as pluginYaml };
|
|
23
27
|
export { default as pluginNoOnlyTests } from 'eslint-plugin-no-only-tests';
|
|
24
28
|
export { default as pluginSortKeys } from 'eslint-plugin-sort-keys';
|
|
29
|
+
export { default as pluginPerfectionist } from 'eslint-plugin-perfectionist';
|
|
25
30
|
export { default as parserVue } from 'vue-eslint-parser';
|
|
26
31
|
export { default as parserYaml } from 'yaml-eslint-parser';
|
|
27
32
|
export { default as parserJsonc } from 'jsonc-eslint-parser';
|
|
28
33
|
|
|
29
|
-
type
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
34
|
+
type WrapRuleConfig<T extends {
|
|
35
|
+
[key: string]: any;
|
|
36
|
+
}> = {
|
|
37
|
+
[K in keyof T]: T[K] extends RuleConfig ? T[K] : RuleConfig<T[K]>;
|
|
38
|
+
};
|
|
39
|
+
type Rules = WrapRuleConfig<MergeIntersection<RenamePrefix<RuleOptions, '@typescript-eslint/', 'ts/'> & RenamePrefix<VitestRules, 'vitest/', 'test/'> & RenamePrefix<YmlRules, 'yml/', 'yaml/'> & RenamePrefix<NRules, 'n/', 'node/'> & Prefix<UnprefixedRuleOptions, 'style/'> & Prefix<Rules$1, 'antfu/'> & RuleOptions$1 & ImportRules & EslintRules & JsoncRules & VueRules & RuleOptions$2 & EslintCommentsRules & {
|
|
33
40
|
'test/no-only-tests': RuleConfig<[]>;
|
|
34
|
-
}
|
|
41
|
+
}>>;
|
|
35
42
|
type ConfigItem = Omit<FlatESLintConfigItem<Rules, false>, 'plugins'> & {
|
|
36
43
|
/**
|
|
37
44
|
* Custom name of each config item
|
|
@@ -64,7 +71,7 @@ interface OptionsTypeScriptWithTypes {
|
|
|
64
71
|
* When this options is provided, type aware rules will be enabled.
|
|
65
72
|
* @see https://typescript-eslint.io/linting/typed-linting/
|
|
66
73
|
*/
|
|
67
|
-
tsconfigPath?: string;
|
|
74
|
+
tsconfigPath?: string | string[];
|
|
68
75
|
}
|
|
69
76
|
interface OptionsHasTypeScript {
|
|
70
77
|
typescript?: boolean;
|
|
@@ -145,12 +152,6 @@ interface OptionsConfig extends OptionsComponentExts {
|
|
|
145
152
|
* @default true
|
|
146
153
|
*/
|
|
147
154
|
markdown?: boolean;
|
|
148
|
-
/**
|
|
149
|
-
* Enable SortKeys support.
|
|
150
|
-
*
|
|
151
|
-
* @default false
|
|
152
|
-
*/
|
|
153
|
-
sortKeys?: boolean;
|
|
154
155
|
/**
|
|
155
156
|
* Enable stylistic rules.
|
|
156
157
|
*
|
|
@@ -225,11 +226,11 @@ declare function yaml(options?: OptionsOverrides & OptionsStylistic): ConfigItem
|
|
|
225
226
|
declare function test(options?: OptionsIsInEditor & OptionsOverrides): ConfigItem[];
|
|
226
227
|
|
|
227
228
|
/**
|
|
228
|
-
* Optional
|
|
229
|
+
* Optional perfectionist plugin for props and items sorting.
|
|
229
230
|
*
|
|
230
|
-
* @see https://github.com/
|
|
231
|
+
* @see https://github.com/azat-io/eslint-plugin-perfectionist
|
|
231
232
|
*/
|
|
232
|
-
declare function
|
|
233
|
+
declare function perfectionist(): ConfigItem[];
|
|
233
234
|
|
|
234
235
|
/**
|
|
235
236
|
* Combine array and non-array configs into a single array.
|
|
@@ -238,6 +239,7 @@ declare function combine(...configs: (ConfigItem | ConfigItem[])[]): ConfigItem[
|
|
|
238
239
|
declare function renameRules(rules: Record<string, any>, from: string, to: string): {
|
|
239
240
|
[k: string]: any;
|
|
240
241
|
};
|
|
242
|
+
declare function toArray<T>(value: T | T[]): T[];
|
|
241
243
|
|
|
242
244
|
declare const GLOB_SRC_EXT = "?([cm])[jt]s?(x)";
|
|
243
245
|
declare const GLOB_SRC = "**/*.?([cm])[jt]s?(x)";
|
|
@@ -261,4 +263,4 @@ declare const GLOB_TESTS: string[];
|
|
|
261
263
|
declare const GLOB_ALL_SRC: string[];
|
|
262
264
|
declare const GLOB_EXCLUDE: string[];
|
|
263
265
|
|
|
264
|
-
export { ConfigItem, GLOB_ALL_SRC, GLOB_CSS, GLOB_EXCLUDE, GLOB_HTML, GLOB_JS, GLOB_JSON, GLOB_JSON5, GLOB_JSONC, GLOB_JSX, GLOB_LESS, GLOB_MARKDOWN, GLOB_MARKDOWN_CODE, GLOB_SCSS, GLOB_SRC, GLOB_SRC_EXT, GLOB_STYLE, GLOB_TESTS, GLOB_TS, GLOB_TSX, GLOB_VUE, GLOB_YAML, OptionsComponentExts, OptionsConfig, OptionsHasTypeScript, OptionsIgnores, OptionsIsInEditor, OptionsOverrides, OptionsStylistic, OptionsTypeScriptParserOptions, OptionsTypeScriptWithTypes, Rules, StylisticConfig, StylisticOverridesConfig, combine, comments, lincy as default, ignores, imports, javascript, jsdoc, jsonc, lincy, markdown, node,
|
|
266
|
+
export { ConfigItem, GLOB_ALL_SRC, GLOB_CSS, GLOB_EXCLUDE, GLOB_HTML, GLOB_JS, GLOB_JSON, GLOB_JSON5, GLOB_JSONC, GLOB_JSX, GLOB_LESS, GLOB_MARKDOWN, GLOB_MARKDOWN_CODE, GLOB_SCSS, GLOB_SRC, GLOB_SRC_EXT, GLOB_STYLE, GLOB_TESTS, GLOB_TS, GLOB_TSX, GLOB_VUE, GLOB_YAML, OptionsComponentExts, OptionsConfig, OptionsHasTypeScript, OptionsIgnores, OptionsIsInEditor, OptionsOverrides, OptionsStylistic, OptionsTypeScriptParserOptions, OptionsTypeScriptWithTypes, Rules, StylisticConfig, StylisticOverridesConfig, WrapRuleConfig, combine, comments, lincy as default, ignores, imports, javascript, jsdoc, jsonc, lincy, markdown, node, perfectionist, renameRules, sortPackageJson, sortTsconfig, stylistic, test, toArray, typescript, unicorn, vue, yaml };
|
package/dist/index.js
CHANGED
|
@@ -20,10 +20,11 @@ import { default as default11 } from "eslint-plugin-vue";
|
|
|
20
20
|
import * as pluginYaml from "eslint-plugin-yml";
|
|
21
21
|
import { default as default12 } from "eslint-plugin-no-only-tests";
|
|
22
22
|
import { default as default13 } from "eslint-plugin-sort-keys";
|
|
23
|
+
import { default as default14 } from "eslint-plugin-perfectionist";
|
|
23
24
|
import * as parserTs from "@typescript-eslint/parser";
|
|
24
|
-
import { default as
|
|
25
|
-
import { default as
|
|
26
|
-
import { default as
|
|
25
|
+
import { default as default15 } from "vue-eslint-parser";
|
|
26
|
+
import { default as default16 } from "yaml-eslint-parser";
|
|
27
|
+
import { default as default17 } from "jsonc-eslint-parser";
|
|
27
28
|
|
|
28
29
|
// src/configs/comments.ts
|
|
29
30
|
function comments() {
|
|
@@ -184,7 +185,6 @@ function javascript(options = {}) {
|
|
|
184
185
|
"accessor-pairs": ["error", { enforceForClassMembers: true, setWithoutGet: true }],
|
|
185
186
|
"antfu/top-level-function": "error",
|
|
186
187
|
"array-callback-return": "error",
|
|
187
|
-
"arrow-parens": ["error", "as-needed", { requireForBlockBody: true }],
|
|
188
188
|
"block-scoped-var": "error",
|
|
189
189
|
"constructor-super": "error",
|
|
190
190
|
"default-case-last": "error",
|
|
@@ -343,6 +343,7 @@ function javascript(options = {}) {
|
|
|
343
343
|
memberSyntaxSortOrder: ["none", "all", "multiple", "single"]
|
|
344
344
|
}
|
|
345
345
|
],
|
|
346
|
+
"style/arrow-parens": ["error", "as-needed", { requireForBlockBody: true }],
|
|
346
347
|
"symbol-description": "error",
|
|
347
348
|
"unicode-bom": ["error", "never"],
|
|
348
349
|
"unused-imports/no-unused-imports": isInEditor ? "off" : "error",
|
|
@@ -404,8 +405,8 @@ function jsdoc(options = {}) {
|
|
|
404
405
|
// src/configs/jsonc.ts
|
|
405
406
|
function jsonc(options = {}) {
|
|
406
407
|
const {
|
|
407
|
-
|
|
408
|
-
|
|
408
|
+
overrides = {},
|
|
409
|
+
stylistic: stylistic2 = true
|
|
409
410
|
} = options;
|
|
410
411
|
return [
|
|
411
412
|
{
|
|
@@ -416,7 +417,7 @@ function jsonc(options = {}) {
|
|
|
416
417
|
{
|
|
417
418
|
files: [GLOB_JSON, GLOB_JSON5, GLOB_JSONC],
|
|
418
419
|
languageOptions: {
|
|
419
|
-
parser:
|
|
420
|
+
parser: default17
|
|
420
421
|
},
|
|
421
422
|
rules: {
|
|
422
423
|
"jsonc/no-bigint-literals": "error",
|
|
@@ -780,8 +781,8 @@ function stylistic(options = {}) {
|
|
|
780
781
|
} = options;
|
|
781
782
|
const {
|
|
782
783
|
indent = 4,
|
|
783
|
-
|
|
784
|
-
|
|
784
|
+
jsx = true,
|
|
785
|
+
quotes = "single"
|
|
785
786
|
} = typeof stylistic2 === "boolean" ? {} : stylistic2;
|
|
786
787
|
return [
|
|
787
788
|
{
|
|
@@ -807,14 +808,9 @@ function stylistic(options = {}) {
|
|
|
807
808
|
"style/indent": ["error", indent, {
|
|
808
809
|
ArrayExpression: 1,
|
|
809
810
|
CallExpression: { arguments: 1 },
|
|
811
|
+
flatTernaryExpressions: false,
|
|
810
812
|
FunctionDeclaration: { body: 1, parameters: 1 },
|
|
811
813
|
FunctionExpression: { body: 1, parameters: 1 },
|
|
812
|
-
ImportDeclaration: 1,
|
|
813
|
-
MemberExpression: 1,
|
|
814
|
-
ObjectExpression: 1,
|
|
815
|
-
SwitchCase: 1,
|
|
816
|
-
VariableDeclarator: 1,
|
|
817
|
-
flatTernaryExpressions: false,
|
|
818
814
|
ignoreComments: false,
|
|
819
815
|
ignoredNodes: [
|
|
820
816
|
"TemplateLiteral *",
|
|
@@ -839,8 +835,13 @@ function stylistic(options = {}) {
|
|
|
839
835
|
"FunctionExpression > .params > :matches(Decorator, :not(:first-child))",
|
|
840
836
|
"ClassBody.body > PropertyDefinition[decorators.length > 0] > .key"
|
|
841
837
|
],
|
|
838
|
+
ImportDeclaration: 1,
|
|
839
|
+
MemberExpression: 1,
|
|
840
|
+
ObjectExpression: 1,
|
|
842
841
|
offsetTernaryExpressions: true,
|
|
843
|
-
outerIIFEBody: 1
|
|
842
|
+
outerIIFEBody: 1,
|
|
843
|
+
SwitchCase: 1,
|
|
844
|
+
VariableDeclarator: 1
|
|
844
845
|
}],
|
|
845
846
|
"style/key-spacing": ["error", { afterColon: true, beforeColon: false }],
|
|
846
847
|
"style/keyword-spacing": ["error", { after: true, before: true }],
|
|
@@ -936,7 +937,7 @@ import process from "process";
|
|
|
936
937
|
|
|
937
938
|
// src/utils.ts
|
|
938
939
|
function combine(...configs) {
|
|
939
|
-
return configs.
|
|
940
|
+
return configs.flat();
|
|
940
941
|
}
|
|
941
942
|
function renameRules(rules, from, to) {
|
|
942
943
|
return Object.fromEntries(
|
|
@@ -947,14 +948,16 @@ function renameRules(rules, from, to) {
|
|
|
947
948
|
})
|
|
948
949
|
);
|
|
949
950
|
}
|
|
951
|
+
function toArray(value) {
|
|
952
|
+
return Array.isArray(value) ? value : [value];
|
|
953
|
+
}
|
|
950
954
|
|
|
951
955
|
// src/configs/typescript.ts
|
|
952
956
|
function typescript(options) {
|
|
953
957
|
const {
|
|
954
958
|
componentExts = [],
|
|
955
959
|
overrides = {},
|
|
956
|
-
parserOptions = {}
|
|
957
|
-
tsconfigPath
|
|
960
|
+
parserOptions = {}
|
|
958
961
|
} = options ?? {};
|
|
959
962
|
const typeAwareRules = {
|
|
960
963
|
"dot-notation": "off",
|
|
@@ -977,6 +980,7 @@ function typescript(options) {
|
|
|
977
980
|
"ts/restrict-template-expressions": "error",
|
|
978
981
|
"ts/unbound-method": "error"
|
|
979
982
|
};
|
|
983
|
+
const tsconfigPath = options?.tsconfigPath ? toArray(options.tsconfigPath) : void 0;
|
|
980
984
|
return [
|
|
981
985
|
{
|
|
982
986
|
// Install the plugins without globs, so they can be configured separately.
|
|
@@ -997,7 +1001,7 @@ function typescript(options) {
|
|
|
997
1001
|
extraFileExtensions: componentExts.map((ext) => `.${ext}`),
|
|
998
1002
|
sourceType: "module",
|
|
999
1003
|
...tsconfigPath ? {
|
|
1000
|
-
project:
|
|
1004
|
+
project: tsconfigPath,
|
|
1001
1005
|
tsconfigRootDir: process.cwd()
|
|
1002
1006
|
} : {},
|
|
1003
1007
|
...parserOptions
|
|
@@ -1139,7 +1143,7 @@ function vue(options = {}) {
|
|
|
1139
1143
|
{
|
|
1140
1144
|
files: [GLOB_VUE],
|
|
1141
1145
|
languageOptions: {
|
|
1142
|
-
parser:
|
|
1146
|
+
parser: default15,
|
|
1143
1147
|
parserOptions: {
|
|
1144
1148
|
ecmaFeatures: {
|
|
1145
1149
|
jsx: true
|
|
@@ -1267,7 +1271,7 @@ function yaml(options = {}) {
|
|
|
1267
1271
|
{
|
|
1268
1272
|
files: [GLOB_YAML],
|
|
1269
1273
|
languageOptions: {
|
|
1270
|
-
parser:
|
|
1274
|
+
parser: default16
|
|
1271
1275
|
},
|
|
1272
1276
|
rules: {
|
|
1273
1277
|
"style/spaced-comment": "off",
|
|
@@ -1319,12 +1323,12 @@ function test(options = {}) {
|
|
|
1319
1323
|
];
|
|
1320
1324
|
}
|
|
1321
1325
|
|
|
1322
|
-
// src/configs/
|
|
1323
|
-
function
|
|
1326
|
+
// src/configs/perfectionist.ts
|
|
1327
|
+
function perfectionist() {
|
|
1324
1328
|
return [
|
|
1325
1329
|
{
|
|
1326
1330
|
plugins: {
|
|
1327
|
-
|
|
1331
|
+
perfectionist: default14
|
|
1328
1332
|
}
|
|
1329
1333
|
}
|
|
1330
1334
|
];
|
|
@@ -1349,13 +1353,12 @@ var VuePackages = [
|
|
|
1349
1353
|
];
|
|
1350
1354
|
function lincy(options = {}, ...userConfigs) {
|
|
1351
1355
|
const {
|
|
1352
|
-
|
|
1353
|
-
vue: enableVue = VuePackages.some((i) => isPackageExists(i)),
|
|
1354
|
-
typescript: enableTypeScript = isPackageExists("typescript"),
|
|
1356
|
+
componentExts = [],
|
|
1355
1357
|
gitignore: enableGitignore = true,
|
|
1356
|
-
|
|
1358
|
+
isInEditor = !!((process2.env.VSCODE_PID || process2.env.JETBRAINS_IDE) && !process2.env.CI),
|
|
1357
1359
|
overrides = {},
|
|
1358
|
-
|
|
1360
|
+
typescript: enableTypeScript = isPackageExists("typescript"),
|
|
1361
|
+
vue: enableVue = VuePackages.some((i) => isPackageExists(i))
|
|
1359
1362
|
} = options;
|
|
1360
1363
|
const stylisticOptions = options.stylistic === false ? false : typeof options.stylistic === "object" ? options.stylistic : {};
|
|
1361
1364
|
if (stylisticOptions && !("jsx" in stylisticOptions))
|
|
@@ -1385,10 +1388,10 @@ function lincy(options = {}, ...userConfigs) {
|
|
|
1385
1388
|
imports({
|
|
1386
1389
|
stylistic: stylisticOptions
|
|
1387
1390
|
}),
|
|
1388
|
-
unicorn()
|
|
1391
|
+
unicorn(),
|
|
1392
|
+
// Optional plugins (installed but not enabled by default)
|
|
1393
|
+
perfectionist()
|
|
1389
1394
|
);
|
|
1390
|
-
if (enableSortKeys)
|
|
1391
|
-
configs.push(sortKeys());
|
|
1392
1395
|
if (enableVue)
|
|
1393
1396
|
componentExts.push("vue");
|
|
1394
1397
|
if (enableTypeScript) {
|
|
@@ -1488,10 +1491,11 @@ export {
|
|
|
1488
1491
|
lincy,
|
|
1489
1492
|
markdown,
|
|
1490
1493
|
node,
|
|
1491
|
-
|
|
1494
|
+
default17 as parserJsonc,
|
|
1492
1495
|
parserTs,
|
|
1493
|
-
|
|
1494
|
-
|
|
1496
|
+
default15 as parserVue,
|
|
1497
|
+
default16 as parserYaml,
|
|
1498
|
+
perfectionist,
|
|
1495
1499
|
default2 as pluginAntfu,
|
|
1496
1500
|
default3 as pluginComments,
|
|
1497
1501
|
pluginImport,
|
|
@@ -1500,6 +1504,7 @@ export {
|
|
|
1500
1504
|
default5 as pluginMarkdown,
|
|
1501
1505
|
default12 as pluginNoOnlyTests,
|
|
1502
1506
|
default6 as pluginNode,
|
|
1507
|
+
default14 as pluginPerfectionist,
|
|
1503
1508
|
default13 as pluginSortKeys,
|
|
1504
1509
|
default7 as pluginStylistic,
|
|
1505
1510
|
default8 as pluginTs,
|
|
@@ -1508,11 +1513,11 @@ export {
|
|
|
1508
1513
|
default11 as pluginVue,
|
|
1509
1514
|
pluginYaml,
|
|
1510
1515
|
renameRules,
|
|
1511
|
-
sortKeys,
|
|
1512
1516
|
sortPackageJson,
|
|
1513
1517
|
sortTsconfig,
|
|
1514
1518
|
stylistic,
|
|
1515
1519
|
test,
|
|
1520
|
+
toArray,
|
|
1516
1521
|
typescript,
|
|
1517
1522
|
unicorn,
|
|
1518
1523
|
vue,
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lincy/eslint-config",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "3.
|
|
4
|
+
"version": "3.7.0",
|
|
5
5
|
"packageManager": "pnpm@8.7.6",
|
|
6
6
|
"description": "LinCenYing's ESLint config",
|
|
7
7
|
"author": "LinCenYing <lincenying@gmail.com> (https://github.com/lincenying/)",
|
|
@@ -26,13 +26,13 @@
|
|
|
26
26
|
"scripts": {
|
|
27
27
|
"build": "tsup src/index.ts --format esm,cjs --shims --clean --dts",
|
|
28
28
|
"stub": "tsup src/index.ts --format esm",
|
|
29
|
-
"lint": "pnpm run stub && eslint .",
|
|
30
|
-
"lint:fix": "eslint . --fix",
|
|
31
29
|
"postpublish": "simple-open-url https://npmmirror.com/package/@lincy/eslint-config",
|
|
32
30
|
"prepublishOnly": "nr build",
|
|
33
31
|
"release": "bumpp && npm publish -r --access public",
|
|
34
32
|
"test": "vitest",
|
|
35
|
-
"
|
|
33
|
+
"lint": "pnpm run stub && eslint .",
|
|
34
|
+
"lint:fix": "eslint . --fix",
|
|
35
|
+
"lint:ts": "tsc --noEmit",
|
|
36
36
|
"prepare": "sh simple-git-hooks.sh"
|
|
37
37
|
},
|
|
38
38
|
"peerDependencies": {
|
|
@@ -40,22 +40,23 @@
|
|
|
40
40
|
},
|
|
41
41
|
"dependencies": {
|
|
42
42
|
"@antfu/eslint-define-config": "1.23.0-2",
|
|
43
|
-
"@stylistic/eslint-plugin": "
|
|
44
|
-
"@typescript-eslint/eslint-plugin": "^6.
|
|
45
|
-
"@typescript-eslint/parser": "^6.
|
|
43
|
+
"@stylistic/eslint-plugin": "1.2.0",
|
|
44
|
+
"@typescript-eslint/eslint-plugin": "^6.11.0",
|
|
45
|
+
"@typescript-eslint/parser": "^6.11.0",
|
|
46
46
|
"eslint-config-flat-gitignore": "^0.1.1",
|
|
47
|
-
"eslint-plugin-antfu": "^1.0.
|
|
47
|
+
"eslint-plugin-antfu": "^1.0.2",
|
|
48
48
|
"eslint-plugin-eslint-comments": "^3.2.0",
|
|
49
49
|
"eslint-plugin-i": "^2.29.0",
|
|
50
|
-
"eslint-plugin-jsdoc": "^46.
|
|
50
|
+
"eslint-plugin-jsdoc": "^46.9.0",
|
|
51
51
|
"eslint-plugin-jsonc": "^2.10.0",
|
|
52
52
|
"eslint-plugin-markdown": "^3.0.1",
|
|
53
|
-
"eslint-plugin-n": "^16.
|
|
53
|
+
"eslint-plugin-n": "^16.3.1",
|
|
54
54
|
"eslint-plugin-no-only-tests": "^3.1.0",
|
|
55
|
+
"eslint-plugin-perfectionist": "^2.3.0",
|
|
55
56
|
"eslint-plugin-sort-keys": "^2.3.5",
|
|
56
57
|
"eslint-plugin-unicorn": "^49.0.0",
|
|
57
58
|
"eslint-plugin-unused-imports": "^3.0.0",
|
|
58
|
-
"eslint-plugin-vitest": "^0.3.
|
|
59
|
+
"eslint-plugin-vitest": "^0.3.9",
|
|
59
60
|
"eslint-plugin-vue": "^9.18.1",
|
|
60
61
|
"eslint-plugin-yml": "^1.10.0",
|
|
61
62
|
"globals": "^13.23.0",
|
|
@@ -65,16 +66,19 @@
|
|
|
65
66
|
"yaml-eslint-parser": "^1.2.2"
|
|
66
67
|
},
|
|
67
68
|
"devDependencies": {
|
|
68
|
-
"@antfu/ni": "^0.21.
|
|
69
|
+
"@antfu/ni": "^0.21.9",
|
|
70
|
+
"@eslint-types/jsdoc": "46.8.2-1",
|
|
71
|
+
"@eslint-types/typescript-eslint": "^6.9.1",
|
|
72
|
+
"@eslint-types/unicorn": "^49.0.0",
|
|
69
73
|
"@lincy/eslint-config": "workspace:*",
|
|
70
|
-
"@stylistic/eslint-plugin-migrate": "^
|
|
71
|
-
"@types/eslint": "^8.44.
|
|
72
|
-
"@types/node": "^20.
|
|
74
|
+
"@stylistic/eslint-plugin-migrate": "^1.2.0",
|
|
75
|
+
"@types/eslint": "^8.44.7",
|
|
76
|
+
"@types/node": "^20.9.0",
|
|
73
77
|
"bumpp": "^9.2.0",
|
|
74
|
-
"eslint": "^8.
|
|
75
|
-
"eslint-flat-config-viewer": "^0.1.
|
|
76
|
-
"esno": "^0.
|
|
77
|
-
"lint-staged": "^15.0
|
|
78
|
+
"eslint": "^8.53.0",
|
|
79
|
+
"eslint-flat-config-viewer": "^0.1.1",
|
|
80
|
+
"esno": "^4.0.0",
|
|
81
|
+
"lint-staged": "^15.1.0",
|
|
78
82
|
"rimraf": "^5.0.5",
|
|
79
83
|
"simple-git-hooks": "^2.9.0",
|
|
80
84
|
"simple-open-url": "^3.0.1",
|