@jsse/eslint-config 0.2.16 → 0.2.18
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 +30 -30
- package/dist/cli.cjs +1 -1
- package/dist/cli.js +1 -1
- package/dist/index.cjs +78 -78
- package/dist/index.d.cts +208 -106
- package/dist/index.d.ts +208 -106
- package/dist/index.js +77 -78
- package/package.json +14 -13
package/dist/index.js
CHANGED
|
@@ -2971,6 +2971,16 @@ var require_globals2 = __commonJS({
|
|
|
2971
2971
|
}
|
|
2972
2972
|
});
|
|
2973
2973
|
|
|
2974
|
+
// src/const.ts
|
|
2975
|
+
var SLOW_RULES = [
|
|
2976
|
+
"@typescript-eslint/no-misused-promises",
|
|
2977
|
+
"@typescript-eslint/no-unsafe-assignment",
|
|
2978
|
+
"@typescript-eslint/no-unsafe-call",
|
|
2979
|
+
"@typescript-eslint/no-unsafe-member-access",
|
|
2980
|
+
"@typescript-eslint/no-unsafe-return",
|
|
2981
|
+
"unicorn/no-unnecessary-polyfills"
|
|
2982
|
+
];
|
|
2983
|
+
|
|
2974
2984
|
// src/factory.ts
|
|
2975
2985
|
import fs2 from "node:fs";
|
|
2976
2986
|
import process6 from "node:process";
|
|
@@ -10108,7 +10118,8 @@ var comments = async () => [
|
|
|
10108
10118
|
var ignores = async () => {
|
|
10109
10119
|
return [
|
|
10110
10120
|
{
|
|
10111
|
-
ignores: GLOB_EXCLUDE
|
|
10121
|
+
ignores: GLOB_EXCLUDE,
|
|
10122
|
+
name: "jsse/ignores"
|
|
10112
10123
|
}
|
|
10113
10124
|
];
|
|
10114
10125
|
};
|
|
@@ -10642,32 +10653,7 @@ function typescriptRulesTypeOblivious() {
|
|
|
10642
10653
|
"no-console": [
|
|
10643
10654
|
"warn",
|
|
10644
10655
|
{
|
|
10645
|
-
allow: [
|
|
10646
|
-
"log",
|
|
10647
|
-
"warn",
|
|
10648
|
-
"dir",
|
|
10649
|
-
"time",
|
|
10650
|
-
"timeEnd",
|
|
10651
|
-
"timeLog",
|
|
10652
|
-
"trace",
|
|
10653
|
-
"assert",
|
|
10654
|
-
"clear",
|
|
10655
|
-
"count",
|
|
10656
|
-
"countReset",
|
|
10657
|
-
"group",
|
|
10658
|
-
"groupEnd",
|
|
10659
|
-
"table",
|
|
10660
|
-
"debug",
|
|
10661
|
-
"info",
|
|
10662
|
-
"dirxml",
|
|
10663
|
-
"error",
|
|
10664
|
-
"groupCollapsed",
|
|
10665
|
-
"Console",
|
|
10666
|
-
"profile",
|
|
10667
|
-
"profileEnd",
|
|
10668
|
-
"timeStamp",
|
|
10669
|
-
"context"
|
|
10670
|
-
]
|
|
10656
|
+
allow: ["warn", "error"]
|
|
10671
10657
|
}
|
|
10672
10658
|
],
|
|
10673
10659
|
"object-curly-spacing": "off",
|
|
@@ -11268,6 +11254,9 @@ var prettier = async () => {
|
|
|
11268
11254
|
];
|
|
11269
11255
|
};
|
|
11270
11256
|
|
|
11257
|
+
// src/configs/react.ts
|
|
11258
|
+
import { fixupPluginRules } from "@eslint/compat";
|
|
11259
|
+
|
|
11271
11260
|
// src/configs/ts/typescript-language-options.ts
|
|
11272
11261
|
import process4 from "node:process";
|
|
11273
11262
|
function typescriptLanguageOptions(options) {
|
|
@@ -11463,24 +11452,6 @@ function reactRules() {
|
|
|
11463
11452
|
"react/void-dom-elements-no-children": "error"
|
|
11464
11453
|
};
|
|
11465
11454
|
}
|
|
11466
|
-
function reactRefreshFlatConfigRules() {
|
|
11467
|
-
return [
|
|
11468
|
-
{
|
|
11469
|
-
files: [GLOB_SRC],
|
|
11470
|
-
name: "jsse/react/refresh",
|
|
11471
|
-
rules: {
|
|
11472
|
-
"react-refresh/only-export-components": "error"
|
|
11473
|
-
}
|
|
11474
|
-
},
|
|
11475
|
-
{
|
|
11476
|
-
files: ["**/*.stories.tsx"],
|
|
11477
|
-
name: "jsse/react:refresh/stories",
|
|
11478
|
-
rules: {
|
|
11479
|
-
"react-refresh/only-export-components": "off"
|
|
11480
|
-
}
|
|
11481
|
-
}
|
|
11482
|
-
];
|
|
11483
|
-
}
|
|
11484
11455
|
function reactRecomendedRules() {
|
|
11485
11456
|
return {
|
|
11486
11457
|
"react/display-name": 2,
|
|
@@ -11532,13 +11503,14 @@ var react = async (options) => {
|
|
|
11532
11503
|
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
|
|
11533
11504
|
react: pluginReact,
|
|
11534
11505
|
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
|
|
11535
|
-
"react-hooks": pluginReactHooks,
|
|
11506
|
+
"react-hooks": fixupPluginRules(pluginReactHooks),
|
|
11536
11507
|
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
|
|
11537
11508
|
"react-refresh": pluginReactRefresh
|
|
11538
11509
|
}
|
|
11539
11510
|
},
|
|
11540
11511
|
{
|
|
11541
11512
|
files: [GLOB_SRC],
|
|
11513
|
+
name: "jsse/react/rules",
|
|
11542
11514
|
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
|
|
11543
11515
|
rules: {
|
|
11544
11516
|
...reactRecomendedRules(),
|
|
@@ -11551,10 +11523,39 @@ var react = async (options) => {
|
|
|
11551
11523
|
version: "detect"
|
|
11552
11524
|
}
|
|
11553
11525
|
}
|
|
11526
|
+
},
|
|
11527
|
+
{
|
|
11528
|
+
files: [GLOB_SRC],
|
|
11529
|
+
name: "jsse/react-hooks/rules",
|
|
11530
|
+
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
|
|
11531
|
+
rules: {
|
|
11532
|
+
"react-hooks/exhaustive-deps": "error",
|
|
11533
|
+
"react-hooks/rules-of-hooks": "error"
|
|
11534
|
+
},
|
|
11535
|
+
settings: {
|
|
11536
|
+
react: {
|
|
11537
|
+
version: "detect"
|
|
11538
|
+
}
|
|
11539
|
+
}
|
|
11554
11540
|
}
|
|
11555
11541
|
];
|
|
11556
11542
|
if (reactRefresh) {
|
|
11557
|
-
config.push(
|
|
11543
|
+
config.push(
|
|
11544
|
+
{
|
|
11545
|
+
files: [GLOB_SRC],
|
|
11546
|
+
name: "jsse/react/refresh",
|
|
11547
|
+
rules: {
|
|
11548
|
+
"react-refresh/only-export-components": "error"
|
|
11549
|
+
}
|
|
11550
|
+
},
|
|
11551
|
+
{
|
|
11552
|
+
files: ["**/*.stories.tsx"],
|
|
11553
|
+
name: "jsse/react-refresh/stories",
|
|
11554
|
+
rules: {
|
|
11555
|
+
"react-refresh/only-export-components": "off"
|
|
11556
|
+
}
|
|
11557
|
+
}
|
|
11558
|
+
);
|
|
11558
11559
|
}
|
|
11559
11560
|
return config;
|
|
11560
11561
|
};
|
|
@@ -11872,6 +11873,7 @@ function typescriptParser(options) {
|
|
|
11872
11873
|
componentExts = [],
|
|
11873
11874
|
filesTypeAware: files = [GLOB_TS, GLOB_TSX],
|
|
11874
11875
|
ignoresTypeAware: ignores2 = [GLOB_MARKDOWN],
|
|
11876
|
+
name,
|
|
11875
11877
|
parserOptions: parserOptionsOverride = {},
|
|
11876
11878
|
react: react2,
|
|
11877
11879
|
tsconfig,
|
|
@@ -11899,7 +11901,7 @@ function typescriptParser(options) {
|
|
|
11899
11901
|
...parserOptionsOverride
|
|
11900
11902
|
}
|
|
11901
11903
|
},
|
|
11902
|
-
name: `jsse/typescript/${typeAware ? "type-aware-parser" : "parser"}`
|
|
11904
|
+
name: name ?? `jsse/typescript/${typeAware ? "type-aware-parser" : "parser"}`
|
|
11903
11905
|
};
|
|
11904
11906
|
}
|
|
11905
11907
|
return {
|
|
@@ -11919,7 +11921,7 @@ function typescriptParser(options) {
|
|
|
11919
11921
|
...parserOptionsOverride
|
|
11920
11922
|
}
|
|
11921
11923
|
},
|
|
11922
|
-
name: `jsse/typescript/${typeAware ? "type-aware-parser" : "parser"}`
|
|
11924
|
+
name: name ?? `jsse/typescript/${typeAware ? "type-aware-parser" : "parser"}`
|
|
11923
11925
|
};
|
|
11924
11926
|
}
|
|
11925
11927
|
|
|
@@ -12091,6 +12093,7 @@ var unicorn = async () => {
|
|
|
12091
12093
|
...unicornRecommended(),
|
|
12092
12094
|
...unicornOff(),
|
|
12093
12095
|
"unicorn/better-regex": "error",
|
|
12096
|
+
"unicorn/consistent-empty-array-spread": "error",
|
|
12094
12097
|
"unicorn/custom-error-definition": "error",
|
|
12095
12098
|
// Pass error message when throwing errors
|
|
12096
12099
|
"unicorn/error-message": "error",
|
|
@@ -12224,7 +12227,7 @@ var yml = async (options) => {
|
|
|
12224
12227
|
languageOptions: {
|
|
12225
12228
|
parser: parserYaml
|
|
12226
12229
|
},
|
|
12227
|
-
name: "
|
|
12230
|
+
name: "jsse/yaml/rules",
|
|
12228
12231
|
rules: {
|
|
12229
12232
|
"style/spaced-comment": "off",
|
|
12230
12233
|
"yaml/block-mapping": "error",
|
|
@@ -12333,15 +12336,6 @@ var Lager = class {
|
|
|
12333
12336
|
};
|
|
12334
12337
|
var log = new Lager();
|
|
12335
12338
|
|
|
12336
|
-
// src/slow.ts
|
|
12337
|
-
var slowRules = [
|
|
12338
|
-
"@typescript-eslint/no-misused-promises",
|
|
12339
|
-
"@typescript-eslint/no-unsafe-assignment",
|
|
12340
|
-
"@typescript-eslint/no-unsafe-call",
|
|
12341
|
-
"@typescript-eslint/no-unsafe-member-access",
|
|
12342
|
-
"@typescript-eslint/no-unsafe-return"
|
|
12343
|
-
];
|
|
12344
|
-
|
|
12345
12339
|
// src/factory.ts
|
|
12346
12340
|
var flatConfigProps = [
|
|
12347
12341
|
"files",
|
|
@@ -12379,7 +12373,7 @@ function normalizeOptions(options = {}) {
|
|
|
12379
12373
|
const off = [
|
|
12380
12374
|
.../* @__PURE__ */ new Set([
|
|
12381
12375
|
...options.off ?? [],
|
|
12382
|
-
...options.fast ? [...
|
|
12376
|
+
...options.fast ? [...SLOW_RULES] : []
|
|
12383
12377
|
])
|
|
12384
12378
|
].sort(
|
|
12385
12379
|
(a, b) => a.localeCompare(b, void 0, { numeric: true, sensitivity: "base" })
|
|
@@ -12558,9 +12552,13 @@ async function jsse(options = {}, ...userConfigs) {
|
|
|
12558
12552
|
}
|
|
12559
12553
|
}
|
|
12560
12554
|
for (const config of combinedConfigs) {
|
|
12561
|
-
for (const
|
|
12562
|
-
if (
|
|
12563
|
-
|
|
12555
|
+
for (const cfgRules of [config.rules, config.plugins]) {
|
|
12556
|
+
if (cfgRules) {
|
|
12557
|
+
for (const rule of off) {
|
|
12558
|
+
if (cfgRules[rule] !== void 0 && cfgRules[rule] !== "off" && cfgRules[rule] !== 0) {
|
|
12559
|
+
cfgRules[rule] = "off";
|
|
12560
|
+
}
|
|
12561
|
+
}
|
|
12564
12562
|
}
|
|
12565
12563
|
}
|
|
12566
12564
|
}
|
|
@@ -12575,21 +12573,6 @@ async function jsse(options = {}, ...userConfigs) {
|
|
|
12575
12573
|
}
|
|
12576
12574
|
}
|
|
12577
12575
|
}
|
|
12578
|
-
if (normalizedOptions.preReturn) {
|
|
12579
|
-
log.debug("Running preReturn");
|
|
12580
|
-
const preReturned = normalizedOptions.preReturn(combinedConfigs);
|
|
12581
|
-
if (preReturned instanceof Promise) {
|
|
12582
|
-
const res = await preReturned;
|
|
12583
|
-
log.debug("preReturn finished");
|
|
12584
|
-
log.debug("final config", res);
|
|
12585
|
-
return res;
|
|
12586
|
-
} else {
|
|
12587
|
-
const res = preReturned;
|
|
12588
|
-
log.debug("preReturn finished");
|
|
12589
|
-
log.debug("final config", res);
|
|
12590
|
-
return res;
|
|
12591
|
-
}
|
|
12592
|
-
}
|
|
12593
12576
|
for (const config of combinedConfigs) {
|
|
12594
12577
|
if (config.plugins) {
|
|
12595
12578
|
for (const [key, value] of Object.entries(config.plugins)) {
|
|
@@ -12608,6 +12591,21 @@ async function jsse(options = {}, ...userConfigs) {
|
|
|
12608
12591
|
}
|
|
12609
12592
|
}
|
|
12610
12593
|
}
|
|
12594
|
+
if (normalizedOptions.preReturn) {
|
|
12595
|
+
log.debug("Running preReturn");
|
|
12596
|
+
const preReturned = normalizedOptions.preReturn(combinedConfigs);
|
|
12597
|
+
if (preReturned instanceof Promise) {
|
|
12598
|
+
const res = await preReturned;
|
|
12599
|
+
log.debug("preReturn finished");
|
|
12600
|
+
log.debug("final config", res);
|
|
12601
|
+
return res;
|
|
12602
|
+
} else {
|
|
12603
|
+
const res = preReturned;
|
|
12604
|
+
log.debug("preReturn finished");
|
|
12605
|
+
log.debug("final config", res);
|
|
12606
|
+
return res;
|
|
12607
|
+
}
|
|
12608
|
+
}
|
|
12611
12609
|
return combinedConfigs;
|
|
12612
12610
|
}
|
|
12613
12611
|
|
|
@@ -12652,6 +12650,7 @@ export {
|
|
|
12652
12650
|
GLOB_TSCONFIG,
|
|
12653
12651
|
GLOB_TSX,
|
|
12654
12652
|
GLOB_YAML,
|
|
12653
|
+
SLOW_RULES,
|
|
12655
12654
|
combine,
|
|
12656
12655
|
combineAsync,
|
|
12657
12656
|
jsse as default,
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@jsse/eslint-config",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "0.2.
|
|
4
|
+
"version": "0.2.18",
|
|
5
5
|
"description": "@jsse/eslint-config ~ WYSIWYG",
|
|
6
6
|
"author": "jessekrubin <jessekrubin@gmail.com> (https://github.com/jessekrubin/)",
|
|
7
7
|
"license": "MIT",
|
|
@@ -59,24 +59,25 @@
|
|
|
59
59
|
}
|
|
60
60
|
},
|
|
61
61
|
"dependencies": {
|
|
62
|
-
"@eslint/
|
|
63
|
-
"@eslint/
|
|
62
|
+
"@eslint/compat": "^1.1.1",
|
|
63
|
+
"@eslint/js": "~9.11.1",
|
|
64
|
+
"@eslint/markdown": "^6.1.1",
|
|
64
65
|
"@stylistic/eslint-plugin": "2.8.0",
|
|
65
|
-
"@typescript-eslint/eslint-plugin": "^8.
|
|
66
|
-
"@typescript-eslint/parser": "^8.
|
|
66
|
+
"@typescript-eslint/eslint-plugin": "^8.8.0",
|
|
67
|
+
"@typescript-eslint/parser": "^8.8.0",
|
|
67
68
|
"@vitest/eslint-plugin": "^1.1.4",
|
|
68
69
|
"eslint-config-flat-gitignore": "^0.3.0",
|
|
69
70
|
"eslint-define-config": "^2.1.0",
|
|
70
71
|
"eslint-plugin-antfu": "^2.7.0",
|
|
71
72
|
"eslint-plugin-eslint-comments": "^3.2.0",
|
|
72
|
-
"eslint-plugin-import-x": "^4.
|
|
73
|
-
"eslint-plugin-jsdoc": "^50.
|
|
73
|
+
"eslint-plugin-import-x": "^4.3.1",
|
|
74
|
+
"eslint-plugin-jsdoc": "^50.3.1",
|
|
74
75
|
"eslint-plugin-jsonc": "^2.16.0",
|
|
75
76
|
"eslint-plugin-markdown": "^5.1.0",
|
|
76
77
|
"eslint-plugin-n": "^17.10.3",
|
|
77
78
|
"eslint-plugin-no-only-tests": "^3.3.0",
|
|
78
|
-
"eslint-plugin-perfectionist": "^3.
|
|
79
|
-
"eslint-plugin-react": "~7.
|
|
79
|
+
"eslint-plugin-perfectionist": "^3.8.0",
|
|
80
|
+
"eslint-plugin-react": "~7.37.0",
|
|
80
81
|
"eslint-plugin-react-hooks": "~4.6.2",
|
|
81
82
|
"eslint-plugin-react-refresh": "~0.4.12",
|
|
82
83
|
"eslint-plugin-toml": "^0.11.1",
|
|
@@ -87,7 +88,7 @@
|
|
|
87
88
|
"jsonc-eslint-parser": "^2.4.0",
|
|
88
89
|
"picocolors": "^1.1.0",
|
|
89
90
|
"toml-eslint-parser": "^0.10.0",
|
|
90
|
-
"typescript-eslint": "^8.
|
|
91
|
+
"typescript-eslint": "^8.8.0",
|
|
91
92
|
"yaml-eslint-parser": "^1.2.3"
|
|
92
93
|
},
|
|
93
94
|
"devDependencies": {
|
|
@@ -97,9 +98,9 @@
|
|
|
97
98
|
"@types/eslint": "^9.6.1",
|
|
98
99
|
"@types/eslint__js": "~8.42.3",
|
|
99
100
|
"@types/fs-extra": "^11.0.4",
|
|
100
|
-
"@types/node": "^22.
|
|
101
|
+
"@types/node": "^22.7.4",
|
|
101
102
|
"cac": "^6.7.14",
|
|
102
|
-
"eslint": "^9.
|
|
103
|
+
"eslint": "^9.11.1",
|
|
103
104
|
"eslint-flat-config-utils": "^0.4.0",
|
|
104
105
|
"eslint-plugin-tailwindcss": "^3.17.4",
|
|
105
106
|
"eslint-typegen": "^0.3.2",
|
|
@@ -123,7 +124,7 @@
|
|
|
123
124
|
"build-fast": "tsup src/index.ts src/cli.ts --format esm,cjs --clean",
|
|
124
125
|
"gen": "tsx scripts/gen.ts && prettier -w src",
|
|
125
126
|
"dev": "tsup src/index.ts --format esm,cjs --watch",
|
|
126
|
-
"fmt": "prettier -w
|
|
127
|
+
"fmt": "prettier -w .",
|
|
127
128
|
"fmtc": "prettier --check .",
|
|
128
129
|
"lint": "pnpm run build-fast && eslint .",
|
|
129
130
|
"change": "changeset",
|