@jiakun-zhao/eslint-config 4.0.0 → 4.0.2
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/LICENSE +21 -0
- package/README.md +44 -2
- package/dist/index.d.mts +13768 -1
- package/dist/index.d.ts +13768 -1
- package/dist/index.mjs +67 -34
- package/package.json +4 -4
package/dist/index.mjs
CHANGED
|
@@ -2,10 +2,9 @@ import { composer } from 'eslint-flat-config-utils';
|
|
|
2
2
|
import pluginStylistic from '@stylistic/eslint-plugin';
|
|
3
3
|
import pluginTypescript from '@typescript-eslint/eslint-plugin';
|
|
4
4
|
import pluginAntfu from 'eslint-plugin-antfu';
|
|
5
|
-
import 'eslint-plugin-command';
|
|
5
|
+
import pluginCommand from 'eslint-plugin-command';
|
|
6
6
|
import pluginImportX from 'eslint-plugin-import-x';
|
|
7
7
|
import pluginJsonc from 'eslint-plugin-jsonc';
|
|
8
|
-
import 'eslint-plugin-n';
|
|
9
8
|
import pluginPerfectionist from 'eslint-plugin-perfectionist';
|
|
10
9
|
import * as pluginRegExp from 'eslint-plugin-regexp';
|
|
11
10
|
import pluginUnicorn from 'eslint-plugin-unicorn';
|
|
@@ -161,6 +160,18 @@ function createSharedAstroConfig(plugin, rules = {}) {
|
|
|
161
160
|
};
|
|
162
161
|
}
|
|
163
162
|
|
|
163
|
+
function command() {
|
|
164
|
+
return {
|
|
165
|
+
name: "command",
|
|
166
|
+
plugins: {
|
|
167
|
+
command: pluginCommand
|
|
168
|
+
},
|
|
169
|
+
rules: {
|
|
170
|
+
"command/command": "warn"
|
|
171
|
+
}
|
|
172
|
+
};
|
|
173
|
+
}
|
|
174
|
+
|
|
164
175
|
function ignores(options) {
|
|
165
176
|
return [
|
|
166
177
|
gitignore({ ...options.gitignore, name: "ignores/gitignore" }),
|
|
@@ -357,41 +368,11 @@ function jsonc() {
|
|
|
357
368
|
"jsonc/object-curly-newline": ["warn", { consistent: true }],
|
|
358
369
|
"jsonc/object-curly-spacing": ["warn", "always"]
|
|
359
370
|
}
|
|
360
|
-
},
|
|
361
|
-
{
|
|
362
|
-
files: [
|
|
363
|
-
"**/.vscode/settings.json",
|
|
364
|
-
"**/tsconfig.json"
|
|
365
|
-
],
|
|
366
|
-
name: "jsonc/just-sort",
|
|
367
|
-
rules: {
|
|
368
|
-
"jsonc/sort-array-values": ["warn", { order: { type: "asc" }, pathPattern: ".*" }],
|
|
369
|
-
"jsonc/sort-keys": ["warn", { order: { type: "asc" }, pathPattern: ".*" }]
|
|
370
|
-
}
|
|
371
|
-
},
|
|
372
|
-
{
|
|
373
|
-
files: [
|
|
374
|
-
"**/package.json"
|
|
375
|
-
],
|
|
376
|
-
name: "jsonc/package-json",
|
|
377
|
-
rules: {
|
|
378
|
-
"jsonc/sort-array-values": [
|
|
379
|
-
"warn",
|
|
380
|
-
{ order: { type: "asc" }, pathPattern: "^files$" }
|
|
381
|
-
],
|
|
382
|
-
"jsonc/sort-keys": [
|
|
383
|
-
"warn",
|
|
384
|
-
{ order: packageJsonTopLevelOrder, pathPattern: "^$" },
|
|
385
|
-
{ order: { type: "asc" }, pathPattern: "^(?:exports|scripts)" },
|
|
386
|
-
/* cSpell:disable-next-line */
|
|
387
|
-
{ order: { type: "asc" }, pathPattern: "^(?:dev|peer|optional|bundled)?[Dd]ependencies(Meta)?$" }
|
|
388
|
-
]
|
|
389
|
-
}
|
|
390
371
|
}
|
|
391
372
|
];
|
|
392
373
|
}
|
|
393
374
|
|
|
394
|
-
const version = "4.0.
|
|
375
|
+
const version = "4.0.2";
|
|
395
376
|
|
|
396
377
|
const toString = (v) => Object.prototype.toString.call(v);
|
|
397
378
|
const isNull = (val) => toString(val) === "[object Null]";
|
|
@@ -547,6 +528,56 @@ function mine() {
|
|
|
547
528
|
};
|
|
548
529
|
}
|
|
549
530
|
|
|
531
|
+
function overrides() {
|
|
532
|
+
const configFileNames = ["eslint", "astro", "vite", "build", "uno", "unocss", "vitest"];
|
|
533
|
+
const extensions = ["js", "mjs", "cjs", "ts", "mts", "cts"];
|
|
534
|
+
return [
|
|
535
|
+
{
|
|
536
|
+
name: "override/sort-config-files",
|
|
537
|
+
files: [
|
|
538
|
+
...configFileNames.reduce(
|
|
539
|
+
(acc, cur) => acc.concat(...extensions.map((ext) => `${cur}.config.${ext}`)),
|
|
540
|
+
[]
|
|
541
|
+
)
|
|
542
|
+
],
|
|
543
|
+
rules: {
|
|
544
|
+
"perfectionist/sort-objects": "warn"
|
|
545
|
+
}
|
|
546
|
+
},
|
|
547
|
+
{
|
|
548
|
+
name: "override/jsonc-sort",
|
|
549
|
+
files: [
|
|
550
|
+
"**/.vscode/settings.json",
|
|
551
|
+
"**/tsconfig.json"
|
|
552
|
+
],
|
|
553
|
+
rules: {
|
|
554
|
+
"jsonc/sort-array-values": ["warn", { order: { type: "asc" }, pathPattern: ".*" }],
|
|
555
|
+
"jsonc/sort-keys": ["warn", { order: { type: "asc" }, pathPattern: ".*" }]
|
|
556
|
+
}
|
|
557
|
+
},
|
|
558
|
+
{
|
|
559
|
+
name: "override/package-json",
|
|
560
|
+
files: [
|
|
561
|
+
"**/package.json"
|
|
562
|
+
],
|
|
563
|
+
rules: {
|
|
564
|
+
"style/no-multiple-empty-lines": ["warn", { max: 0 }],
|
|
565
|
+
"jsonc/sort-array-values": [
|
|
566
|
+
"warn",
|
|
567
|
+
{ order: { type: "asc" }, pathPattern: "^files$" }
|
|
568
|
+
],
|
|
569
|
+
"jsonc/sort-keys": [
|
|
570
|
+
"warn",
|
|
571
|
+
{ order: packageJsonTopLevelOrder, pathPattern: "^$" },
|
|
572
|
+
{ order: { type: "asc" }, pathPattern: "^(?:exports|scripts)" },
|
|
573
|
+
/* cSpell:disable-next-line */
|
|
574
|
+
{ order: { type: "asc" }, pathPattern: "^(?:dev|peer|optional|bundled)?[Dd]ependencies(Meta)?$" }
|
|
575
|
+
]
|
|
576
|
+
}
|
|
577
|
+
}
|
|
578
|
+
];
|
|
579
|
+
}
|
|
580
|
+
|
|
550
581
|
function perfectionist() {
|
|
551
582
|
return {
|
|
552
583
|
name: "perfectionist",
|
|
@@ -951,7 +982,9 @@ function index(options = {}) {
|
|
|
951
982
|
antfu(),
|
|
952
983
|
importX(),
|
|
953
984
|
unicorn(),
|
|
954
|
-
regexp()
|
|
985
|
+
regexp(),
|
|
986
|
+
command(),
|
|
987
|
+
overrides()
|
|
955
988
|
);
|
|
956
989
|
}
|
|
957
990
|
|
package/package.json
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@jiakun-zhao/eslint-config",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "4.0.
|
|
5
|
-
"description": "Jiakun's ESLint config.",
|
|
4
|
+
"version": "4.0.2",
|
|
5
|
+
"description": "Jiakun Zhao's ESLint config.",
|
|
6
6
|
"author": "Jiakun Zhao <hi@zhaojiakun.com>",
|
|
7
7
|
"license": "MIT",
|
|
8
8
|
"homepage": "https://github.com/jiakun-zhao/eslint-config",
|
|
@@ -43,7 +43,6 @@
|
|
|
43
43
|
"eslint-plugin-command": "^3.2.0",
|
|
44
44
|
"eslint-plugin-import-x": "^4.10.5",
|
|
45
45
|
"eslint-plugin-jsonc": "^2.20.0",
|
|
46
|
-
"eslint-plugin-n": "^17.17.0",
|
|
47
46
|
"eslint-plugin-perfectionist": "^4.11.0",
|
|
48
47
|
"eslint-plugin-regexp": "^2.7.0",
|
|
49
48
|
"eslint-plugin-unicorn": "^58.0.0",
|
|
@@ -72,6 +71,7 @@
|
|
|
72
71
|
"dev": "config-inspector --open=false",
|
|
73
72
|
"release": "bumpp && pnpm publish && npx cnpm sync @jiakun-zhao/eslint-config",
|
|
74
73
|
"stub": "unbuild --stub",
|
|
75
|
-
"test": "vitest"
|
|
74
|
+
"test": "vitest",
|
|
75
|
+
"typegen": "tsx ./scripts/typegen.ts"
|
|
76
76
|
}
|
|
77
77
|
}
|