@lincy/eslint-config 5.4.2 → 5.5.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 +4 -2
- package/dist/index.cjs +72 -8
- package/dist/index.d.cts +1232 -316
- package/dist/index.d.ts +1232 -316
- package/dist/index.js +70 -7
- package/package.json +36 -38
package/README.md
CHANGED
|
@@ -10,6 +10,8 @@
|
|
|
10
10
|
- 也适用于 json、yaml、markdown
|
|
11
11
|
- import导入排序, 对象字⾯量项尾逗号
|
|
12
12
|
- 合理的默认值,最佳实践,只需一行配置
|
|
13
|
+
- .gitignore默认支持
|
|
14
|
+
- 需要 ESLint v9.5.0+
|
|
13
15
|
- [ESLint Flat config](https://eslint.org/docs/latest/use/configure/configuration-files-new)
|
|
14
16
|
- 使用 [ESLint Stylistic](https://github.com/eslint-stylistic/eslint-stylistic)
|
|
15
17
|
- **风格原则**: 读取最小,差异稳定
|
|
@@ -25,7 +27,7 @@ pnpm add -D eslint @lincy/eslint-config
|
|
|
25
27
|
### Create config file
|
|
26
28
|
|
|
27
29
|
```js
|
|
28
|
-
// eslint.config.
|
|
30
|
+
// eslint.config.mjs
|
|
29
31
|
import lincy from '@lincy/eslint-config'
|
|
30
32
|
|
|
31
33
|
export default lincy()
|
|
@@ -110,7 +112,7 @@ export default lincy()
|
|
|
110
112
|
如果 package.json 中开启了`"type": "module",`
|
|
111
113
|
|
|
112
114
|
```js
|
|
113
|
-
// eslint.config.
|
|
115
|
+
// eslint.config.mjs
|
|
114
116
|
import lincy from '@lincy/eslint-config'
|
|
115
117
|
|
|
116
118
|
// or
|
package/dist/index.cjs
CHANGED
|
@@ -82,6 +82,7 @@ __export(index_exports, {
|
|
|
82
82
|
node: () => node,
|
|
83
83
|
parserPlain: () => parserPlain,
|
|
84
84
|
perfectionist: () => perfectionist,
|
|
85
|
+
pnpm: () => pnpm,
|
|
85
86
|
react: () => react,
|
|
86
87
|
regexp: () => regexp,
|
|
87
88
|
renamePluginInConfigs: () => renamePluginInConfigs,
|
|
@@ -101,7 +102,7 @@ __export(index_exports, {
|
|
|
101
102
|
});
|
|
102
103
|
module.exports = __toCommonJS(index_exports);
|
|
103
104
|
|
|
104
|
-
// node_modules/.pnpm/tsup@8.
|
|
105
|
+
// node_modules/.pnpm/tsup@8.4.0_jiti@2.4.2_postcss@8.4.49_tsx@4.19.3_typescript@5.8.2_yaml@2.7.0/node_modules/tsup/assets/cjs_shims.js
|
|
105
106
|
var getImportMetaUrl = () => typeof document === "undefined" ? new URL(`file:${__filename}`).href : document.currentScript && document.currentScript.src || new URL("main.js", document.baseURI).href;
|
|
106
107
|
var importMetaUrl = /* @__PURE__ */ getImportMetaUrl();
|
|
107
108
|
|
|
@@ -414,7 +415,9 @@ async function stylistic(options = {}) {
|
|
|
414
415
|
},
|
|
415
416
|
// 覆盖`stylistic`默认规则
|
|
416
417
|
"style/brace-style": ["error", "stroustrup"],
|
|
418
|
+
"style/generator-star-spacing": ["error", { after: true, before: false }],
|
|
417
419
|
"style/multiline-ternary": ["error", "never"],
|
|
420
|
+
"style/yield-star-spacing": ["error", { after: true, before: false }],
|
|
418
421
|
...overrides
|
|
419
422
|
}
|
|
420
423
|
}
|
|
@@ -1195,6 +1198,30 @@ async function perfectionist(options = {}) {
|
|
|
1195
1198
|
];
|
|
1196
1199
|
}
|
|
1197
1200
|
|
|
1201
|
+
// src/configs/pnpm.ts
|
|
1202
|
+
async function pnpm() {
|
|
1203
|
+
return [
|
|
1204
|
+
{
|
|
1205
|
+
files: [
|
|
1206
|
+
"package.json",
|
|
1207
|
+
"**/package.json"
|
|
1208
|
+
],
|
|
1209
|
+
languageOptions: {
|
|
1210
|
+
parser: await interopDefault(import("jsonc-eslint-parser"))
|
|
1211
|
+
},
|
|
1212
|
+
name: "eslint/pnpm/rules",
|
|
1213
|
+
plugins: {
|
|
1214
|
+
pnpm: await interopDefault(import("eslint-plugin-pnpm"))
|
|
1215
|
+
},
|
|
1216
|
+
rules: {
|
|
1217
|
+
"pnpm/enforce-catalog": "error",
|
|
1218
|
+
"pnpm/prefer-workspace-settings": "error",
|
|
1219
|
+
"pnpm/valid-catalog": "error"
|
|
1220
|
+
}
|
|
1221
|
+
}
|
|
1222
|
+
];
|
|
1223
|
+
}
|
|
1224
|
+
|
|
1198
1225
|
// src/configs/react.ts
|
|
1199
1226
|
var import_local_pkg2 = require("local-pkg");
|
|
1200
1227
|
var ReactRefreshAllowConstantExportPackages = [
|
|
@@ -1240,7 +1267,6 @@ async function react(options = {}) {
|
|
|
1240
1267
|
pluginReactRefresh
|
|
1241
1268
|
] = await Promise.all([
|
|
1242
1269
|
interopDefault(import("@eslint-react/eslint-plugin")),
|
|
1243
|
-
// @ts-expect-error missing types
|
|
1244
1270
|
interopDefault(import("eslint-plugin-react-hooks")),
|
|
1245
1271
|
interopDefault(import("eslint-plugin-react-refresh"))
|
|
1246
1272
|
]);
|
|
@@ -2061,13 +2087,13 @@ async function vue(options = {}) {
|
|
|
2061
2087
|
rules: {
|
|
2062
2088
|
...pluginVue.configs.base.rules,
|
|
2063
2089
|
...vueVersion === "2" ? {
|
|
2064
|
-
...pluginVue.configs
|
|
2065
|
-
...pluginVue.configs["strongly-recommended"].rules,
|
|
2066
|
-
...pluginVue.configs
|
|
2090
|
+
...pluginVue.configs["vue2-essential"].rules,
|
|
2091
|
+
...pluginVue.configs["vue2-strongly-recommended"].rules,
|
|
2092
|
+
...pluginVue.configs["vue2-recommended"].rules
|
|
2067
2093
|
} : {
|
|
2068
|
-
...pluginVue.configs["
|
|
2069
|
-
...pluginVue.configs["
|
|
2070
|
-
...pluginVue.configs["
|
|
2094
|
+
...pluginVue.configs["flat/essential"].map((c) => c.rules).reduce((acc, c) => ({ ...acc, ...c }), {}),
|
|
2095
|
+
...pluginVue.configs["flat/strongly-recommended"].map((c) => c.rules).reduce((acc, c) => ({ ...acc, ...c }), {}),
|
|
2096
|
+
...pluginVue.configs["flat/recommended"].map((c) => c.rules).reduce((acc, c) => ({ ...acc, ...c }), {})
|
|
2071
2097
|
},
|
|
2072
2098
|
"antfu/no-top-level-await": "off",
|
|
2073
2099
|
"node/prefer-global/process": "off",
|
|
@@ -2234,6 +2260,37 @@ async function yaml(options = {}) {
|
|
|
2234
2260
|
} : {},
|
|
2235
2261
|
...overrides
|
|
2236
2262
|
}
|
|
2263
|
+
},
|
|
2264
|
+
{
|
|
2265
|
+
files: ["pnpm-workspace.yaml"],
|
|
2266
|
+
name: "eslint/yaml/pnpm-workspace",
|
|
2267
|
+
rules: {
|
|
2268
|
+
"yaml/sort-keys": [
|
|
2269
|
+
"error",
|
|
2270
|
+
{
|
|
2271
|
+
order: [
|
|
2272
|
+
"packages",
|
|
2273
|
+
"overrides",
|
|
2274
|
+
"patchedDependencies",
|
|
2275
|
+
"hoistPattern",
|
|
2276
|
+
"catalog",
|
|
2277
|
+
"catalogs",
|
|
2278
|
+
"allowedDeprecatedVersions",
|
|
2279
|
+
"allowNonAppliedPatches",
|
|
2280
|
+
"configDependencies",
|
|
2281
|
+
"ignoredBuiltDependencies",
|
|
2282
|
+
"ignoredOptionalDependencies",
|
|
2283
|
+
"neverBuiltDependencies",
|
|
2284
|
+
"onlyBuiltDependencies",
|
|
2285
|
+
"onlyBuiltDependenciesFile",
|
|
2286
|
+
"packageExtensions",
|
|
2287
|
+
"peerDependencyRules",
|
|
2288
|
+
"supportedArchitectures"
|
|
2289
|
+
],
|
|
2290
|
+
pathPattern: "^$"
|
|
2291
|
+
}
|
|
2292
|
+
]
|
|
2293
|
+
}
|
|
2237
2294
|
}
|
|
2238
2295
|
];
|
|
2239
2296
|
}
|
|
@@ -2274,6 +2331,7 @@ function lincy(options = {}, ...userConfigs) {
|
|
|
2274
2331
|
ignores: ignoresList = [],
|
|
2275
2332
|
jsx: enableJsx = true,
|
|
2276
2333
|
overrides = {},
|
|
2334
|
+
pnpm: enableCatalogs = false,
|
|
2277
2335
|
react: enableReact = false,
|
|
2278
2336
|
regexp: enableRegexp = true,
|
|
2279
2337
|
typescript: enableTypeScript = (0, import_local_pkg4.isPackageExists)("typescript"),
|
|
@@ -2409,6 +2467,11 @@ function lincy(options = {}, ...userConfigs) {
|
|
|
2409
2467
|
sortTsconfig()
|
|
2410
2468
|
);
|
|
2411
2469
|
}
|
|
2470
|
+
if (enableCatalogs) {
|
|
2471
|
+
configs2.push(
|
|
2472
|
+
pnpm()
|
|
2473
|
+
);
|
|
2474
|
+
}
|
|
2412
2475
|
if (options.yaml ?? true) {
|
|
2413
2476
|
configs2.push(yaml({
|
|
2414
2477
|
...resolveSubOptions(options, "yaml"),
|
|
@@ -2537,6 +2600,7 @@ var index_default = lincy;
|
|
|
2537
2600
|
node,
|
|
2538
2601
|
parserPlain,
|
|
2539
2602
|
perfectionist,
|
|
2603
|
+
pnpm,
|
|
2540
2604
|
react,
|
|
2541
2605
|
regexp,
|
|
2542
2606
|
renamePluginInConfigs,
|