@jsse/eslint-config 0.2.10 → 0.2.12
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 +158 -90
- package/dist/index.d.cts +118 -58
- package/dist/index.d.ts +118 -58
- package/dist/index.js +177 -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,49 @@ 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
|
+
customGroups: {
|
|
11175
|
+
type: {
|
|
11176
|
+
react: ["react", "react-*"]
|
|
11177
|
+
},
|
|
11178
|
+
value: {
|
|
11179
|
+
react: ["react", "react-*"]
|
|
11180
|
+
}
|
|
11181
|
+
},
|
|
11182
|
+
groups: [
|
|
11183
|
+
"react",
|
|
11184
|
+
// react and react-* packages come first if they exist
|
|
11185
|
+
"type",
|
|
11186
|
+
"builtin",
|
|
11187
|
+
"external",
|
|
11188
|
+
"internal-type",
|
|
11189
|
+
"internal",
|
|
11190
|
+
["parent-type", "sibling-type", "index-type"],
|
|
11191
|
+
["parent", "sibling", "index"],
|
|
11192
|
+
"object",
|
|
11193
|
+
"unknown"
|
|
11194
|
+
],
|
|
11195
|
+
newlinesBetween: "ignore",
|
|
11196
|
+
order: "asc",
|
|
11197
|
+
type: "natural"
|
|
11198
|
+
}
|
|
11199
|
+
],
|
|
11200
|
+
"perfectionist/sort-named-exports": [
|
|
11201
|
+
"error",
|
|
11202
|
+
{ order: "asc", type: "natural" }
|
|
11203
|
+
],
|
|
11204
|
+
"perfectionist/sort-named-imports": [
|
|
11205
|
+
"error",
|
|
11206
|
+
{ order: "asc", type: "natural" }
|
|
11207
|
+
]
|
|
11227
11208
|
}
|
|
11228
11209
|
}
|
|
11229
11210
|
];
|
|
@@ -11731,10 +11712,13 @@ var sortPackageJson = async () => {
|
|
|
11731
11712
|
};
|
|
11732
11713
|
|
|
11733
11714
|
// src/configs/sort-tsconfig.ts
|
|
11734
|
-
var
|
|
11715
|
+
var tsconfigGlobs = (extendGlobs) => {
|
|
11716
|
+
return extendGlobs === void 0 || extendGlobs.length === 0 ? GLOB_TSCONFIG : uniqueStrings(GLOB_TSCONFIG, extendGlobs);
|
|
11717
|
+
};
|
|
11718
|
+
var sortTsconfig = async (options) => {
|
|
11735
11719
|
return [
|
|
11736
11720
|
{
|
|
11737
|
-
files:
|
|
11721
|
+
files: tsconfigGlobs(options?.extendTsconfigGlobs),
|
|
11738
11722
|
name: "jsse/sort/tsconfig",
|
|
11739
11723
|
rules: {
|
|
11740
11724
|
"jsonc/sort-keys": [
|
|
@@ -12143,7 +12127,6 @@ function unicornOff() {
|
|
|
12143
12127
|
return {
|
|
12144
12128
|
"unicorn/catch-error-name": "off",
|
|
12145
12129
|
"unicorn/consistent-destructuring": "off",
|
|
12146
|
-
// "unicorn/no-array-for-each": "off",
|
|
12147
12130
|
"unicorn/no-array-reduce": "off",
|
|
12148
12131
|
"unicorn/no-nested-ternary": "off",
|
|
12149
12132
|
// conflicts with prettier
|
|
@@ -12257,7 +12240,7 @@ var unicorn = async () => {
|
|
|
12257
12240
|
// src/configs/vitest.ts
|
|
12258
12241
|
var vitest = async (options = {}) => {
|
|
12259
12242
|
const { overrides = {} } = options;
|
|
12260
|
-
const pluginVitest = await interopDefault2(import("eslint-plugin
|
|
12243
|
+
const pluginVitest = await interopDefault2(import("@vitest/eslint-plugin"));
|
|
12261
12244
|
return [
|
|
12262
12245
|
{
|
|
12263
12246
|
name: "jsse/vitest/setup",
|
|
@@ -12336,6 +12319,86 @@ var yml = async (options) => {
|
|
|
12336
12319
|
];
|
|
12337
12320
|
};
|
|
12338
12321
|
|
|
12322
|
+
// src/lager.ts
|
|
12323
|
+
var levels = {
|
|
12324
|
+
trace: 10,
|
|
12325
|
+
debug: 20,
|
|
12326
|
+
info: 30,
|
|
12327
|
+
warn: 40,
|
|
12328
|
+
error: 50,
|
|
12329
|
+
fatal: 60
|
|
12330
|
+
};
|
|
12331
|
+
function isLagerLevel(level) {
|
|
12332
|
+
return level === "trace" || level === "debug" || level === "info" || level === "warn" || level === "error" || level === "fatal";
|
|
12333
|
+
}
|
|
12334
|
+
var Lager = class {
|
|
12335
|
+
_level = "info";
|
|
12336
|
+
id = "lager";
|
|
12337
|
+
levelNo = levels[this._level];
|
|
12338
|
+
prefix = "";
|
|
12339
|
+
constructor(options) {
|
|
12340
|
+
const { level, id, prefix } = {
|
|
12341
|
+
level: "info",
|
|
12342
|
+
id: "lager",
|
|
12343
|
+
prefix: "@jsse/eslint-config",
|
|
12344
|
+
...options
|
|
12345
|
+
};
|
|
12346
|
+
this.id = id;
|
|
12347
|
+
this._level = isLagerLevel(level) ? level : "info";
|
|
12348
|
+
this.levelNo = levels[this._level];
|
|
12349
|
+
this.prefix = prefix;
|
|
12350
|
+
this.log = this.log.bind(this);
|
|
12351
|
+
this.debug = this.debug.bind(this);
|
|
12352
|
+
}
|
|
12353
|
+
get level() {
|
|
12354
|
+
return this._level;
|
|
12355
|
+
}
|
|
12356
|
+
set level(level) {
|
|
12357
|
+
this._level = level;
|
|
12358
|
+
this.levelNo = levels[level];
|
|
12359
|
+
}
|
|
12360
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
12361
|
+
log(...args) {
|
|
12362
|
+
console.log(...args);
|
|
12363
|
+
}
|
|
12364
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
12365
|
+
trace(...args) {
|
|
12366
|
+
if (this.levelNo > levels.trace) {
|
|
12367
|
+
return;
|
|
12368
|
+
}
|
|
12369
|
+
console.trace(...args);
|
|
12370
|
+
}
|
|
12371
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
12372
|
+
debug(...args) {
|
|
12373
|
+
if (this.levelNo > levels.debug) {
|
|
12374
|
+
return;
|
|
12375
|
+
}
|
|
12376
|
+
console.debug(...args);
|
|
12377
|
+
}
|
|
12378
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
12379
|
+
info(...args) {
|
|
12380
|
+
if (this.levelNo > levels.info) {
|
|
12381
|
+
return;
|
|
12382
|
+
}
|
|
12383
|
+
console.info("[@jsse/eslint-config]", ...args);
|
|
12384
|
+
}
|
|
12385
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
12386
|
+
warn(...args) {
|
|
12387
|
+
if (this.levelNo > levels.warn) {
|
|
12388
|
+
return;
|
|
12389
|
+
}
|
|
12390
|
+
console.warn(...args);
|
|
12391
|
+
}
|
|
12392
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
12393
|
+
error(...args) {
|
|
12394
|
+
if (this.levelNo > levels.error) {
|
|
12395
|
+
return;
|
|
12396
|
+
}
|
|
12397
|
+
console.error(...args);
|
|
12398
|
+
}
|
|
12399
|
+
};
|
|
12400
|
+
var log = new Lager();
|
|
12401
|
+
|
|
12339
12402
|
// src/slow.ts
|
|
12340
12403
|
var slowRules = [
|
|
12341
12404
|
"@typescript-eslint/no-misused-promises",
|
|
@@ -12517,7 +12580,9 @@ async function jsse(options = {}, ...userConfigs) {
|
|
|
12517
12580
|
stylistic: stylisticOptions
|
|
12518
12581
|
}),
|
|
12519
12582
|
sortPackageJson(),
|
|
12520
|
-
sortTsconfig(
|
|
12583
|
+
sortTsconfig({
|
|
12584
|
+
extendTsconfigGlobs: normalizedOptions.extendTsconfigLintGlobs
|
|
12585
|
+
})
|
|
12521
12586
|
);
|
|
12522
12587
|
}
|
|
12523
12588
|
if (normalizedOptions.tailwind) {
|
|
@@ -12633,6 +12698,7 @@ function jsseReact() {
|
|
|
12633
12698
|
GLOB_ALL_SRC,
|
|
12634
12699
|
GLOB_CSS,
|
|
12635
12700
|
GLOB_EXCLUDE,
|
|
12701
|
+
GLOB_GRAPHQL,
|
|
12636
12702
|
GLOB_HTML,
|
|
12637
12703
|
GLOB_JS,
|
|
12638
12704
|
GLOB_JSON,
|
|
@@ -12650,6 +12716,7 @@ function jsseReact() {
|
|
|
12650
12716
|
GLOB_TESTS,
|
|
12651
12717
|
GLOB_TOML,
|
|
12652
12718
|
GLOB_TS,
|
|
12719
|
+
GLOB_TSCONFIG,
|
|
12653
12720
|
GLOB_TSX,
|
|
12654
12721
|
GLOB_YAML,
|
|
12655
12722
|
combine,
|
|
@@ -12682,5 +12749,6 @@ function jsseReact() {
|
|
|
12682
12749
|
pluginTs,
|
|
12683
12750
|
pluginUnicorn,
|
|
12684
12751
|
pluginUnusedImports,
|
|
12685
|
-
renameRules
|
|
12752
|
+
renameRules,
|
|
12753
|
+
uniqueStrings
|
|
12686
12754
|
});
|