@jsse/eslint-config 0.2.15 → 0.2.17
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 +84 -59
- package/dist/index.d.cts +104 -94
- package/dist/index.d.ts +104 -94
- package/dist/index.js +83 -59
- package/package.json +4 -3
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
|
};
|
|
@@ -10360,16 +10371,21 @@ var javascript = async (options) => {
|
|
|
10360
10371
|
"prefer-rest-params": "error",
|
|
10361
10372
|
"prefer-spread": "error",
|
|
10362
10373
|
"prefer-template": "error",
|
|
10363
|
-
"sort-imports":
|
|
10364
|
-
|
|
10365
|
-
|
|
10366
|
-
|
|
10367
|
-
|
|
10368
|
-
|
|
10369
|
-
|
|
10370
|
-
|
|
10371
|
-
|
|
10372
|
-
|
|
10374
|
+
"sort-imports": "off",
|
|
10375
|
+
// use `perfectionist/sort-imports` instead
|
|
10376
|
+
/**
|
|
10377
|
+
* previously used this before switching to `perfectionist/sort-imports`
|
|
10378
|
+
* "sort-imports": [
|
|
10379
|
+
* "error",
|
|
10380
|
+
* {
|
|
10381
|
+
* allowSeparatedGroups: false,
|
|
10382
|
+
* ignoreCase: false,
|
|
10383
|
+
* ignoreDeclarationSort: true,
|
|
10384
|
+
* ignoreMemberSort: false,
|
|
10385
|
+
* memberSyntaxSortOrder: ["none", "all", "multiple", "single"],
|
|
10386
|
+
* },
|
|
10387
|
+
* ],
|
|
10388
|
+
*/
|
|
10373
10389
|
"symbol-description": "error",
|
|
10374
10390
|
"unicode-bom": ["error", "never"],
|
|
10375
10391
|
"unused-imports/no-unused-imports": isInEditor2 ? "off" : "error",
|
|
@@ -11263,6 +11279,9 @@ var prettier = async () => {
|
|
|
11263
11279
|
];
|
|
11264
11280
|
};
|
|
11265
11281
|
|
|
11282
|
+
// src/configs/react.ts
|
|
11283
|
+
import { fixupPluginRules } from "@eslint/compat";
|
|
11284
|
+
|
|
11266
11285
|
// src/configs/ts/typescript-language-options.ts
|
|
11267
11286
|
import process4 from "node:process";
|
|
11268
11287
|
function typescriptLanguageOptions(options) {
|
|
@@ -11458,24 +11477,6 @@ function reactRules() {
|
|
|
11458
11477
|
"react/void-dom-elements-no-children": "error"
|
|
11459
11478
|
};
|
|
11460
11479
|
}
|
|
11461
|
-
function reactRefreshFlatConfigRules() {
|
|
11462
|
-
return [
|
|
11463
|
-
{
|
|
11464
|
-
files: [GLOB_SRC],
|
|
11465
|
-
name: "jsse/react/refresh",
|
|
11466
|
-
rules: {
|
|
11467
|
-
"react-refresh/only-export-components": "error"
|
|
11468
|
-
}
|
|
11469
|
-
},
|
|
11470
|
-
{
|
|
11471
|
-
files: ["**/*.stories.tsx"],
|
|
11472
|
-
name: "jsse/react:refresh/stories",
|
|
11473
|
-
rules: {
|
|
11474
|
-
"react-refresh/only-export-components": "off"
|
|
11475
|
-
}
|
|
11476
|
-
}
|
|
11477
|
-
];
|
|
11478
|
-
}
|
|
11479
11480
|
function reactRecomendedRules() {
|
|
11480
11481
|
return {
|
|
11481
11482
|
"react/display-name": 2,
|
|
@@ -11527,13 +11528,14 @@ var react = async (options) => {
|
|
|
11527
11528
|
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
|
|
11528
11529
|
react: pluginReact,
|
|
11529
11530
|
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
|
|
11530
|
-
"react-hooks": pluginReactHooks,
|
|
11531
|
+
"react-hooks": fixupPluginRules(pluginReactHooks),
|
|
11531
11532
|
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
|
|
11532
11533
|
"react-refresh": pluginReactRefresh
|
|
11533
11534
|
}
|
|
11534
11535
|
},
|
|
11535
11536
|
{
|
|
11536
11537
|
files: [GLOB_SRC],
|
|
11538
|
+
name: "jsse/react/rules",
|
|
11537
11539
|
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
|
|
11538
11540
|
rules: {
|
|
11539
11541
|
...reactRecomendedRules(),
|
|
@@ -11546,10 +11548,39 @@ var react = async (options) => {
|
|
|
11546
11548
|
version: "detect"
|
|
11547
11549
|
}
|
|
11548
11550
|
}
|
|
11551
|
+
},
|
|
11552
|
+
{
|
|
11553
|
+
files: [GLOB_SRC],
|
|
11554
|
+
name: "jsse/react-hooks/rules",
|
|
11555
|
+
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
|
|
11556
|
+
rules: {
|
|
11557
|
+
"react-hooks/exhaustive-deps": "error",
|
|
11558
|
+
"react-hooks/rules-of-hooks": "error"
|
|
11559
|
+
},
|
|
11560
|
+
settings: {
|
|
11561
|
+
react: {
|
|
11562
|
+
version: "detect"
|
|
11563
|
+
}
|
|
11564
|
+
}
|
|
11549
11565
|
}
|
|
11550
11566
|
];
|
|
11551
11567
|
if (reactRefresh) {
|
|
11552
|
-
config.push(
|
|
11568
|
+
config.push(
|
|
11569
|
+
{
|
|
11570
|
+
files: [GLOB_SRC],
|
|
11571
|
+
name: "jsse/react/refresh",
|
|
11572
|
+
rules: {
|
|
11573
|
+
"react-refresh/only-export-components": "error"
|
|
11574
|
+
}
|
|
11575
|
+
},
|
|
11576
|
+
{
|
|
11577
|
+
files: ["**/*.stories.tsx"],
|
|
11578
|
+
name: "jsse/react-refresh/stories",
|
|
11579
|
+
rules: {
|
|
11580
|
+
"react-refresh/only-export-components": "off"
|
|
11581
|
+
}
|
|
11582
|
+
}
|
|
11583
|
+
);
|
|
11553
11584
|
}
|
|
11554
11585
|
return config;
|
|
11555
11586
|
};
|
|
@@ -11867,6 +11898,7 @@ function typescriptParser(options) {
|
|
|
11867
11898
|
componentExts = [],
|
|
11868
11899
|
filesTypeAware: files = [GLOB_TS, GLOB_TSX],
|
|
11869
11900
|
ignoresTypeAware: ignores2 = [GLOB_MARKDOWN],
|
|
11901
|
+
name,
|
|
11870
11902
|
parserOptions: parserOptionsOverride = {},
|
|
11871
11903
|
react: react2,
|
|
11872
11904
|
tsconfig,
|
|
@@ -11894,7 +11926,7 @@ function typescriptParser(options) {
|
|
|
11894
11926
|
...parserOptionsOverride
|
|
11895
11927
|
}
|
|
11896
11928
|
},
|
|
11897
|
-
name: `jsse/typescript/${typeAware ? "type-aware-parser" : "parser"}`
|
|
11929
|
+
name: name ?? `jsse/typescript/${typeAware ? "type-aware-parser" : "parser"}`
|
|
11898
11930
|
};
|
|
11899
11931
|
}
|
|
11900
11932
|
return {
|
|
@@ -11914,7 +11946,7 @@ function typescriptParser(options) {
|
|
|
11914
11946
|
...parserOptionsOverride
|
|
11915
11947
|
}
|
|
11916
11948
|
},
|
|
11917
|
-
name: `jsse/typescript/${typeAware ? "type-aware-parser" : "parser"}`
|
|
11949
|
+
name: name ?? `jsse/typescript/${typeAware ? "type-aware-parser" : "parser"}`
|
|
11918
11950
|
};
|
|
11919
11951
|
}
|
|
11920
11952
|
|
|
@@ -12219,7 +12251,7 @@ var yml = async (options) => {
|
|
|
12219
12251
|
languageOptions: {
|
|
12220
12252
|
parser: parserYaml
|
|
12221
12253
|
},
|
|
12222
|
-
name: "
|
|
12254
|
+
name: "jsse/yaml/rules",
|
|
12223
12255
|
rules: {
|
|
12224
12256
|
"style/spaced-comment": "off",
|
|
12225
12257
|
"yaml/block-mapping": "error",
|
|
@@ -12328,15 +12360,6 @@ var Lager = class {
|
|
|
12328
12360
|
};
|
|
12329
12361
|
var log = new Lager();
|
|
12330
12362
|
|
|
12331
|
-
// src/slow.ts
|
|
12332
|
-
var slowRules = [
|
|
12333
|
-
"@typescript-eslint/no-misused-promises",
|
|
12334
|
-
"@typescript-eslint/no-unsafe-assignment",
|
|
12335
|
-
"@typescript-eslint/no-unsafe-call",
|
|
12336
|
-
"@typescript-eslint/no-unsafe-member-access",
|
|
12337
|
-
"@typescript-eslint/no-unsafe-return"
|
|
12338
|
-
];
|
|
12339
|
-
|
|
12340
12363
|
// src/factory.ts
|
|
12341
12364
|
var flatConfigProps = [
|
|
12342
12365
|
"files",
|
|
@@ -12374,7 +12397,7 @@ function normalizeOptions(options = {}) {
|
|
|
12374
12397
|
const off = [
|
|
12375
12398
|
.../* @__PURE__ */ new Set([
|
|
12376
12399
|
...options.off ?? [],
|
|
12377
|
-
...options.fast ? [...
|
|
12400
|
+
...options.fast ? [...SLOW_RULES] : []
|
|
12378
12401
|
])
|
|
12379
12402
|
].sort(
|
|
12380
12403
|
(a, b) => a.localeCompare(b, void 0, { numeric: true, sensitivity: "base" })
|
|
@@ -12570,21 +12593,6 @@ async function jsse(options = {}, ...userConfigs) {
|
|
|
12570
12593
|
}
|
|
12571
12594
|
}
|
|
12572
12595
|
}
|
|
12573
|
-
if (normalizedOptions.preReturn) {
|
|
12574
|
-
log.debug("Running preReturn");
|
|
12575
|
-
const preReturned = normalizedOptions.preReturn(combinedConfigs);
|
|
12576
|
-
if (preReturned instanceof Promise) {
|
|
12577
|
-
const res = await preReturned;
|
|
12578
|
-
log.debug("preReturn finished");
|
|
12579
|
-
log.debug("final config", res);
|
|
12580
|
-
return res;
|
|
12581
|
-
} else {
|
|
12582
|
-
const res = preReturned;
|
|
12583
|
-
log.debug("preReturn finished");
|
|
12584
|
-
log.debug("final config", res);
|
|
12585
|
-
return res;
|
|
12586
|
-
}
|
|
12587
|
-
}
|
|
12588
12596
|
for (const config of combinedConfigs) {
|
|
12589
12597
|
if (config.plugins) {
|
|
12590
12598
|
for (const [key, value] of Object.entries(config.plugins)) {
|
|
@@ -12603,6 +12611,21 @@ async function jsse(options = {}, ...userConfigs) {
|
|
|
12603
12611
|
}
|
|
12604
12612
|
}
|
|
12605
12613
|
}
|
|
12614
|
+
if (normalizedOptions.preReturn) {
|
|
12615
|
+
log.debug("Running preReturn");
|
|
12616
|
+
const preReturned = normalizedOptions.preReturn(combinedConfigs);
|
|
12617
|
+
if (preReturned instanceof Promise) {
|
|
12618
|
+
const res = await preReturned;
|
|
12619
|
+
log.debug("preReturn finished");
|
|
12620
|
+
log.debug("final config", res);
|
|
12621
|
+
return res;
|
|
12622
|
+
} else {
|
|
12623
|
+
const res = preReturned;
|
|
12624
|
+
log.debug("preReturn finished");
|
|
12625
|
+
log.debug("final config", res);
|
|
12626
|
+
return res;
|
|
12627
|
+
}
|
|
12628
|
+
}
|
|
12606
12629
|
return combinedConfigs;
|
|
12607
12630
|
}
|
|
12608
12631
|
|
|
@@ -12647,6 +12670,7 @@ export {
|
|
|
12647
12670
|
GLOB_TSCONFIG,
|
|
12648
12671
|
GLOB_TSX,
|
|
12649
12672
|
GLOB_YAML,
|
|
12673
|
+
SLOW_RULES,
|
|
12650
12674
|
combine,
|
|
12651
12675
|
combineAsync,
|
|
12652
12676
|
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.17",
|
|
5
5
|
"description": "@jsse/eslint-config ~ WYSIWYG",
|
|
6
6
|
"author": "jessekrubin <jessekrubin@gmail.com> (https://github.com/jessekrubin/)",
|
|
7
7
|
"license": "MIT",
|
|
@@ -59,7 +59,8 @@
|
|
|
59
59
|
}
|
|
60
60
|
},
|
|
61
61
|
"dependencies": {
|
|
62
|
-
"@eslint/
|
|
62
|
+
"@eslint/compat": "^1.1.1",
|
|
63
|
+
"@eslint/js": "~9.11.0",
|
|
63
64
|
"@eslint/markdown": "^6.1.0",
|
|
64
65
|
"@stylistic/eslint-plugin": "2.8.0",
|
|
65
66
|
"@typescript-eslint/eslint-plugin": "^8.6.0",
|
|
@@ -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",
|