@jsse/eslint-config 0.2.10 → 0.2.11
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/dist/cli.cjs +1 -1
- package/dist/cli.js +1 -1
- package/dist/index.cjs +148 -90
- package/dist/index.d.cts +118 -58
- package/dist/index.d.ts +118 -58
- package/dist/index.js +167 -112
- package/package.json +8 -6
package/dist/cli.cjs
CHANGED
package/dist/cli.js
CHANGED
package/dist/index.cjs
CHANGED
|
@@ -2983,6 +2983,7 @@ __export(src_exports, {
|
|
|
2983
2983
|
GLOB_ALL_SRC: () => GLOB_ALL_SRC,
|
|
2984
2984
|
GLOB_CSS: () => GLOB_CSS,
|
|
2985
2985
|
GLOB_EXCLUDE: () => GLOB_EXCLUDE,
|
|
2986
|
+
GLOB_GRAPHQL: () => GLOB_GRAPHQL,
|
|
2986
2987
|
GLOB_HTML: () => GLOB_HTML,
|
|
2987
2988
|
GLOB_JS: () => GLOB_JS,
|
|
2988
2989
|
GLOB_JSON: () => GLOB_JSON,
|
|
@@ -3000,6 +3001,7 @@ __export(src_exports, {
|
|
|
3000
3001
|
GLOB_TESTS: () => GLOB_TESTS,
|
|
3001
3002
|
GLOB_TOML: () => GLOB_TOML,
|
|
3002
3003
|
GLOB_TS: () => GLOB_TS,
|
|
3004
|
+
GLOB_TSCONFIG: () => GLOB_TSCONFIG,
|
|
3003
3005
|
GLOB_TSX: () => GLOB_TSX,
|
|
3004
3006
|
GLOB_YAML: () => GLOB_YAML,
|
|
3005
3007
|
combine: () => combine,
|
|
@@ -3033,7 +3035,8 @@ __export(src_exports, {
|
|
|
3033
3035
|
pluginTs: () => import_eslint_plugin.default,
|
|
3034
3036
|
pluginUnicorn: () => import_eslint_plugin_unicorn.default,
|
|
3035
3037
|
pluginUnusedImports: () => import_eslint_plugin_unused_imports.default,
|
|
3036
|
-
renameRules: () => renameRules
|
|
3038
|
+
renameRules: () => renameRules,
|
|
3039
|
+
uniqueStrings: () => uniqueStrings
|
|
3037
3040
|
});
|
|
3038
3041
|
module.exports = __toCommonJS(src_exports);
|
|
3039
3042
|
|
|
@@ -9901,86 +9904,6 @@ function resolvePackage(name, options = {}) {
|
|
|
9901
9904
|
}
|
|
9902
9905
|
}
|
|
9903
9906
|
|
|
9904
|
-
// src/lager.ts
|
|
9905
|
-
var levels = {
|
|
9906
|
-
trace: 10,
|
|
9907
|
-
debug: 20,
|
|
9908
|
-
info: 30,
|
|
9909
|
-
warn: 40,
|
|
9910
|
-
error: 50,
|
|
9911
|
-
fatal: 60
|
|
9912
|
-
};
|
|
9913
|
-
function isLagerLevel(level) {
|
|
9914
|
-
return level === "trace" || level === "debug" || level === "info" || level === "warn" || level === "error" || level === "fatal";
|
|
9915
|
-
}
|
|
9916
|
-
var Lager = class {
|
|
9917
|
-
_level = "info";
|
|
9918
|
-
id = "lager";
|
|
9919
|
-
levelNo = levels[this._level];
|
|
9920
|
-
prefix = "";
|
|
9921
|
-
constructor(options) {
|
|
9922
|
-
const { level, id, prefix } = {
|
|
9923
|
-
level: "info",
|
|
9924
|
-
id: "lager",
|
|
9925
|
-
prefix: "@jsse/eslint-config",
|
|
9926
|
-
...options
|
|
9927
|
-
};
|
|
9928
|
-
this.id = id;
|
|
9929
|
-
this._level = isLagerLevel(level) ? level : "info";
|
|
9930
|
-
this.levelNo = levels[this._level];
|
|
9931
|
-
this.prefix = prefix;
|
|
9932
|
-
this.log = this.log.bind(this);
|
|
9933
|
-
this.debug = this.debug.bind(this);
|
|
9934
|
-
}
|
|
9935
|
-
get level() {
|
|
9936
|
-
return this._level;
|
|
9937
|
-
}
|
|
9938
|
-
set level(level) {
|
|
9939
|
-
this._level = level;
|
|
9940
|
-
this.levelNo = levels[level];
|
|
9941
|
-
}
|
|
9942
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
9943
|
-
log(...args) {
|
|
9944
|
-
console.log(...args);
|
|
9945
|
-
}
|
|
9946
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
9947
|
-
trace(...args) {
|
|
9948
|
-
if (this.levelNo > levels.trace) {
|
|
9949
|
-
return;
|
|
9950
|
-
}
|
|
9951
|
-
console.trace(...args);
|
|
9952
|
-
}
|
|
9953
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
9954
|
-
debug(...args) {
|
|
9955
|
-
if (this.levelNo > levels.debug) {
|
|
9956
|
-
return;
|
|
9957
|
-
}
|
|
9958
|
-
console.debug(...args);
|
|
9959
|
-
}
|
|
9960
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
9961
|
-
info(...args) {
|
|
9962
|
-
if (this.levelNo > levels.info) {
|
|
9963
|
-
return;
|
|
9964
|
-
}
|
|
9965
|
-
console.info("[@jsse/eslint-config]", ...args);
|
|
9966
|
-
}
|
|
9967
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
9968
|
-
warn(...args) {
|
|
9969
|
-
if (this.levelNo > levels.warn) {
|
|
9970
|
-
return;
|
|
9971
|
-
}
|
|
9972
|
-
console.warn(...args);
|
|
9973
|
-
}
|
|
9974
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
9975
|
-
error(...args) {
|
|
9976
|
-
if (this.levelNo > levels.error) {
|
|
9977
|
-
return;
|
|
9978
|
-
}
|
|
9979
|
-
console.error(...args);
|
|
9980
|
-
}
|
|
9981
|
-
};
|
|
9982
|
-
var log = new Lager();
|
|
9983
|
-
|
|
9984
9907
|
// src/globs.ts
|
|
9985
9908
|
var GLOB_SRC_EXT = "?([cm])[jt]s?(x)";
|
|
9986
9909
|
var GLOB_JS_SRC_EXT = "?([cm])js?(x)";
|
|
@@ -9998,8 +9921,10 @@ var GLOB_JSON5 = "**/*.json5";
|
|
|
9998
9921
|
var GLOB_JSONC = "**/*.jsonc";
|
|
9999
9922
|
var GLOB_TOML = "**/*.toml";
|
|
10000
9923
|
var GLOB_MARKDOWN = "**/*.md";
|
|
9924
|
+
var GLOB_GRAPHQL = ["**/*.graphql", "**/*.gql"];
|
|
10001
9925
|
var GLOB_YAML = "**/*.y?(a)ml";
|
|
10002
9926
|
var GLOB_HTML = "**/*.htm?(l)";
|
|
9927
|
+
var GLOB_TSCONFIG = ["**/tsconfig.json", "**/tsconfig.*.json"];
|
|
10003
9928
|
var GLOB_MARKDOWN_CODE = `${GLOB_MARKDOWN}/${GLOB_SRC}`;
|
|
10004
9929
|
var GLOB_TESTS = [
|
|
10005
9930
|
`**/__tests__/**/*.${GLOB_SRC_EXT}`,
|
|
@@ -10088,8 +10013,23 @@ function isCI() {
|
|
|
10088
10013
|
function isInEditor() {
|
|
10089
10014
|
return !!((import_node_process3.default.env.VSCODE_PID || import_node_process3.default.env.JETBRAINS_IDE) && !isCI());
|
|
10090
10015
|
}
|
|
10016
|
+
function uniqueStrings(...strings) {
|
|
10017
|
+
const set = /* @__PURE__ */ new Set();
|
|
10018
|
+
for (const item of strings) {
|
|
10019
|
+
if (typeof item === "string") {
|
|
10020
|
+
set.add(item);
|
|
10021
|
+
} else {
|
|
10022
|
+
for (const str of item) {
|
|
10023
|
+
set.add(str);
|
|
10024
|
+
}
|
|
10025
|
+
}
|
|
10026
|
+
}
|
|
10027
|
+
return [...set];
|
|
10028
|
+
}
|
|
10091
10029
|
|
|
10092
10030
|
// src/plugins.ts
|
|
10031
|
+
var import_eslint_plugin = __toESM(require("@typescript-eslint/eslint-plugin"), 1);
|
|
10032
|
+
var parserTs = __toESM(require("@typescript-eslint/parser"), 1);
|
|
10093
10033
|
var import_eslint_plugin_antfu = __toESM(require("eslint-plugin-antfu"), 1);
|
|
10094
10034
|
var import_eslint_plugin_eslint_comments = __toESM(require("eslint-plugin-eslint-comments"), 1);
|
|
10095
10035
|
var pluginImport = __toESM(require("eslint-plugin-import-x"), 1);
|
|
@@ -10097,8 +10037,6 @@ var import_eslint_plugin_n = __toESM(require("eslint-plugin-n"), 1);
|
|
|
10097
10037
|
var import_eslint_plugin_perfectionist = __toESM(require("eslint-plugin-perfectionist"), 1);
|
|
10098
10038
|
var import_eslint_plugin_unicorn = __toESM(require("eslint-plugin-unicorn"), 1);
|
|
10099
10039
|
var import_eslint_plugin_unused_imports = __toESM(require("eslint-plugin-unused-imports"), 1);
|
|
10100
|
-
var import_eslint_plugin = __toESM(require("@typescript-eslint/eslint-plugin"), 1);
|
|
10101
|
-
var parserTs = __toESM(require("@typescript-eslint/parser"), 1);
|
|
10102
10040
|
async function importPluginReact() {
|
|
10103
10041
|
const pluginReact = await interopDefault2(import("eslint-plugin-react"));
|
|
10104
10042
|
return {
|
|
@@ -10263,7 +10201,7 @@ var imports = async (options) => {
|
|
|
10263
10201
|
"import/no-named-default": "error",
|
|
10264
10202
|
"import/no-self-import": "error",
|
|
10265
10203
|
"import/no-webpack-loader-syntax": "error",
|
|
10266
|
-
"import/order": "
|
|
10204
|
+
"import/order": "off",
|
|
10267
10205
|
...stylistic2 ? {
|
|
10268
10206
|
"import/newline-after-import": [
|
|
10269
10207
|
"error",
|
|
@@ -11224,6 +11162,39 @@ var perfectionist = async () => {
|
|
|
11224
11162
|
plugins: {
|
|
11225
11163
|
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
|
|
11226
11164
|
perfectionist: import_eslint_plugin_perfectionist.default
|
|
11165
|
+
},
|
|
11166
|
+
rules: {
|
|
11167
|
+
"perfectionist/sort-exports": [
|
|
11168
|
+
"error",
|
|
11169
|
+
{ order: "asc", type: "natural" }
|
|
11170
|
+
],
|
|
11171
|
+
"perfectionist/sort-imports": [
|
|
11172
|
+
"error",
|
|
11173
|
+
{
|
|
11174
|
+
groups: [
|
|
11175
|
+
"type",
|
|
11176
|
+
"builtin",
|
|
11177
|
+
"external",
|
|
11178
|
+
"internal-type",
|
|
11179
|
+
"internal",
|
|
11180
|
+
["parent-type", "sibling-type", "index-type"],
|
|
11181
|
+
["parent", "sibling", "index"],
|
|
11182
|
+
"object",
|
|
11183
|
+
"unknown"
|
|
11184
|
+
],
|
|
11185
|
+
newlinesBetween: "ignore",
|
|
11186
|
+
order: "asc",
|
|
11187
|
+
type: "natural"
|
|
11188
|
+
}
|
|
11189
|
+
],
|
|
11190
|
+
"perfectionist/sort-named-exports": [
|
|
11191
|
+
"error",
|
|
11192
|
+
{ order: "asc", type: "natural" }
|
|
11193
|
+
],
|
|
11194
|
+
"perfectionist/sort-named-imports": [
|
|
11195
|
+
"error",
|
|
11196
|
+
{ order: "asc", type: "natural" }
|
|
11197
|
+
]
|
|
11227
11198
|
}
|
|
11228
11199
|
}
|
|
11229
11200
|
];
|
|
@@ -11731,10 +11702,13 @@ var sortPackageJson = async () => {
|
|
|
11731
11702
|
};
|
|
11732
11703
|
|
|
11733
11704
|
// src/configs/sort-tsconfig.ts
|
|
11734
|
-
var
|
|
11705
|
+
var tsconfigGlobs = (extendGlobs) => {
|
|
11706
|
+
return extendGlobs === void 0 || extendGlobs.length === 0 ? GLOB_TSCONFIG : uniqueStrings(GLOB_TSCONFIG, extendGlobs);
|
|
11707
|
+
};
|
|
11708
|
+
var sortTsconfig = async (options) => {
|
|
11735
11709
|
return [
|
|
11736
11710
|
{
|
|
11737
|
-
files:
|
|
11711
|
+
files: tsconfigGlobs(options?.extendTsconfigGlobs),
|
|
11738
11712
|
name: "jsse/sort/tsconfig",
|
|
11739
11713
|
rules: {
|
|
11740
11714
|
"jsonc/sort-keys": [
|
|
@@ -12143,7 +12117,6 @@ function unicornOff() {
|
|
|
12143
12117
|
return {
|
|
12144
12118
|
"unicorn/catch-error-name": "off",
|
|
12145
12119
|
"unicorn/consistent-destructuring": "off",
|
|
12146
|
-
// "unicorn/no-array-for-each": "off",
|
|
12147
12120
|
"unicorn/no-array-reduce": "off",
|
|
12148
12121
|
"unicorn/no-nested-ternary": "off",
|
|
12149
12122
|
// conflicts with prettier
|
|
@@ -12257,7 +12230,7 @@ var unicorn = async () => {
|
|
|
12257
12230
|
// src/configs/vitest.ts
|
|
12258
12231
|
var vitest = async (options = {}) => {
|
|
12259
12232
|
const { overrides = {} } = options;
|
|
12260
|
-
const pluginVitest = await interopDefault2(import("eslint-plugin
|
|
12233
|
+
const pluginVitest = await interopDefault2(import("@vitest/eslint-plugin"));
|
|
12261
12234
|
return [
|
|
12262
12235
|
{
|
|
12263
12236
|
name: "jsse/vitest/setup",
|
|
@@ -12336,6 +12309,86 @@ var yml = async (options) => {
|
|
|
12336
12309
|
];
|
|
12337
12310
|
};
|
|
12338
12311
|
|
|
12312
|
+
// src/lager.ts
|
|
12313
|
+
var levels = {
|
|
12314
|
+
trace: 10,
|
|
12315
|
+
debug: 20,
|
|
12316
|
+
info: 30,
|
|
12317
|
+
warn: 40,
|
|
12318
|
+
error: 50,
|
|
12319
|
+
fatal: 60
|
|
12320
|
+
};
|
|
12321
|
+
function isLagerLevel(level) {
|
|
12322
|
+
return level === "trace" || level === "debug" || level === "info" || level === "warn" || level === "error" || level === "fatal";
|
|
12323
|
+
}
|
|
12324
|
+
var Lager = class {
|
|
12325
|
+
_level = "info";
|
|
12326
|
+
id = "lager";
|
|
12327
|
+
levelNo = levels[this._level];
|
|
12328
|
+
prefix = "";
|
|
12329
|
+
constructor(options) {
|
|
12330
|
+
const { level, id, prefix } = {
|
|
12331
|
+
level: "info",
|
|
12332
|
+
id: "lager",
|
|
12333
|
+
prefix: "@jsse/eslint-config",
|
|
12334
|
+
...options
|
|
12335
|
+
};
|
|
12336
|
+
this.id = id;
|
|
12337
|
+
this._level = isLagerLevel(level) ? level : "info";
|
|
12338
|
+
this.levelNo = levels[this._level];
|
|
12339
|
+
this.prefix = prefix;
|
|
12340
|
+
this.log = this.log.bind(this);
|
|
12341
|
+
this.debug = this.debug.bind(this);
|
|
12342
|
+
}
|
|
12343
|
+
get level() {
|
|
12344
|
+
return this._level;
|
|
12345
|
+
}
|
|
12346
|
+
set level(level) {
|
|
12347
|
+
this._level = level;
|
|
12348
|
+
this.levelNo = levels[level];
|
|
12349
|
+
}
|
|
12350
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
12351
|
+
log(...args) {
|
|
12352
|
+
console.log(...args);
|
|
12353
|
+
}
|
|
12354
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
12355
|
+
trace(...args) {
|
|
12356
|
+
if (this.levelNo > levels.trace) {
|
|
12357
|
+
return;
|
|
12358
|
+
}
|
|
12359
|
+
console.trace(...args);
|
|
12360
|
+
}
|
|
12361
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
12362
|
+
debug(...args) {
|
|
12363
|
+
if (this.levelNo > levels.debug) {
|
|
12364
|
+
return;
|
|
12365
|
+
}
|
|
12366
|
+
console.debug(...args);
|
|
12367
|
+
}
|
|
12368
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
12369
|
+
info(...args) {
|
|
12370
|
+
if (this.levelNo > levels.info) {
|
|
12371
|
+
return;
|
|
12372
|
+
}
|
|
12373
|
+
console.info("[@jsse/eslint-config]", ...args);
|
|
12374
|
+
}
|
|
12375
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
12376
|
+
warn(...args) {
|
|
12377
|
+
if (this.levelNo > levels.warn) {
|
|
12378
|
+
return;
|
|
12379
|
+
}
|
|
12380
|
+
console.warn(...args);
|
|
12381
|
+
}
|
|
12382
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
12383
|
+
error(...args) {
|
|
12384
|
+
if (this.levelNo > levels.error) {
|
|
12385
|
+
return;
|
|
12386
|
+
}
|
|
12387
|
+
console.error(...args);
|
|
12388
|
+
}
|
|
12389
|
+
};
|
|
12390
|
+
var log = new Lager();
|
|
12391
|
+
|
|
12339
12392
|
// src/slow.ts
|
|
12340
12393
|
var slowRules = [
|
|
12341
12394
|
"@typescript-eslint/no-misused-promises",
|
|
@@ -12517,7 +12570,9 @@ async function jsse(options = {}, ...userConfigs) {
|
|
|
12517
12570
|
stylistic: stylisticOptions
|
|
12518
12571
|
}),
|
|
12519
12572
|
sortPackageJson(),
|
|
12520
|
-
sortTsconfig(
|
|
12573
|
+
sortTsconfig({
|
|
12574
|
+
extendTsconfigGlobs: normalizedOptions.extendTsconfigLintGlobs
|
|
12575
|
+
})
|
|
12521
12576
|
);
|
|
12522
12577
|
}
|
|
12523
12578
|
if (normalizedOptions.tailwind) {
|
|
@@ -12633,6 +12688,7 @@ function jsseReact() {
|
|
|
12633
12688
|
GLOB_ALL_SRC,
|
|
12634
12689
|
GLOB_CSS,
|
|
12635
12690
|
GLOB_EXCLUDE,
|
|
12691
|
+
GLOB_GRAPHQL,
|
|
12636
12692
|
GLOB_HTML,
|
|
12637
12693
|
GLOB_JS,
|
|
12638
12694
|
GLOB_JSON,
|
|
@@ -12650,6 +12706,7 @@ function jsseReact() {
|
|
|
12650
12706
|
GLOB_TESTS,
|
|
12651
12707
|
GLOB_TOML,
|
|
12652
12708
|
GLOB_TS,
|
|
12709
|
+
GLOB_TSCONFIG,
|
|
12653
12710
|
GLOB_TSX,
|
|
12654
12711
|
GLOB_YAML,
|
|
12655
12712
|
combine,
|
|
@@ -12682,5 +12739,6 @@ function jsseReact() {
|
|
|
12682
12739
|
pluginTs,
|
|
12683
12740
|
pluginUnicorn,
|
|
12684
12741
|
pluginUnusedImports,
|
|
12685
|
-
renameRules
|
|
12742
|
+
renameRules,
|
|
12743
|
+
uniqueStrings
|
|
12686
12744
|
});
|