@jsse/eslint-config 0.2.19 → 0.2.21
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 +1 -1
- package/dist/cli.cjs +1 -1
- package/dist/cli.js +1 -1
- package/dist/esm/cli.d.ts +1 -0
- package/dist/esm/cli.js +96 -0
- package/dist/esm/cli.js.map +1 -0
- package/dist/esm/config-fns.d.ts +56 -0
- package/dist/esm/config-fns.js +76 -0
- package/dist/esm/config-fns.js.map +1 -0
- package/dist/esm/configs/antfu.d.ts +4 -0
- package/dist/esm/configs/antfu.js +31 -0
- package/dist/esm/configs/antfu.js.map +1 -0
- package/dist/esm/configs/comments.d.ts +2 -0
- package/dist/esm/configs/comments.js +17 -0
- package/dist/esm/configs/comments.js.map +1 -0
- package/dist/esm/configs/gql.d.ts +2 -0
- package/dist/esm/configs/gql.js +5 -0
- package/dist/esm/configs/gql.js.map +1 -0
- package/dist/esm/configs/ignores.d.ts +2 -0
- package/dist/esm/configs/ignores.js +10 -0
- package/dist/esm/configs/ignores.js.map +1 -0
- package/dist/esm/configs/imports.d.ts +2 -0
- package/dist/esm/configs/imports.js +30 -0
- package/dist/esm/configs/imports.js.map +1 -0
- package/dist/esm/configs/javascript.d.ts +6 -0
- package/dist/esm/configs/javascript.js +263 -0
- package/dist/esm/configs/javascript.js.map +1 -0
- package/dist/esm/configs/jsdoc.d.ts +2 -0
- package/dist/esm/configs/jsdoc.js +32 -0
- package/dist/esm/configs/jsdoc.js.map +1 -0
- package/dist/esm/configs/jsonc.d.ts +4 -0
- package/dist/esm/configs/jsonc.js +77 -0
- package/dist/esm/configs/jsonc.js.map +1 -0
- package/dist/esm/configs/markdown.d.ts +4 -0
- package/dist/esm/configs/markdown.js +123 -0
- package/dist/esm/configs/markdown.js.map +1 -0
- package/dist/esm/configs/n.d.ts +2 -0
- package/dist/esm/configs/n.js +22 -0
- package/dist/esm/configs/n.js.map +1 -0
- package/dist/esm/configs/no-only-tests.d.ts +4 -0
- package/dist/esm/configs/no-only-tests.js +32 -0
- package/dist/esm/configs/no-only-tests.js.map +1 -0
- package/dist/esm/configs/perfectionist.d.ts +7 -0
- package/dist/esm/configs/perfectionist.js +61 -0
- package/dist/esm/configs/perfectionist.js.map +1 -0
- package/dist/esm/configs/prettier.d.ts +7 -0
- package/dist/esm/configs/prettier.js +127 -0
- package/dist/esm/configs/prettier.js.map +1 -0
- package/dist/esm/configs/react.d.ts +6 -0
- package/dist/esm/configs/react.js +302 -0
- package/dist/esm/configs/react.js.map +1 -0
- package/dist/esm/configs/sort-package-json.d.ts +7 -0
- package/dist/esm/configs/sort-package-json.js +90 -0
- package/dist/esm/configs/sort-package-json.js.map +1 -0
- package/dist/esm/configs/sort-tsconfig.d.ts +14 -0
- package/dist/esm/configs/sort-tsconfig.js +134 -0
- package/dist/esm/configs/sort-tsconfig.js.map +1 -0
- package/dist/esm/configs/stylistic.d.ts +2 -0
- package/dist/esm/configs/stylistic.js +38 -0
- package/dist/esm/configs/stylistic.js.map +1 -0
- package/dist/esm/configs/tailwind.d.ts +2 -0
- package/dist/esm/configs/tailwind.js +49 -0
- package/dist/esm/configs/tailwind.js.map +1 -0
- package/dist/esm/configs/toml.d.ts +2 -0
- package/dist/esm/configs/toml.js +51 -0
- package/dist/esm/configs/toml.js.map +1 -0
- package/dist/esm/configs/ts/parser.d.ts +7 -0
- package/dist/esm/configs/ts/parser.js +66 -0
- package/dist/esm/configs/ts/parser.js.map +1 -0
- package/dist/esm/configs/ts/requires-type-checking.d.ts +1 -0
- package/dist/esm/configs/ts/requires-type-checking.js +58 -0
- package/dist/esm/configs/ts/requires-type-checking.js.map +1 -0
- package/dist/esm/configs/ts/typescript-language-options.d.ts +2 -0
- package/dist/esm/configs/ts/typescript-language-options.js +23 -0
- package/dist/esm/configs/ts/typescript-language-options.js.map +1 -0
- package/dist/esm/configs/ts/typescript-rules.d.ts +6 -0
- package/dist/esm/configs/ts/typescript-rules.js +416 -0
- package/dist/esm/configs/ts/typescript-rules.js.map +1 -0
- package/dist/esm/configs/ts/typescript.d.ts +4 -0
- package/dist/esm/configs/ts/typescript.js +110 -0
- package/dist/esm/configs/ts/typescript.js.map +1 -0
- package/dist/esm/configs/tsdoc.d.ts +2 -0
- package/dist/esm/configs/tsdoc.js +17 -0
- package/dist/esm/configs/tsdoc.js.map +1 -0
- package/dist/esm/configs/unicorn.d.ts +2 -0
- package/dist/esm/configs/unicorn.js +116 -0
- package/dist/esm/configs/unicorn.js.map +1 -0
- package/dist/esm/configs/vitest.d.ts +4 -0
- package/dist/esm/configs/vitest.js +30 -0
- package/dist/esm/configs/vitest.js.map +1 -0
- package/dist/esm/configs/yml.d.ts +4 -0
- package/dist/esm/configs/yml.js +52 -0
- package/dist/esm/configs/yml.js.map +1 -0
- package/dist/esm/const.d.ts +5 -0
- package/dist/esm/const.js +12 -0
- package/dist/esm/const.js.map +1 -0
- package/dist/esm/define-config.d.ts +7 -0
- package/dist/esm/define-config.js +234 -0
- package/dist/esm/define-config.js.map +1 -0
- package/dist/esm/dev.d.ts +4 -0
- package/dist/esm/dev.js +26 -0
- package/dist/esm/dev.js.map +1 -0
- package/dist/esm/fixable.d.ts +1 -0
- package/dist/esm/fixable.js +390 -0
- package/dist/esm/fixable.js.map +1 -0
- package/dist/esm/globs.d.ts +25 -0
- package/dist/esm/globs.js +74 -0
- package/dist/esm/globs.js.map +1 -0
- package/dist/esm/index.d.ts +8 -0
- package/dist/esm/index.js +9 -0
- package/dist/esm/index.js.map +1 -0
- package/dist/esm/lager.d.ts +31 -0
- package/dist/esm/lager.js +87 -0
- package/dist/esm/lager.js.map +1 -0
- package/dist/esm/plugindex.d.ts +7 -0
- package/dist/esm/plugindex.js +61 -0
- package/dist/esm/plugindex.js.map +1 -0
- package/dist/esm/plugins-all.d.ts +23 -0
- package/dist/esm/plugins-all.js +27 -0
- package/dist/esm/plugins-all.js.map +1 -0
- package/dist/esm/plugins.d.ts +983 -0
- package/dist/esm/plugins.js +113 -0
- package/dist/esm/plugins.js.map +1 -0
- package/dist/esm/presets.d.ts +2 -0
- package/dist/esm/presets.js +13 -0
- package/dist/esm/presets.js.map +1 -0
- package/dist/esm/types.d.ts +255 -0
- package/dist/esm/types.js +2 -0
- package/dist/esm/types.js.map +1 -0
- package/dist/esm/utils.d.ts +51 -0
- package/dist/esm/utils.js +157 -0
- package/dist/esm/utils.js.map +1 -0
- package/dist/index.cjs +908 -307
- package/dist/index.d.cts +207 -25
- package/dist/index.d.ts +207 -25
- package/dist/index.js +909 -315
- package/package.json +23 -14
package/dist/index.cjs
CHANGED
|
@@ -30,9 +30,9 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
|
|
|
30
30
|
));
|
|
31
31
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
32
32
|
|
|
33
|
-
// node_modules/.pnpm/globals@15.
|
|
33
|
+
// node_modules/.pnpm/globals@15.11.0/node_modules/globals/globals.json
|
|
34
34
|
var require_globals = __commonJS({
|
|
35
|
-
"node_modules/.pnpm/globals@15.
|
|
35
|
+
"node_modules/.pnpm/globals@15.11.0/node_modules/globals/globals.json"(exports2, module2) {
|
|
36
36
|
module2.exports = {
|
|
37
37
|
amd: {
|
|
38
38
|
define: false,
|
|
@@ -1960,6 +1960,38 @@ var require_globals = __commonJS({
|
|
|
1960
1960
|
WeakRef: false,
|
|
1961
1961
|
WeakSet: false
|
|
1962
1962
|
},
|
|
1963
|
+
es3: {
|
|
1964
|
+
Array: false,
|
|
1965
|
+
Boolean: false,
|
|
1966
|
+
Date: false,
|
|
1967
|
+
decodeURI: false,
|
|
1968
|
+
decodeURIComponent: false,
|
|
1969
|
+
encodeURI: false,
|
|
1970
|
+
encodeURIComponent: false,
|
|
1971
|
+
Error: false,
|
|
1972
|
+
escape: false,
|
|
1973
|
+
eval: false,
|
|
1974
|
+
EvalError: false,
|
|
1975
|
+
Function: false,
|
|
1976
|
+
Infinity: false,
|
|
1977
|
+
isFinite: false,
|
|
1978
|
+
isNaN: false,
|
|
1979
|
+
Math: false,
|
|
1980
|
+
NaN: false,
|
|
1981
|
+
Number: false,
|
|
1982
|
+
Object: false,
|
|
1983
|
+
parseFloat: false,
|
|
1984
|
+
parseInt: false,
|
|
1985
|
+
RangeError: false,
|
|
1986
|
+
ReferenceError: false,
|
|
1987
|
+
RegExp: false,
|
|
1988
|
+
String: false,
|
|
1989
|
+
SyntaxError: false,
|
|
1990
|
+
TypeError: false,
|
|
1991
|
+
undefined: false,
|
|
1992
|
+
unescape: false,
|
|
1993
|
+
URIError: false
|
|
1994
|
+
},
|
|
1963
1995
|
es5: {
|
|
1964
1996
|
Array: false,
|
|
1965
1997
|
Boolean: false,
|
|
@@ -2974,9 +3006,9 @@ var require_globals = __commonJS({
|
|
|
2974
3006
|
}
|
|
2975
3007
|
});
|
|
2976
3008
|
|
|
2977
|
-
// node_modules/.pnpm/globals@15.
|
|
3009
|
+
// node_modules/.pnpm/globals@15.11.0/node_modules/globals/index.js
|
|
2978
3010
|
var require_globals2 = __commonJS({
|
|
2979
|
-
"node_modules/.pnpm/globals@15.
|
|
3011
|
+
"node_modules/.pnpm/globals@15.11.0/node_modules/globals/index.js"(exports2, module2) {
|
|
2980
3012
|
"use strict";
|
|
2981
3013
|
module2.exports = require_globals();
|
|
2982
3014
|
}
|
|
@@ -2999,6 +3031,7 @@ __export(src_exports, {
|
|
|
2999
3031
|
GLOB_LESS: () => GLOB_LESS,
|
|
3000
3032
|
GLOB_MARKDOWN: () => GLOB_MARKDOWN,
|
|
3001
3033
|
GLOB_MARKDOWN_CODE: () => GLOB_MARKDOWN_CODE,
|
|
3034
|
+
GLOB_MARKDOWN_IN_MARKDOWN: () => GLOB_MARKDOWN_IN_MARKDOWN,
|
|
3002
3035
|
GLOB_SCSS: () => GLOB_SCSS,
|
|
3003
3036
|
GLOB_SRC: () => GLOB_SRC,
|
|
3004
3037
|
GLOB_SRC_EXT: () => GLOB_SRC_EXT,
|
|
@@ -3010,9 +3043,12 @@ __export(src_exports, {
|
|
|
3010
3043
|
GLOB_TSX: () => GLOB_TSX,
|
|
3011
3044
|
GLOB_YAML: () => GLOB_YAML,
|
|
3012
3045
|
SLOW_RULES: () => SLOW_RULES,
|
|
3046
|
+
changeRuleEntrySeverity: () => changeRuleEntrySeverity,
|
|
3013
3047
|
combine: () => combine,
|
|
3014
3048
|
combineAsync: () => combineAsync,
|
|
3015
3049
|
default: () => jsse,
|
|
3050
|
+
defineConfig: () => defineConfig,
|
|
3051
|
+
error2warn: () => error2warn,
|
|
3016
3052
|
importJsoncLibs: () => importJsoncLibs,
|
|
3017
3053
|
importParserJsonc: () => importParserJsonc,
|
|
3018
3054
|
importPluginJsdoc: () => importPluginJsdoc,
|
|
@@ -3031,7 +3067,7 @@ __export(src_exports, {
|
|
|
3031
3067
|
isInEditor: () => isInEditor,
|
|
3032
3068
|
jsse: () => jsse,
|
|
3033
3069
|
jsseReact: () => jsseReact,
|
|
3034
|
-
|
|
3070
|
+
parserPlain: () => parserPlain,
|
|
3035
3071
|
parserTs: () => parserTs,
|
|
3036
3072
|
pluginAntfu: () => import_eslint_plugin_antfu.default,
|
|
3037
3073
|
pluginEslintComments: () => import_eslint_plugin_eslint_comments.default,
|
|
@@ -3042,7 +3078,10 @@ __export(src_exports, {
|
|
|
3042
3078
|
pluginUnicorn: () => import_eslint_plugin_unicorn.default,
|
|
3043
3079
|
pluginUnusedImports: () => import_eslint_plugin_unused_imports.default,
|
|
3044
3080
|
renameRules: () => renameRules,
|
|
3045
|
-
|
|
3081
|
+
safeImportPluginTailwind: () => safeImportPluginTailwind,
|
|
3082
|
+
turnOffRules: () => turnOffRules,
|
|
3083
|
+
uniqueStrings: () => uniqueStrings,
|
|
3084
|
+
warn2error: () => warn2error
|
|
3046
3085
|
});
|
|
3047
3086
|
module.exports = __toCommonJS(src_exports);
|
|
3048
3087
|
|
|
@@ -3056,7 +3095,7 @@ var SLOW_RULES = [
|
|
|
3056
3095
|
"unicorn/no-unnecessary-polyfills"
|
|
3057
3096
|
];
|
|
3058
3097
|
|
|
3059
|
-
// src/
|
|
3098
|
+
// src/define-config.ts
|
|
3060
3099
|
var import_node_fs3 = __toESM(require("fs"), 1);
|
|
3061
3100
|
var import_node_process6 = __toESM(require("process"), 1);
|
|
3062
3101
|
|
|
@@ -6169,11 +6208,11 @@ var pp$4 = Parser.prototype;
|
|
|
6169
6208
|
pp$4.raise = function(pos, message) {
|
|
6170
6209
|
var loc = getLineInfo(this.input, pos);
|
|
6171
6210
|
message += " (" + loc.line + ":" + loc.column + ")";
|
|
6172
|
-
var
|
|
6173
|
-
|
|
6174
|
-
|
|
6175
|
-
|
|
6176
|
-
throw
|
|
6211
|
+
var err2 = new SyntaxError(message);
|
|
6212
|
+
err2.pos = pos;
|
|
6213
|
+
err2.loc = loc;
|
|
6214
|
+
err2.raisedAt = this.pos;
|
|
6215
|
+
throw err2;
|
|
6177
6216
|
};
|
|
6178
6217
|
pp$4.raiseRecoverable = pp$4.raise;
|
|
6179
6218
|
pp$4.curPosition = function() {
|
|
@@ -8243,11 +8282,11 @@ pp.tryReadTemplateToken = function() {
|
|
|
8243
8282
|
this.inTemplateElement = true;
|
|
8244
8283
|
try {
|
|
8245
8284
|
this.readTmplToken();
|
|
8246
|
-
} catch (
|
|
8247
|
-
if (
|
|
8285
|
+
} catch (err2) {
|
|
8286
|
+
if (err2 === INVALID_TEMPLATE_ESCAPE_ERROR) {
|
|
8248
8287
|
this.readInvalidTemplateToken();
|
|
8249
8288
|
} else {
|
|
8250
|
-
throw
|
|
8289
|
+
throw err2;
|
|
8251
8290
|
}
|
|
8252
8291
|
}
|
|
8253
8292
|
this.inTemplateElement = false;
|
|
@@ -8486,11 +8525,11 @@ Parser.acorn = {
|
|
|
8486
8525
|
nonASCIIwhitespace
|
|
8487
8526
|
};
|
|
8488
8527
|
|
|
8489
|
-
// node_modules/.pnpm/mlly@1.7.
|
|
8528
|
+
// node_modules/.pnpm/mlly@1.7.2/node_modules/mlly/dist/index.mjs
|
|
8490
8529
|
var import_node_module = require("module");
|
|
8491
8530
|
var import_node_fs = __toESM(require("fs"), 1);
|
|
8492
8531
|
|
|
8493
|
-
// node_modules/.pnpm/ufo@1.5.
|
|
8532
|
+
// node_modules/.pnpm/ufo@1.5.4/node_modules/ufo/dist/index.mjs
|
|
8494
8533
|
var r = String.fromCharCode;
|
|
8495
8534
|
var TRAILING_SLASH_RE = /\/$|\/\?|\/#/;
|
|
8496
8535
|
var JOIN_LEADING_SLASH_RE = /^\.?\//;
|
|
@@ -8543,7 +8582,7 @@ var isAbsolute = function(p) {
|
|
|
8543
8582
|
return _IS_ABSOLUTE_RE.test(p);
|
|
8544
8583
|
};
|
|
8545
8584
|
|
|
8546
|
-
// node_modules/.pnpm/mlly@1.7.
|
|
8585
|
+
// node_modules/.pnpm/mlly@1.7.2/node_modules/mlly/dist/index.mjs
|
|
8547
8586
|
var import_node_url = require("url");
|
|
8548
8587
|
var import_node_assert = __toESM(require("assert"), 1);
|
|
8549
8588
|
var import_node_process = __toESM(require("process"), 1);
|
|
@@ -9858,7 +9897,7 @@ function _resolve(id, options = {}) {
|
|
|
9858
9897
|
for (const prefix of ["", "/index"]) {
|
|
9859
9898
|
for (const extension of options.extensions || DEFAULT_EXTENSIONS) {
|
|
9860
9899
|
resolved = _tryModuleResolve(
|
|
9861
|
-
id
|
|
9900
|
+
joinURL(id, prefix) + extension,
|
|
9862
9901
|
url,
|
|
9863
9902
|
conditionsSet
|
|
9864
9903
|
);
|
|
@@ -9920,136 +9959,649 @@ function resolvePackage(name, options = {}) {
|
|
|
9920
9959
|
}
|
|
9921
9960
|
}
|
|
9922
9961
|
|
|
9923
|
-
//
|
|
9924
|
-
var
|
|
9925
|
-
|
|
9926
|
-
|
|
9927
|
-
var
|
|
9928
|
-
|
|
9929
|
-
|
|
9930
|
-
|
|
9931
|
-
|
|
9932
|
-
|
|
9933
|
-
|
|
9934
|
-
|
|
9935
|
-
|
|
9936
|
-
|
|
9937
|
-
|
|
9938
|
-
|
|
9939
|
-
|
|
9940
|
-
|
|
9941
|
-
var GLOB_YAML = "**/*.y?(a)ml";
|
|
9942
|
-
var GLOB_HTML = "**/*.htm?(l)";
|
|
9943
|
-
var GLOB_TSCONFIG = ["**/tsconfig.json", "**/tsconfig.*.json"];
|
|
9944
|
-
var GLOB_MARKDOWN_CODE = `${GLOB_MARKDOWN}/${GLOB_SRC}`;
|
|
9945
|
-
var GLOB_TESTS = [
|
|
9946
|
-
`**/__tests__/**/*.${GLOB_SRC_EXT}`,
|
|
9947
|
-
`**/*.spec.${GLOB_SRC_EXT}`,
|
|
9948
|
-
`**/*.test.${GLOB_SRC_EXT}`,
|
|
9949
|
-
`**/*.bench.${GLOB_SRC_EXT}`,
|
|
9950
|
-
`**/*.benchmark.${GLOB_SRC_EXT}`
|
|
9951
|
-
];
|
|
9952
|
-
var GLOB_ALL_SRC = [
|
|
9953
|
-
GLOB_SRC,
|
|
9954
|
-
GLOB_STYLE,
|
|
9955
|
-
GLOB_JSON,
|
|
9956
|
-
GLOB_JSON5,
|
|
9957
|
-
GLOB_MARKDOWN,
|
|
9958
|
-
GLOB_YAML,
|
|
9959
|
-
GLOB_HTML
|
|
9960
|
-
];
|
|
9961
|
-
var GLOB_EXCLUDE = [
|
|
9962
|
-
"**/__snapshots__",
|
|
9963
|
-
"**/.cache",
|
|
9964
|
-
"**/.changeset",
|
|
9965
|
-
"**/.history",
|
|
9966
|
-
"**/.idea",
|
|
9967
|
-
"**/.next",
|
|
9968
|
-
"**/.nuxt",
|
|
9969
|
-
"**/.output",
|
|
9970
|
-
"**/.temp",
|
|
9971
|
-
"**/.tmp",
|
|
9972
|
-
"**/.vercel",
|
|
9973
|
-
"**/.vite-inspect",
|
|
9974
|
-
"**/.vitepress/cache",
|
|
9975
|
-
"**/*.bak",
|
|
9976
|
-
"**/*.min.*",
|
|
9977
|
-
"**/.yarn",
|
|
9978
|
-
"**/.pnp.*",
|
|
9979
|
-
"**/auto-import?(s).d.ts",
|
|
9980
|
-
"**/bun.lockb",
|
|
9981
|
-
"**/CHANGELOG*.md",
|
|
9982
|
-
"**/components.d.ts",
|
|
9983
|
-
"**/coverage",
|
|
9984
|
-
"**/dist",
|
|
9985
|
-
"**/LICENSE*",
|
|
9986
|
-
"**/node_modules",
|
|
9987
|
-
"**/out",
|
|
9988
|
-
"**/output",
|
|
9989
|
-
"**/package-lock.json",
|
|
9990
|
-
"**/pnpm-lock.yaml",
|
|
9991
|
-
"**/scratch",
|
|
9992
|
-
"**/temp",
|
|
9993
|
-
"**/tmp",
|
|
9994
|
-
"**/yarn.lock"
|
|
9995
|
-
];
|
|
9996
|
-
|
|
9997
|
-
// src/utils.ts
|
|
9998
|
-
var import_node_process3 = __toESM(require("process"), 1);
|
|
9999
|
-
async function combine(...configs) {
|
|
10000
|
-
const resolved = await Promise.all(configs);
|
|
10001
|
-
return resolved.flat();
|
|
10002
|
-
}
|
|
10003
|
-
async function combineAsync(...configs) {
|
|
10004
|
-
const resolved = await Promise.all(configs);
|
|
10005
|
-
return resolved.flatMap(
|
|
10006
|
-
(config) => Array.isArray(config) ? config : [config]
|
|
10007
|
-
);
|
|
10008
|
-
}
|
|
10009
|
-
function renameRules(rules, from, to) {
|
|
10010
|
-
if (from === to) {
|
|
10011
|
-
return rules;
|
|
9962
|
+
// node_modules/.pnpm/neverthrow@8.0.0/node_modules/neverthrow/dist/index.es.js
|
|
9963
|
+
var defaultErrorConfig = {
|
|
9964
|
+
withStackTrace: false
|
|
9965
|
+
};
|
|
9966
|
+
var createNeverThrowError = (message, result, config = defaultErrorConfig) => {
|
|
9967
|
+
const data2 = result.isOk() ? { type: "Ok", value: result.value } : { type: "Err", value: result.error };
|
|
9968
|
+
const maybeStack = config.withStackTrace ? new Error().stack : void 0;
|
|
9969
|
+
return {
|
|
9970
|
+
data: data2,
|
|
9971
|
+
message,
|
|
9972
|
+
stack: maybeStack
|
|
9973
|
+
};
|
|
9974
|
+
};
|
|
9975
|
+
function __awaiter(thisArg, _arguments, P, generator) {
|
|
9976
|
+
function adopt(value) {
|
|
9977
|
+
return value instanceof P ? value : new P(function(resolve2) {
|
|
9978
|
+
resolve2(value);
|
|
9979
|
+
});
|
|
10012
9980
|
}
|
|
10013
|
-
return
|
|
10014
|
-
|
|
10015
|
-
|
|
10016
|
-
|
|
9981
|
+
return new (P || (P = Promise))(function(resolve2, reject) {
|
|
9982
|
+
function fulfilled(value) {
|
|
9983
|
+
try {
|
|
9984
|
+
step(generator.next(value));
|
|
9985
|
+
} catch (e) {
|
|
9986
|
+
reject(e);
|
|
10017
9987
|
}
|
|
10018
|
-
|
|
10019
|
-
|
|
10020
|
-
|
|
10021
|
-
|
|
10022
|
-
|
|
10023
|
-
|
|
10024
|
-
|
|
10025
|
-
}
|
|
10026
|
-
function
|
|
10027
|
-
|
|
9988
|
+
}
|
|
9989
|
+
function rejected(value) {
|
|
9990
|
+
try {
|
|
9991
|
+
step(generator["throw"](value));
|
|
9992
|
+
} catch (e) {
|
|
9993
|
+
reject(e);
|
|
9994
|
+
}
|
|
9995
|
+
}
|
|
9996
|
+
function step(result) {
|
|
9997
|
+
result.done ? resolve2(result.value) : adopt(result.value).then(fulfilled, rejected);
|
|
9998
|
+
}
|
|
9999
|
+
step((generator = generator.apply(thisArg, [])).next());
|
|
10000
|
+
});
|
|
10028
10001
|
}
|
|
10029
|
-
function
|
|
10030
|
-
|
|
10002
|
+
function __values(o) {
|
|
10003
|
+
var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0;
|
|
10004
|
+
if (m) return m.call(o);
|
|
10005
|
+
if (o && typeof o.length === "number") return {
|
|
10006
|
+
next: function() {
|
|
10007
|
+
if (o && i >= o.length) o = void 0;
|
|
10008
|
+
return { value: o && o[i++], done: !o };
|
|
10009
|
+
}
|
|
10010
|
+
};
|
|
10011
|
+
throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
|
|
10012
|
+
}
|
|
10013
|
+
function __await(v) {
|
|
10014
|
+
return this instanceof __await ? (this.v = v, this) : new __await(v);
|
|
10015
|
+
}
|
|
10016
|
+
function __asyncGenerator(thisArg, _arguments, generator) {
|
|
10017
|
+
if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined.");
|
|
10018
|
+
var g = generator.apply(thisArg, _arguments || []), i, q = [];
|
|
10019
|
+
return i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function() {
|
|
10020
|
+
return this;
|
|
10021
|
+
}, i;
|
|
10022
|
+
function verb(n2) {
|
|
10023
|
+
if (g[n2]) i[n2] = function(v) {
|
|
10024
|
+
return new Promise(function(a, b) {
|
|
10025
|
+
q.push([n2, v, a, b]) > 1 || resume(n2, v);
|
|
10026
|
+
});
|
|
10027
|
+
};
|
|
10028
|
+
}
|
|
10029
|
+
function resume(n2, v) {
|
|
10030
|
+
try {
|
|
10031
|
+
step(g[n2](v));
|
|
10032
|
+
} catch (e) {
|
|
10033
|
+
settle(q[0][3], e);
|
|
10034
|
+
}
|
|
10035
|
+
}
|
|
10036
|
+
function step(r2) {
|
|
10037
|
+
r2.value instanceof __await ? Promise.resolve(r2.value.v).then(fulfill, reject) : settle(q[0][2], r2);
|
|
10038
|
+
}
|
|
10039
|
+
function fulfill(value) {
|
|
10040
|
+
resume("next", value);
|
|
10041
|
+
}
|
|
10042
|
+
function reject(value) {
|
|
10043
|
+
resume("throw", value);
|
|
10044
|
+
}
|
|
10045
|
+
function settle(f, v) {
|
|
10046
|
+
if (f(v), q.shift(), q.length) resume(q[0][0], q[0][1]);
|
|
10047
|
+
}
|
|
10048
|
+
}
|
|
10049
|
+
function __asyncDelegator(o) {
|
|
10050
|
+
var i, p;
|
|
10051
|
+
return i = {}, verb("next"), verb("throw", function(e) {
|
|
10052
|
+
throw e;
|
|
10053
|
+
}), verb("return"), i[Symbol.iterator] = function() {
|
|
10054
|
+
return this;
|
|
10055
|
+
}, i;
|
|
10056
|
+
function verb(n2, f) {
|
|
10057
|
+
i[n2] = o[n2] ? function(v) {
|
|
10058
|
+
return (p = !p) ? { value: __await(o[n2](v)), done: n2 === "return" } : f ? f(v) : v;
|
|
10059
|
+
} : f;
|
|
10060
|
+
}
|
|
10061
|
+
}
|
|
10062
|
+
function __asyncValues(o) {
|
|
10063
|
+
if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined.");
|
|
10064
|
+
var m = o[Symbol.asyncIterator], i;
|
|
10065
|
+
return m ? m.call(o) : (o = typeof __values === "function" ? __values(o) : o[Symbol.iterator](), i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function() {
|
|
10066
|
+
return this;
|
|
10067
|
+
}, i);
|
|
10068
|
+
function verb(n2) {
|
|
10069
|
+
i[n2] = o[n2] && function(v) {
|
|
10070
|
+
return new Promise(function(resolve2, reject) {
|
|
10071
|
+
v = o[n2](v), settle(resolve2, reject, v.done, v.value);
|
|
10072
|
+
});
|
|
10073
|
+
};
|
|
10074
|
+
}
|
|
10075
|
+
function settle(resolve2, reject, d, v) {
|
|
10076
|
+
Promise.resolve(v).then(function(v2) {
|
|
10077
|
+
resolve2({ value: v2, done: d });
|
|
10078
|
+
}, reject);
|
|
10079
|
+
}
|
|
10031
10080
|
}
|
|
10032
|
-
|
|
10033
|
-
|
|
10034
|
-
|
|
10035
|
-
|
|
10036
|
-
|
|
10037
|
-
|
|
10038
|
-
|
|
10039
|
-
|
|
10081
|
+
var ResultAsync = class _ResultAsync {
|
|
10082
|
+
constructor(res) {
|
|
10083
|
+
this._promise = res;
|
|
10084
|
+
}
|
|
10085
|
+
static fromSafePromise(promise) {
|
|
10086
|
+
const newPromise = promise.then((value) => new Ok(value));
|
|
10087
|
+
return new _ResultAsync(newPromise);
|
|
10088
|
+
}
|
|
10089
|
+
static fromPromise(promise, errorFn) {
|
|
10090
|
+
const newPromise = promise.then((value) => new Ok(value)).catch((e) => new Err(errorFn(e)));
|
|
10091
|
+
return new _ResultAsync(newPromise);
|
|
10092
|
+
}
|
|
10093
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
10094
|
+
static fromThrowable(fn, errorFn) {
|
|
10095
|
+
return (...args) => {
|
|
10096
|
+
return new _ResultAsync((() => __awaiter(this, void 0, void 0, function* () {
|
|
10097
|
+
try {
|
|
10098
|
+
return new Ok(yield fn(...args));
|
|
10099
|
+
} catch (error) {
|
|
10100
|
+
return new Err(errorFn ? errorFn(error) : error);
|
|
10101
|
+
}
|
|
10102
|
+
}))());
|
|
10103
|
+
};
|
|
10104
|
+
}
|
|
10105
|
+
static combine(asyncResultList) {
|
|
10106
|
+
return combineResultAsyncList(asyncResultList);
|
|
10107
|
+
}
|
|
10108
|
+
static combineWithAllErrors(asyncResultList) {
|
|
10109
|
+
return combineResultAsyncListWithAllErrors(asyncResultList);
|
|
10110
|
+
}
|
|
10111
|
+
map(f) {
|
|
10112
|
+
return new _ResultAsync(this._promise.then((res) => __awaiter(this, void 0, void 0, function* () {
|
|
10113
|
+
if (res.isErr()) {
|
|
10114
|
+
return new Err(res.error);
|
|
10115
|
+
}
|
|
10116
|
+
return new Ok(yield f(res.value));
|
|
10117
|
+
})));
|
|
10118
|
+
}
|
|
10119
|
+
andThrough(f) {
|
|
10120
|
+
return new _ResultAsync(this._promise.then((res) => __awaiter(this, void 0, void 0, function* () {
|
|
10121
|
+
if (res.isErr()) {
|
|
10122
|
+
return new Err(res.error);
|
|
10040
10123
|
}
|
|
10124
|
+
const newRes = yield f(res.value);
|
|
10125
|
+
if (newRes.isErr()) {
|
|
10126
|
+
return new Err(newRes.error);
|
|
10127
|
+
}
|
|
10128
|
+
return new Ok(res.value);
|
|
10129
|
+
})));
|
|
10130
|
+
}
|
|
10131
|
+
andTee(f) {
|
|
10132
|
+
return new _ResultAsync(this._promise.then((res) => __awaiter(this, void 0, void 0, function* () {
|
|
10133
|
+
if (res.isErr()) {
|
|
10134
|
+
return new Err(res.error);
|
|
10135
|
+
}
|
|
10136
|
+
try {
|
|
10137
|
+
yield f(res.value);
|
|
10138
|
+
} catch (e) {
|
|
10139
|
+
}
|
|
10140
|
+
return new Ok(res.value);
|
|
10141
|
+
})));
|
|
10142
|
+
}
|
|
10143
|
+
mapErr(f) {
|
|
10144
|
+
return new _ResultAsync(this._promise.then((res) => __awaiter(this, void 0, void 0, function* () {
|
|
10145
|
+
if (res.isOk()) {
|
|
10146
|
+
return new Ok(res.value);
|
|
10147
|
+
}
|
|
10148
|
+
return new Err(yield f(res.error));
|
|
10149
|
+
})));
|
|
10150
|
+
}
|
|
10151
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any, @typescript-eslint/explicit-module-boundary-types
|
|
10152
|
+
andThen(f) {
|
|
10153
|
+
return new _ResultAsync(this._promise.then((res) => {
|
|
10154
|
+
if (res.isErr()) {
|
|
10155
|
+
return new Err(res.error);
|
|
10156
|
+
}
|
|
10157
|
+
const newValue = f(res.value);
|
|
10158
|
+
return newValue instanceof _ResultAsync ? newValue._promise : newValue;
|
|
10159
|
+
}));
|
|
10160
|
+
}
|
|
10161
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any, @typescript-eslint/explicit-module-boundary-types
|
|
10162
|
+
orElse(f) {
|
|
10163
|
+
return new _ResultAsync(this._promise.then((res) => __awaiter(this, void 0, void 0, function* () {
|
|
10164
|
+
if (res.isErr()) {
|
|
10165
|
+
return f(res.error);
|
|
10166
|
+
}
|
|
10167
|
+
return new Ok(res.value);
|
|
10168
|
+
})));
|
|
10169
|
+
}
|
|
10170
|
+
match(ok2, _err) {
|
|
10171
|
+
return this._promise.then((res) => res.match(ok2, _err));
|
|
10172
|
+
}
|
|
10173
|
+
unwrapOr(t) {
|
|
10174
|
+
return this._promise.then((res) => res.unwrapOr(t));
|
|
10175
|
+
}
|
|
10176
|
+
/**
|
|
10177
|
+
* Emulates Rust's `?` operator in `safeTry`'s body. See also `safeTry`.
|
|
10178
|
+
*/
|
|
10179
|
+
safeUnwrap() {
|
|
10180
|
+
return __asyncGenerator(this, arguments, function* safeUnwrap_1() {
|
|
10181
|
+
return yield __await(yield __await(yield* __asyncDelegator(__asyncValues(yield __await(this._promise.then((res) => res.safeUnwrap()))))));
|
|
10182
|
+
});
|
|
10183
|
+
}
|
|
10184
|
+
// Makes ResultAsync implement PromiseLike<Result>
|
|
10185
|
+
then(successCallback, failureCallback) {
|
|
10186
|
+
return this._promise.then(successCallback, failureCallback);
|
|
10187
|
+
}
|
|
10188
|
+
};
|
|
10189
|
+
var errAsync = (err2) => new ResultAsync(Promise.resolve(new Err(err2)));
|
|
10190
|
+
var fromPromise = ResultAsync.fromPromise;
|
|
10191
|
+
var fromSafePromise = ResultAsync.fromSafePromise;
|
|
10192
|
+
var fromAsyncThrowable = ResultAsync.fromThrowable;
|
|
10193
|
+
var combineResultList = (resultList) => {
|
|
10194
|
+
let acc = ok([]);
|
|
10195
|
+
for (const result of resultList) {
|
|
10196
|
+
if (result.isErr()) {
|
|
10197
|
+
acc = err(result.error);
|
|
10198
|
+
break;
|
|
10199
|
+
} else {
|
|
10200
|
+
acc.map((list) => list.push(result.value));
|
|
10041
10201
|
}
|
|
10042
10202
|
}
|
|
10043
|
-
return
|
|
10203
|
+
return acc;
|
|
10204
|
+
};
|
|
10205
|
+
var combineResultAsyncList = (asyncResultList) => ResultAsync.fromSafePromise(Promise.all(asyncResultList)).andThen(combineResultList);
|
|
10206
|
+
var combineResultListWithAllErrors = (resultList) => {
|
|
10207
|
+
let acc = ok([]);
|
|
10208
|
+
for (const result of resultList) {
|
|
10209
|
+
if (result.isErr() && acc.isErr()) {
|
|
10210
|
+
acc.error.push(result.error);
|
|
10211
|
+
} else if (result.isErr() && acc.isOk()) {
|
|
10212
|
+
acc = err([result.error]);
|
|
10213
|
+
} else if (result.isOk() && acc.isOk()) {
|
|
10214
|
+
acc.value.push(result.value);
|
|
10215
|
+
}
|
|
10216
|
+
}
|
|
10217
|
+
return acc;
|
|
10218
|
+
};
|
|
10219
|
+
var combineResultAsyncListWithAllErrors = (asyncResultList) => ResultAsync.fromSafePromise(Promise.all(asyncResultList)).andThen(combineResultListWithAllErrors);
|
|
10220
|
+
var Result;
|
|
10221
|
+
(function(Result2) {
|
|
10222
|
+
function fromThrowable2(fn, errorFn) {
|
|
10223
|
+
return (...args) => {
|
|
10224
|
+
try {
|
|
10225
|
+
const result = fn(...args);
|
|
10226
|
+
return ok(result);
|
|
10227
|
+
} catch (e) {
|
|
10228
|
+
return err(errorFn ? errorFn(e) : e);
|
|
10229
|
+
}
|
|
10230
|
+
};
|
|
10231
|
+
}
|
|
10232
|
+
Result2.fromThrowable = fromThrowable2;
|
|
10233
|
+
function combine2(resultList) {
|
|
10234
|
+
return combineResultList(resultList);
|
|
10235
|
+
}
|
|
10236
|
+
Result2.combine = combine2;
|
|
10237
|
+
function combineWithAllErrors(resultList) {
|
|
10238
|
+
return combineResultListWithAllErrors(resultList);
|
|
10239
|
+
}
|
|
10240
|
+
Result2.combineWithAllErrors = combineWithAllErrors;
|
|
10241
|
+
})(Result || (Result = {}));
|
|
10242
|
+
var ok = (value) => new Ok(value);
|
|
10243
|
+
function err(err2) {
|
|
10244
|
+
return new Err(err2);
|
|
10044
10245
|
}
|
|
10246
|
+
var Ok = class {
|
|
10247
|
+
constructor(value) {
|
|
10248
|
+
this.value = value;
|
|
10249
|
+
}
|
|
10250
|
+
isOk() {
|
|
10251
|
+
return true;
|
|
10252
|
+
}
|
|
10253
|
+
isErr() {
|
|
10254
|
+
return !this.isOk();
|
|
10255
|
+
}
|
|
10256
|
+
map(f) {
|
|
10257
|
+
return ok(f(this.value));
|
|
10258
|
+
}
|
|
10259
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
10260
|
+
mapErr(_f) {
|
|
10261
|
+
return ok(this.value);
|
|
10262
|
+
}
|
|
10263
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any, @typescript-eslint/explicit-module-boundary-types
|
|
10264
|
+
andThen(f) {
|
|
10265
|
+
return f(this.value);
|
|
10266
|
+
}
|
|
10267
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any, @typescript-eslint/explicit-module-boundary-types
|
|
10268
|
+
andThrough(f) {
|
|
10269
|
+
return f(this.value).map((_value) => this.value);
|
|
10270
|
+
}
|
|
10271
|
+
andTee(f) {
|
|
10272
|
+
try {
|
|
10273
|
+
f(this.value);
|
|
10274
|
+
} catch (e) {
|
|
10275
|
+
}
|
|
10276
|
+
return ok(this.value);
|
|
10277
|
+
}
|
|
10278
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any, @typescript-eslint/explicit-module-boundary-types
|
|
10279
|
+
orElse(_f) {
|
|
10280
|
+
return ok(this.value);
|
|
10281
|
+
}
|
|
10282
|
+
asyncAndThen(f) {
|
|
10283
|
+
return f(this.value);
|
|
10284
|
+
}
|
|
10285
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any, @typescript-eslint/explicit-module-boundary-types
|
|
10286
|
+
asyncAndThrough(f) {
|
|
10287
|
+
return f(this.value).map(() => this.value);
|
|
10288
|
+
}
|
|
10289
|
+
asyncMap(f) {
|
|
10290
|
+
return ResultAsync.fromSafePromise(f(this.value));
|
|
10291
|
+
}
|
|
10292
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
10293
|
+
unwrapOr(_v) {
|
|
10294
|
+
return this.value;
|
|
10295
|
+
}
|
|
10296
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
10297
|
+
match(ok2, _err) {
|
|
10298
|
+
return ok2(this.value);
|
|
10299
|
+
}
|
|
10300
|
+
safeUnwrap() {
|
|
10301
|
+
const value = this.value;
|
|
10302
|
+
return function* () {
|
|
10303
|
+
return value;
|
|
10304
|
+
}();
|
|
10305
|
+
}
|
|
10306
|
+
_unsafeUnwrap(_) {
|
|
10307
|
+
return this.value;
|
|
10308
|
+
}
|
|
10309
|
+
_unsafeUnwrapErr(config) {
|
|
10310
|
+
throw createNeverThrowError("Called `_unsafeUnwrapErr` on an Ok", this, config);
|
|
10311
|
+
}
|
|
10312
|
+
};
|
|
10313
|
+
var Err = class {
|
|
10314
|
+
constructor(error) {
|
|
10315
|
+
this.error = error;
|
|
10316
|
+
}
|
|
10317
|
+
isOk() {
|
|
10318
|
+
return false;
|
|
10319
|
+
}
|
|
10320
|
+
isErr() {
|
|
10321
|
+
return !this.isOk();
|
|
10322
|
+
}
|
|
10323
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
10324
|
+
map(_f) {
|
|
10325
|
+
return err(this.error);
|
|
10326
|
+
}
|
|
10327
|
+
mapErr(f) {
|
|
10328
|
+
return err(f(this.error));
|
|
10329
|
+
}
|
|
10330
|
+
andThrough(_f) {
|
|
10331
|
+
return err(this.error);
|
|
10332
|
+
}
|
|
10333
|
+
andTee(_f) {
|
|
10334
|
+
return err(this.error);
|
|
10335
|
+
}
|
|
10336
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any, @typescript-eslint/explicit-module-boundary-types
|
|
10337
|
+
andThen(_f) {
|
|
10338
|
+
return err(this.error);
|
|
10339
|
+
}
|
|
10340
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any, @typescript-eslint/explicit-module-boundary-types
|
|
10341
|
+
orElse(f) {
|
|
10342
|
+
return f(this.error);
|
|
10343
|
+
}
|
|
10344
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
10345
|
+
asyncAndThen(_f) {
|
|
10346
|
+
return errAsync(this.error);
|
|
10347
|
+
}
|
|
10348
|
+
asyncAndThrough(_f) {
|
|
10349
|
+
return errAsync(this.error);
|
|
10350
|
+
}
|
|
10351
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
10352
|
+
asyncMap(_f) {
|
|
10353
|
+
return errAsync(this.error);
|
|
10354
|
+
}
|
|
10355
|
+
unwrapOr(v) {
|
|
10356
|
+
return v;
|
|
10357
|
+
}
|
|
10358
|
+
match(_ok, err2) {
|
|
10359
|
+
return err2(this.error);
|
|
10360
|
+
}
|
|
10361
|
+
safeUnwrap() {
|
|
10362
|
+
const error = this.error;
|
|
10363
|
+
return function* () {
|
|
10364
|
+
yield err(error);
|
|
10365
|
+
throw new Error("Do not use this generator out of `safeTry`");
|
|
10366
|
+
}();
|
|
10367
|
+
}
|
|
10368
|
+
_unsafeUnwrap(config) {
|
|
10369
|
+
throw createNeverThrowError("Called `_unsafeUnwrap` on an Err", this, config);
|
|
10370
|
+
}
|
|
10371
|
+
_unsafeUnwrapErr(_) {
|
|
10372
|
+
return this.error;
|
|
10373
|
+
}
|
|
10374
|
+
};
|
|
10375
|
+
var fromThrowable = Result.fromThrowable;
|
|
10045
10376
|
|
|
10046
|
-
// src/
|
|
10047
|
-
var
|
|
10048
|
-
|
|
10049
|
-
|
|
10050
|
-
var
|
|
10051
|
-
|
|
10052
|
-
|
|
10377
|
+
// src/utils.ts
|
|
10378
|
+
var import_node_process3 = __toESM(require("process"), 1);
|
|
10379
|
+
|
|
10380
|
+
// src/lager.ts
|
|
10381
|
+
var LAGER_LEVELS = {
|
|
10382
|
+
trace: 10,
|
|
10383
|
+
debug: 20,
|
|
10384
|
+
info: 30,
|
|
10385
|
+
warn: 40,
|
|
10386
|
+
error: 50,
|
|
10387
|
+
fatal: 60
|
|
10388
|
+
};
|
|
10389
|
+
function isLagerLevel(level) {
|
|
10390
|
+
return level === "trace" || level === "debug" || level === "info" || level === "warn" || level === "error" || level === "fatal";
|
|
10391
|
+
}
|
|
10392
|
+
var Lager = class {
|
|
10393
|
+
_level = "info";
|
|
10394
|
+
id = "lager";
|
|
10395
|
+
levelNo = LAGER_LEVELS[this._level];
|
|
10396
|
+
prefix = "";
|
|
10397
|
+
constructor(options) {
|
|
10398
|
+
const { level, id, prefix } = {
|
|
10399
|
+
level: "info",
|
|
10400
|
+
id: "lager",
|
|
10401
|
+
prefix: "@jsse/eslint-config",
|
|
10402
|
+
...options
|
|
10403
|
+
};
|
|
10404
|
+
this.id = id;
|
|
10405
|
+
this._level = isLagerLevel(level) ? level : "info";
|
|
10406
|
+
this.levelNo = LAGER_LEVELS[this._level];
|
|
10407
|
+
this.prefix = prefix;
|
|
10408
|
+
this.log = this.log.bind(this);
|
|
10409
|
+
this.debug = this.debug.bind(this);
|
|
10410
|
+
}
|
|
10411
|
+
get level() {
|
|
10412
|
+
return this._level;
|
|
10413
|
+
}
|
|
10414
|
+
set level(level) {
|
|
10415
|
+
this._level = level;
|
|
10416
|
+
this.levelNo = LAGER_LEVELS[level];
|
|
10417
|
+
}
|
|
10418
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
10419
|
+
log(...args) {
|
|
10420
|
+
console.log(this.prefix, ...args);
|
|
10421
|
+
}
|
|
10422
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
10423
|
+
trace(...args) {
|
|
10424
|
+
if (this.levelNo <= LAGER_LEVELS.trace) {
|
|
10425
|
+
console.trace(this.prefix, ...args);
|
|
10426
|
+
}
|
|
10427
|
+
}
|
|
10428
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
10429
|
+
debug(...args) {
|
|
10430
|
+
if (this.levelNo <= LAGER_LEVELS.debug) {
|
|
10431
|
+
console.debug(this.prefix, ...args);
|
|
10432
|
+
}
|
|
10433
|
+
}
|
|
10434
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
10435
|
+
info(...args) {
|
|
10436
|
+
if (this.levelNo <= LAGER_LEVELS.info) {
|
|
10437
|
+
console.info(this.prefix, ...args);
|
|
10438
|
+
}
|
|
10439
|
+
}
|
|
10440
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
10441
|
+
warn(...args) {
|
|
10442
|
+
if (this.levelNo <= LAGER_LEVELS.warn) {
|
|
10443
|
+
console.warn(this.prefix, ...args);
|
|
10444
|
+
}
|
|
10445
|
+
}
|
|
10446
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
10447
|
+
error(...args) {
|
|
10448
|
+
if (this.levelNo <= LAGER_LEVELS.error) {
|
|
10449
|
+
console.error(this.prefix, ...args);
|
|
10450
|
+
}
|
|
10451
|
+
}
|
|
10452
|
+
};
|
|
10453
|
+
var log = new Lager();
|
|
10454
|
+
|
|
10455
|
+
// src/utils.ts
|
|
10456
|
+
async function combine(...configs) {
|
|
10457
|
+
const resolved = await Promise.all(configs);
|
|
10458
|
+
return resolved.flat();
|
|
10459
|
+
}
|
|
10460
|
+
async function combineAsync(...configs) {
|
|
10461
|
+
const resolved = await Promise.all(configs);
|
|
10462
|
+
return resolved.flatMap(
|
|
10463
|
+
(config) => Array.isArray(config) ? config : [config]
|
|
10464
|
+
);
|
|
10465
|
+
}
|
|
10466
|
+
function renameRules(rules, from, to) {
|
|
10467
|
+
if (from === to) {
|
|
10468
|
+
return rules;
|
|
10469
|
+
}
|
|
10470
|
+
return Object.fromEntries(
|
|
10471
|
+
Object.entries(rules).map(([key, value]) => {
|
|
10472
|
+
if (key.startsWith(from)) {
|
|
10473
|
+
return [to + key.slice(from.length), value];
|
|
10474
|
+
}
|
|
10475
|
+
return [key, value];
|
|
10476
|
+
})
|
|
10477
|
+
);
|
|
10478
|
+
}
|
|
10479
|
+
async function interopDefault2(m) {
|
|
10480
|
+
const resolved = await m;
|
|
10481
|
+
return resolved.default || resolved;
|
|
10482
|
+
}
|
|
10483
|
+
function isCI() {
|
|
10484
|
+
return !!import_node_process3.default.env.CI;
|
|
10485
|
+
}
|
|
10486
|
+
function isInEditor() {
|
|
10487
|
+
return !!((import_node_process3.default.env.VSCODE_PID || import_node_process3.default.env.JETBRAINS_IDE) && !isCI());
|
|
10488
|
+
}
|
|
10489
|
+
function uniqueStrings(...strings) {
|
|
10490
|
+
const set = /* @__PURE__ */ new Set();
|
|
10491
|
+
for (const item of strings) {
|
|
10492
|
+
if (typeof item === "string") {
|
|
10493
|
+
set.add(item);
|
|
10494
|
+
} else {
|
|
10495
|
+
for (const str of item) {
|
|
10496
|
+
set.add(str);
|
|
10497
|
+
}
|
|
10498
|
+
}
|
|
10499
|
+
}
|
|
10500
|
+
return [...set];
|
|
10501
|
+
}
|
|
10502
|
+
var parserPlain = {
|
|
10503
|
+
meta: {
|
|
10504
|
+
name: "parser-plain"
|
|
10505
|
+
},
|
|
10506
|
+
parseForESLint: (code) => ({
|
|
10507
|
+
ast: {
|
|
10508
|
+
body: [],
|
|
10509
|
+
comments: [],
|
|
10510
|
+
loc: { end: code.length, start: 0 },
|
|
10511
|
+
range: [0, code.length],
|
|
10512
|
+
tokens: [],
|
|
10513
|
+
type: "Program"
|
|
10514
|
+
},
|
|
10515
|
+
scopeManager: void 0,
|
|
10516
|
+
services: { isPlain: true },
|
|
10517
|
+
visitorKeys: {
|
|
10518
|
+
Program: []
|
|
10519
|
+
}
|
|
10520
|
+
})
|
|
10521
|
+
};
|
|
10522
|
+
function turnOffRules(configs, off) {
|
|
10523
|
+
if (off && off.length > 0) {
|
|
10524
|
+
for (const rule of off) {
|
|
10525
|
+
log.debug(`turning-off: ${rule}`);
|
|
10526
|
+
}
|
|
10527
|
+
const currentlyActiveRules = /* @__PURE__ */ new Set();
|
|
10528
|
+
for (const config of configs) {
|
|
10529
|
+
for (const rule of Object.keys(config.rules ?? {}))
|
|
10530
|
+
currentlyActiveRules.add(rule);
|
|
10531
|
+
}
|
|
10532
|
+
for (const rule of off) {
|
|
10533
|
+
if (!currentlyActiveRules.has(rule)) {
|
|
10534
|
+
log.info(
|
|
10535
|
+
`Rule \`${rule}\` is not active in the current config, you can remove it from the off list`
|
|
10536
|
+
);
|
|
10537
|
+
}
|
|
10538
|
+
}
|
|
10539
|
+
for (const config of configs) {
|
|
10540
|
+
const cfgRules = config.rules;
|
|
10541
|
+
if (cfgRules) {
|
|
10542
|
+
for (const rule of off) {
|
|
10543
|
+
if (cfgRules[rule] !== void 0 && cfgRules[rule] !== "off" && cfgRules[rule] !== 0) {
|
|
10544
|
+
cfgRules[rule] = "off";
|
|
10545
|
+
}
|
|
10546
|
+
}
|
|
10547
|
+
}
|
|
10548
|
+
}
|
|
10549
|
+
}
|
|
10550
|
+
return configs;
|
|
10551
|
+
}
|
|
10552
|
+
function changeRuleEntrySeverity(ruleConfig, level) {
|
|
10553
|
+
if (Array.isArray(ruleConfig)) {
|
|
10554
|
+
if (ruleConfig[0] !== level) {
|
|
10555
|
+
ruleConfig[0] = level;
|
|
10556
|
+
}
|
|
10557
|
+
return ruleConfig;
|
|
10558
|
+
}
|
|
10559
|
+
return level;
|
|
10560
|
+
}
|
|
10561
|
+
function error2warn(configs) {
|
|
10562
|
+
for (const config of configs) {
|
|
10563
|
+
if (config.rules) {
|
|
10564
|
+
config.rules = Object.fromEntries(
|
|
10565
|
+
Object.entries(config.rules).map(([key, value]) => {
|
|
10566
|
+
if (value === "error" || value === 2) {
|
|
10567
|
+
return [key, changeRuleEntrySeverity(value, "warn")];
|
|
10568
|
+
}
|
|
10569
|
+
if (Array.isArray(value) && (value[0] === "error" || value[0] === 2)) {
|
|
10570
|
+
return [key, changeRuleEntrySeverity(value, "warn")];
|
|
10571
|
+
}
|
|
10572
|
+
return [key, value];
|
|
10573
|
+
})
|
|
10574
|
+
);
|
|
10575
|
+
}
|
|
10576
|
+
}
|
|
10577
|
+
return configs;
|
|
10578
|
+
}
|
|
10579
|
+
function warn2error(configs) {
|
|
10580
|
+
for (const config of configs) {
|
|
10581
|
+
if (config.rules) {
|
|
10582
|
+
config.rules = Object.fromEntries(
|
|
10583
|
+
Object.entries(config.rules).map(([key, value]) => {
|
|
10584
|
+
if (value === "warn" || value === 1) {
|
|
10585
|
+
return [key, changeRuleEntrySeverity(value, "error")];
|
|
10586
|
+
}
|
|
10587
|
+
if (Array.isArray(value) && (value[0] === "warn" || value[0] === 1)) {
|
|
10588
|
+
return [key, changeRuleEntrySeverity(value, "error")];
|
|
10589
|
+
}
|
|
10590
|
+
return [key, value];
|
|
10591
|
+
})
|
|
10592
|
+
);
|
|
10593
|
+
}
|
|
10594
|
+
}
|
|
10595
|
+
return configs;
|
|
10596
|
+
}
|
|
10597
|
+
|
|
10598
|
+
// src/plugins.ts
|
|
10599
|
+
var import_eslint_plugin_eslint_comments = __toESM(require("@eslint-community/eslint-plugin-eslint-comments"), 1);
|
|
10600
|
+
var import_eslint_plugin = __toESM(require("@typescript-eslint/eslint-plugin"), 1);
|
|
10601
|
+
var parserTs = __toESM(require("@typescript-eslint/parser"), 1);
|
|
10602
|
+
var import_eslint_plugin_antfu = __toESM(require("eslint-plugin-antfu"), 1);
|
|
10603
|
+
var pluginImport = __toESM(require("eslint-plugin-import-x"), 1);
|
|
10604
|
+
var import_eslint_plugin_n = __toESM(require("eslint-plugin-n"), 1);
|
|
10053
10605
|
var import_eslint_plugin_perfectionist = __toESM(require("eslint-plugin-perfectionist"), 1);
|
|
10054
10606
|
var import_eslint_plugin_unicorn = __toESM(require("eslint-plugin-unicorn"), 1);
|
|
10055
10607
|
var import_eslint_plugin_unused_imports = __toESM(require("eslint-plugin-unused-imports"), 1);
|
|
@@ -10061,6 +10613,7 @@ async function importPluginReact() {
|
|
|
10061
10613
|
}
|
|
10062
10614
|
async function importPluginReactHooks() {
|
|
10063
10615
|
const pluginReactHooks = await interopDefault2(
|
|
10616
|
+
// @ts-expect-error - bad types
|
|
10064
10617
|
import("eslint-plugin-react-hooks")
|
|
10065
10618
|
);
|
|
10066
10619
|
return {
|
|
@@ -10069,6 +10622,7 @@ async function importPluginReactHooks() {
|
|
|
10069
10622
|
}
|
|
10070
10623
|
async function importPluginReactRefresh() {
|
|
10071
10624
|
const pluginReactRefresh = await interopDefault2(
|
|
10625
|
+
// @ts-expect-error - bad types
|
|
10072
10626
|
import("eslint-plugin-react-refresh")
|
|
10073
10627
|
);
|
|
10074
10628
|
return {
|
|
@@ -10079,7 +10633,9 @@ async function importReactPlugins() {
|
|
|
10079
10633
|
const [pluginReact, pluginReactHooks, pluginReactRefresh] = await Promise.all(
|
|
10080
10634
|
[
|
|
10081
10635
|
interopDefault2(import("eslint-plugin-react")),
|
|
10636
|
+
// @ts-expect-error - bad types
|
|
10082
10637
|
interopDefault2(import("eslint-plugin-react-hooks")),
|
|
10638
|
+
// @ts-expect-error - bad types
|
|
10083
10639
|
interopDefault2(import("eslint-plugin-react-refresh"))
|
|
10084
10640
|
]
|
|
10085
10641
|
);
|
|
@@ -10112,7 +10668,7 @@ async function importYmlLibs() {
|
|
|
10112
10668
|
return { parserYaml, pluginYaml };
|
|
10113
10669
|
}
|
|
10114
10670
|
async function importPluginMarkdown() {
|
|
10115
|
-
const pluginMarkdown = await interopDefault2(import("eslint
|
|
10671
|
+
const pluginMarkdown = await interopDefault2(import("@eslint/markdown"));
|
|
10116
10672
|
return {
|
|
10117
10673
|
pluginMarkdown
|
|
10118
10674
|
};
|
|
@@ -10137,41 +10693,52 @@ async function importPluginStylistic() {
|
|
|
10137
10693
|
}
|
|
10138
10694
|
async function importPluginTailwind() {
|
|
10139
10695
|
const pluginTailwind = await interopDefault2(
|
|
10696
|
+
// @ts-expect-error - bad types
|
|
10140
10697
|
import("eslint-plugin-tailwindcss")
|
|
10141
10698
|
);
|
|
10142
10699
|
return { pluginTailwind };
|
|
10143
10700
|
}
|
|
10701
|
+
async function safeImportPluginTailwind() {
|
|
10702
|
+
try {
|
|
10703
|
+
const plugin = await importPluginTailwind();
|
|
10704
|
+
return ok(plugin);
|
|
10705
|
+
} catch (e) {
|
|
10706
|
+
return err(
|
|
10707
|
+
new Error(
|
|
10708
|
+
`Failed to import \`eslint-plugin-tailwindcss\`. You might need to install it. ${e}`
|
|
10709
|
+
)
|
|
10710
|
+
);
|
|
10711
|
+
}
|
|
10712
|
+
}
|
|
10144
10713
|
|
|
10145
10714
|
// src/configs/antfu.ts
|
|
10146
|
-
var antfu = async () => {
|
|
10715
|
+
var antfu = async (options) => {
|
|
10147
10716
|
return [
|
|
10148
10717
|
{
|
|
10149
10718
|
name: "jsse/antfu",
|
|
10150
10719
|
plugins: {
|
|
10151
10720
|
antfu: import_eslint_plugin_antfu.default
|
|
10152
10721
|
},
|
|
10153
|
-
// @ts-expect-error - antfu plugin types err
|
|
10154
|
-
rules: {
|
|
10155
|
-
"antfu/no-import-node-modules-by-path": "error",
|
|
10156
|
-
"antfu/top-level-function": "error"
|
|
10157
|
-
}
|
|
10158
|
-
},
|
|
10159
|
-
{
|
|
10160
|
-
files: ["**/src/**/*"],
|
|
10161
|
-
name: "jsse/antfu/src",
|
|
10162
|
-
// @ts-expect-error - antfu plugin types err
|
|
10163
|
-
rules: {
|
|
10164
|
-
"antfu/no-import-dist": "error"
|
|
10165
|
-
}
|
|
10166
|
-
},
|
|
10167
|
-
{
|
|
10168
|
-
files: ["**/bin/**/*", `**/bin.${GLOB_SRC_EXT}`],
|
|
10169
|
-
name: "jsse/antfu/bin",
|
|
10170
10722
|
rules: {
|
|
10171
|
-
|
|
10172
|
-
"antfu/
|
|
10723
|
+
// used to like the following rule, but now find it annoying
|
|
10724
|
+
"antfu/top-level-function": options?.topLevelFunction ?? "off"
|
|
10173
10725
|
}
|
|
10174
10726
|
}
|
|
10727
|
+
// {
|
|
10728
|
+
// files: ["**/src/**/*"],
|
|
10729
|
+
// name: "jsse/antfu/src",
|
|
10730
|
+
// rules: {
|
|
10731
|
+
// "antfu/no-import-dist": "error",
|
|
10732
|
+
// },
|
|
10733
|
+
// },
|
|
10734
|
+
// {
|
|
10735
|
+
// files: ["**/bin/**/*", `**/bin.${GLOB_SRC_EXT}`],
|
|
10736
|
+
// name: "jsse/antfu/bin",
|
|
10737
|
+
// rules: {
|
|
10738
|
+
// "antfu/no-import-dist": "off",
|
|
10739
|
+
// "antfu/no-import-node-modules-by-path": "off",
|
|
10740
|
+
// },
|
|
10741
|
+
// },
|
|
10175
10742
|
];
|
|
10176
10743
|
};
|
|
10177
10744
|
|
|
@@ -10192,6 +10759,81 @@ var comments = async () => [
|
|
|
10192
10759
|
}
|
|
10193
10760
|
];
|
|
10194
10761
|
|
|
10762
|
+
// src/globs.ts
|
|
10763
|
+
var GLOB_SRC_EXT = "?([cm])[jt]s?(x)";
|
|
10764
|
+
var GLOB_JS_SRC_EXT = "?([cm])js?(x)";
|
|
10765
|
+
var GLOB_SRC = "**/*.?([cm])[jt]s?(x)";
|
|
10766
|
+
var GLOB_JS = "**/*.?([cm])js";
|
|
10767
|
+
var GLOB_JSX = "**/*.?([cm])jsx";
|
|
10768
|
+
var GLOB_TS = "**/*.?([cm])ts";
|
|
10769
|
+
var GLOB_TSX = "**/*.?([cm])tsx";
|
|
10770
|
+
var GLOB_STYLE = "**/*.{c,le,sc}ss";
|
|
10771
|
+
var GLOB_CSS = "**/*.css";
|
|
10772
|
+
var GLOB_LESS = "**/*.less";
|
|
10773
|
+
var GLOB_SCSS = "**/*.scss";
|
|
10774
|
+
var GLOB_JSON = "**/*.json";
|
|
10775
|
+
var GLOB_JSON5 = "**/*.json5";
|
|
10776
|
+
var GLOB_JSONC = "**/*.jsonc";
|
|
10777
|
+
var GLOB_TOML = "**/*.toml";
|
|
10778
|
+
var GLOB_MARKDOWN = "**/*.md";
|
|
10779
|
+
var GLOB_MARKDOWN_IN_MARKDOWN = "**/*.md/*.md";
|
|
10780
|
+
var GLOB_GRAPHQL = ["**/*.graphql", "**/*.gql"];
|
|
10781
|
+
var GLOB_YAML = "**/*.y?(a)ml";
|
|
10782
|
+
var GLOB_HTML = "**/*.htm?(l)";
|
|
10783
|
+
var GLOB_TSCONFIG = ["**/tsconfig.json", "**/tsconfig.*.json"];
|
|
10784
|
+
var GLOB_MARKDOWN_CODE = `${GLOB_MARKDOWN}/${GLOB_SRC}`;
|
|
10785
|
+
var GLOB_TESTS = [
|
|
10786
|
+
`**/__tests__/**/*.${GLOB_SRC_EXT}`,
|
|
10787
|
+
`**/*.spec.${GLOB_SRC_EXT}`,
|
|
10788
|
+
`**/*.test.${GLOB_SRC_EXT}`,
|
|
10789
|
+
`**/*.bench.${GLOB_SRC_EXT}`,
|
|
10790
|
+
`**/*.benchmark.${GLOB_SRC_EXT}`
|
|
10791
|
+
];
|
|
10792
|
+
var GLOB_ALL_SRC = [
|
|
10793
|
+
GLOB_SRC,
|
|
10794
|
+
GLOB_STYLE,
|
|
10795
|
+
GLOB_JSON,
|
|
10796
|
+
GLOB_JSON5,
|
|
10797
|
+
GLOB_MARKDOWN,
|
|
10798
|
+
GLOB_YAML,
|
|
10799
|
+
GLOB_HTML
|
|
10800
|
+
];
|
|
10801
|
+
var GLOB_EXCLUDE = [
|
|
10802
|
+
"**/__snapshots__",
|
|
10803
|
+
"**/.cache",
|
|
10804
|
+
"**/.changeset",
|
|
10805
|
+
"**/.history",
|
|
10806
|
+
"**/.idea",
|
|
10807
|
+
"**/.next",
|
|
10808
|
+
"**/.nuxt",
|
|
10809
|
+
"**/.output",
|
|
10810
|
+
"**/.temp",
|
|
10811
|
+
"**/.tmp",
|
|
10812
|
+
"**/.vercel",
|
|
10813
|
+
"**/.vite-inspect",
|
|
10814
|
+
"**/.vitepress/cache",
|
|
10815
|
+
"**/*.bak",
|
|
10816
|
+
"**/*.min.*",
|
|
10817
|
+
"**/.yarn",
|
|
10818
|
+
"**/.pnp.*",
|
|
10819
|
+
"**/auto-import?(s).d.ts",
|
|
10820
|
+
"**/bun.lockb",
|
|
10821
|
+
"**/CHANGELOG*.md",
|
|
10822
|
+
"**/components.d.ts",
|
|
10823
|
+
"**/coverage",
|
|
10824
|
+
"**/dist",
|
|
10825
|
+
"**/LICENSE*",
|
|
10826
|
+
"**/node_modules",
|
|
10827
|
+
"**/out",
|
|
10828
|
+
"**/output",
|
|
10829
|
+
"**/package-lock.json",
|
|
10830
|
+
"**/pnpm-lock.yaml",
|
|
10831
|
+
"**/scratch",
|
|
10832
|
+
"**/temp",
|
|
10833
|
+
"**/tmp",
|
|
10834
|
+
"**/yarn.lock"
|
|
10835
|
+
];
|
|
10836
|
+
|
|
10195
10837
|
// src/configs/ignores.ts
|
|
10196
10838
|
var ignores = async () => {
|
|
10197
10839
|
return [
|
|
@@ -10603,6 +11245,9 @@ var jsonc = async (options) => {
|
|
|
10603
11245
|
];
|
|
10604
11246
|
};
|
|
10605
11247
|
|
|
11248
|
+
// src/configs/markdown.ts
|
|
11249
|
+
var import_eslint_merge_processors = require("eslint-merge-processors");
|
|
11250
|
+
|
|
10606
11251
|
// src/configs/ts/typescript-rules.ts
|
|
10607
11252
|
function typescriptRulesTypeAware() {
|
|
10608
11253
|
return {
|
|
@@ -11024,6 +11669,7 @@ function typescriptRules(props) {
|
|
|
11024
11669
|
// src/configs/markdown.ts
|
|
11025
11670
|
var markdown = async (options) => {
|
|
11026
11671
|
const { componentExts = [], overrides = {} } = options ?? {};
|
|
11672
|
+
const files = [GLOB_MARKDOWN];
|
|
11027
11673
|
const { pluginMarkdown } = await importPluginMarkdown();
|
|
11028
11674
|
const tsRulesOff = Object.fromEntries(
|
|
11029
11675
|
// @ts-expect-error - undefined
|
|
@@ -11032,6 +11678,13 @@ var markdown = async (options) => {
|
|
|
11032
11678
|
"off"
|
|
11033
11679
|
])
|
|
11034
11680
|
);
|
|
11681
|
+
const processor = (0, import_eslint_merge_processors.mergeProcessors)(
|
|
11682
|
+
[
|
|
11683
|
+
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
11684
|
+
pluginMarkdown.processors.markdown,
|
|
11685
|
+
import_eslint_merge_processors.processorPassThrough
|
|
11686
|
+
].filter((processor2) => processor2 !== void 0)
|
|
11687
|
+
);
|
|
11035
11688
|
return [
|
|
11036
11689
|
{
|
|
11037
11690
|
name: "jsse/markdown/setup",
|
|
@@ -11040,10 +11693,26 @@ var markdown = async (options) => {
|
|
|
11040
11693
|
markdown: pluginMarkdown
|
|
11041
11694
|
}
|
|
11042
11695
|
},
|
|
11696
|
+
// {
|
|
11697
|
+
// files: [GLOB_MARKDOWN],
|
|
11698
|
+
// name: "jsse/markdown/processor",
|
|
11699
|
+
// processor: "markdown/markdown",
|
|
11700
|
+
// },
|
|
11043
11701
|
{
|
|
11044
|
-
files
|
|
11702
|
+
files,
|
|
11703
|
+
ignores: [GLOB_MARKDOWN_IN_MARKDOWN],
|
|
11045
11704
|
name: "jsse/markdown/processor",
|
|
11046
|
-
|
|
11705
|
+
// `eslint-plugin-markdown` only creates virtual files for code blocks,
|
|
11706
|
+
// but not the markdown file itself. We use `eslint-merge-processors` to
|
|
11707
|
+
// add a pass-through processor for the markdown file itself.
|
|
11708
|
+
processor
|
|
11709
|
+
},
|
|
11710
|
+
{
|
|
11711
|
+
files,
|
|
11712
|
+
languageOptions: {
|
|
11713
|
+
parser: parserPlain
|
|
11714
|
+
},
|
|
11715
|
+
name: "jsse/markdown/parser"
|
|
11047
11716
|
},
|
|
11048
11717
|
{
|
|
11049
11718
|
files: [
|
|
@@ -11082,22 +11751,38 @@ var markdown = async (options) => {
|
|
|
11082
11751
|
"@typescript-eslint/restrict-plus-operands": "off",
|
|
11083
11752
|
"@typescript-eslint/restrict-template-expressions": "off",
|
|
11084
11753
|
"@typescript-eslint/unbound-method": "off",
|
|
11754
|
+
"n/prefer-global/buffer": "off",
|
|
11755
|
+
"n/prefer-global/process": "off",
|
|
11085
11756
|
"no-alert": "off",
|
|
11086
11757
|
"no-console": "off",
|
|
11087
11758
|
"no-undef": "off",
|
|
11088
11759
|
"no-unused-expressions": "off",
|
|
11089
11760
|
"no-unused-vars": "off",
|
|
11090
|
-
"node/prefer-global/process": "off",
|
|
11091
|
-
// Type aware rules
|
|
11092
11761
|
"object-curly-newline": "off",
|
|
11093
11762
|
"style/comma-dangle": "off",
|
|
11094
11763
|
"style/eol-last": "off",
|
|
11095
11764
|
"unicode-bom": "off",
|
|
11096
11765
|
"unused-imports/no-unused-imports": "off",
|
|
11097
11766
|
"unused-imports/no-unused-vars": "off",
|
|
11767
|
+
// Type aware rules
|
|
11098
11768
|
...tsRulesOff,
|
|
11099
11769
|
...overrides
|
|
11100
11770
|
}
|
|
11771
|
+
},
|
|
11772
|
+
{
|
|
11773
|
+
files: ["**/README.md", "**/README.md/**"],
|
|
11774
|
+
languageOptions: {
|
|
11775
|
+
parserOptions: {
|
|
11776
|
+
ecmaFeatures: {
|
|
11777
|
+
impliedStrict: true
|
|
11778
|
+
}
|
|
11779
|
+
}
|
|
11780
|
+
},
|
|
11781
|
+
name: "jsse/markdown/rules/readme",
|
|
11782
|
+
rules: {
|
|
11783
|
+
"unicorn/filename-case": "off",
|
|
11784
|
+
"unicorn/no-null": "off"
|
|
11785
|
+
}
|
|
11101
11786
|
}
|
|
11102
11787
|
];
|
|
11103
11788
|
};
|
|
@@ -11926,25 +12611,33 @@ function tailwindSettings(options) {
|
|
|
11926
12611
|
return { ...TAILWIND_ESLINT_SETTINGS_DEFAULT, ...options };
|
|
11927
12612
|
}
|
|
11928
12613
|
var tailwind = async (options) => {
|
|
11929
|
-
const
|
|
11930
|
-
return
|
|
11931
|
-
{
|
|
11932
|
-
|
|
11933
|
-
|
|
11934
|
-
|
|
11935
|
-
|
|
11936
|
-
|
|
11937
|
-
|
|
11938
|
-
|
|
11939
|
-
|
|
11940
|
-
|
|
11941
|
-
|
|
11942
|
-
|
|
11943
|
-
|
|
11944
|
-
|
|
11945
|
-
|
|
12614
|
+
const importResult = await safeImportPluginTailwind();
|
|
12615
|
+
return importResult.match(
|
|
12616
|
+
({ pluginTailwind }) => {
|
|
12617
|
+
return [
|
|
12618
|
+
{
|
|
12619
|
+
files: [GLOB_SRC],
|
|
12620
|
+
name: "jsse/tailwind/rules",
|
|
12621
|
+
plugins: {
|
|
12622
|
+
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
|
|
12623
|
+
tailwindcss: pluginTailwind
|
|
12624
|
+
},
|
|
12625
|
+
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
|
|
12626
|
+
rules: {
|
|
12627
|
+
// eslint-disable-next-line @typescript-eslint/no-unsafe-member-access
|
|
12628
|
+
...pluginTailwind.configs.recommended.rules
|
|
12629
|
+
},
|
|
12630
|
+
settings: {
|
|
12631
|
+
tailwindcss: tailwindSettings(options)
|
|
12632
|
+
}
|
|
12633
|
+
}
|
|
12634
|
+
];
|
|
12635
|
+
},
|
|
12636
|
+
(error) => {
|
|
12637
|
+
log.error(error.message);
|
|
12638
|
+
return [];
|
|
11946
12639
|
}
|
|
11947
|
-
|
|
12640
|
+
);
|
|
11948
12641
|
};
|
|
11949
12642
|
|
|
11950
12643
|
// src/configs/ts/parser.ts
|
|
@@ -12343,87 +13036,7 @@ var yml = async (options) => {
|
|
|
12343
13036
|
];
|
|
12344
13037
|
};
|
|
12345
13038
|
|
|
12346
|
-
// src/
|
|
12347
|
-
var levels = {
|
|
12348
|
-
trace: 10,
|
|
12349
|
-
debug: 20,
|
|
12350
|
-
info: 30,
|
|
12351
|
-
warn: 40,
|
|
12352
|
-
error: 50,
|
|
12353
|
-
fatal: 60
|
|
12354
|
-
};
|
|
12355
|
-
function isLagerLevel(level) {
|
|
12356
|
-
return level === "trace" || level === "debug" || level === "info" || level === "warn" || level === "error" || level === "fatal";
|
|
12357
|
-
}
|
|
12358
|
-
var Lager = class {
|
|
12359
|
-
_level = "info";
|
|
12360
|
-
id = "lager";
|
|
12361
|
-
levelNo = levels[this._level];
|
|
12362
|
-
prefix = "";
|
|
12363
|
-
constructor(options) {
|
|
12364
|
-
const { level, id, prefix } = {
|
|
12365
|
-
level: "info",
|
|
12366
|
-
id: "lager",
|
|
12367
|
-
prefix: "@jsse/eslint-config",
|
|
12368
|
-
...options
|
|
12369
|
-
};
|
|
12370
|
-
this.id = id;
|
|
12371
|
-
this._level = isLagerLevel(level) ? level : "info";
|
|
12372
|
-
this.levelNo = levels[this._level];
|
|
12373
|
-
this.prefix = prefix;
|
|
12374
|
-
this.log = this.log.bind(this);
|
|
12375
|
-
this.debug = this.debug.bind(this);
|
|
12376
|
-
}
|
|
12377
|
-
get level() {
|
|
12378
|
-
return this._level;
|
|
12379
|
-
}
|
|
12380
|
-
set level(level) {
|
|
12381
|
-
this._level = level;
|
|
12382
|
-
this.levelNo = levels[level];
|
|
12383
|
-
}
|
|
12384
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
12385
|
-
log(...args) {
|
|
12386
|
-
console.log(...args);
|
|
12387
|
-
}
|
|
12388
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
12389
|
-
trace(...args) {
|
|
12390
|
-
if (this.levelNo > levels.trace) {
|
|
12391
|
-
return;
|
|
12392
|
-
}
|
|
12393
|
-
console.trace(...args);
|
|
12394
|
-
}
|
|
12395
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
12396
|
-
debug(...args) {
|
|
12397
|
-
if (this.levelNo > levels.debug) {
|
|
12398
|
-
return;
|
|
12399
|
-
}
|
|
12400
|
-
console.debug(...args);
|
|
12401
|
-
}
|
|
12402
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
12403
|
-
info(...args) {
|
|
12404
|
-
if (this.levelNo > levels.info) {
|
|
12405
|
-
return;
|
|
12406
|
-
}
|
|
12407
|
-
console.info("[@jsse/eslint-config]", ...args);
|
|
12408
|
-
}
|
|
12409
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
12410
|
-
warn(...args) {
|
|
12411
|
-
if (this.levelNo > levels.warn) {
|
|
12412
|
-
return;
|
|
12413
|
-
}
|
|
12414
|
-
console.warn(...args);
|
|
12415
|
-
}
|
|
12416
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
12417
|
-
error(...args) {
|
|
12418
|
-
if (this.levelNo > levels.error) {
|
|
12419
|
-
return;
|
|
12420
|
-
}
|
|
12421
|
-
console.error(...args);
|
|
12422
|
-
}
|
|
12423
|
-
};
|
|
12424
|
-
var log = new Lager();
|
|
12425
|
-
|
|
12426
|
-
// src/factory.ts
|
|
13039
|
+
// src/define-config.ts
|
|
12427
13040
|
var flatConfigProps = [
|
|
12428
13041
|
"files",
|
|
12429
13042
|
"ignores",
|
|
@@ -12434,7 +13047,9 @@ var flatConfigProps = [
|
|
|
12434
13047
|
"rules",
|
|
12435
13048
|
"settings"
|
|
12436
13049
|
];
|
|
12437
|
-
var DEBUG =
|
|
13050
|
+
var DEBUG = ["1", "true", "t", "on", "yes", "y"].includes(
|
|
13051
|
+
import_node_process6.default.env.DEBUG ?? ""
|
|
13052
|
+
);
|
|
12438
13053
|
function defaultOptions2() {
|
|
12439
13054
|
return {
|
|
12440
13055
|
componentExts: [],
|
|
@@ -12625,37 +13240,14 @@ async function jsse(options = {}, ...userConfigs) {
|
|
|
12625
13240
|
}
|
|
12626
13241
|
const combinedConfigs = await combineAsync(...configs, ...userConfigs);
|
|
12627
13242
|
if (off && off.length > 0) {
|
|
12628
|
-
|
|
12629
|
-
const currentlyActiveRules = /* @__PURE__ */ new Set();
|
|
12630
|
-
for (const config of combinedConfigs) {
|
|
12631
|
-
for (const rule of Object.keys(config.rules ?? {}))
|
|
12632
|
-
currentlyActiveRules.add(rule);
|
|
12633
|
-
}
|
|
12634
|
-
for (const rule of off) {
|
|
12635
|
-
if (!currentlyActiveRules.has(rule)) {
|
|
12636
|
-
log.info(
|
|
12637
|
-
`Rule \`${rule}\` is not active in the current config, you can remove it from the off list`
|
|
12638
|
-
);
|
|
12639
|
-
}
|
|
12640
|
-
}
|
|
12641
|
-
for (const config of combinedConfigs) {
|
|
12642
|
-
for (const cfgRules of [config.rules, config.plugins]) {
|
|
12643
|
-
if (cfgRules) {
|
|
12644
|
-
for (const rule of off) {
|
|
12645
|
-
if (cfgRules[rule] !== void 0 && cfgRules[rule] !== "off" && cfgRules[rule] !== 0) {
|
|
12646
|
-
cfgRules[rule] = "off";
|
|
12647
|
-
}
|
|
12648
|
-
}
|
|
12649
|
-
}
|
|
12650
|
-
}
|
|
12651
|
-
}
|
|
13243
|
+
turnOffRules(combinedConfigs, off);
|
|
12652
13244
|
}
|
|
12653
13245
|
if (normalizedOptions.rootId !== "jsse") {
|
|
12654
13246
|
for (const config of combinedConfigs) {
|
|
12655
13247
|
if (config.name && config.name.startsWith("jsse/")) {
|
|
12656
13248
|
config.name = config.name.replace(
|
|
12657
13249
|
"jsse/",
|
|
12658
|
-
`${normalizedOptions.rootId}
|
|
13250
|
+
`${normalizedOptions.rootId}/`
|
|
12659
13251
|
);
|
|
12660
13252
|
}
|
|
12661
13253
|
}
|
|
@@ -12695,23 +13287,25 @@ async function jsse(options = {}, ...userConfigs) {
|
|
|
12695
13287
|
}
|
|
12696
13288
|
return combinedConfigs;
|
|
12697
13289
|
}
|
|
13290
|
+
async function defineConfig(options = {}, ...userConfigs) {
|
|
13291
|
+
return jsse(options, ...userConfigs);
|
|
13292
|
+
}
|
|
12698
13293
|
|
|
12699
13294
|
// src/presets.ts
|
|
12700
|
-
|
|
12701
|
-
return jsse(
|
|
12702
|
-
|
|
12703
|
-
|
|
12704
|
-
|
|
12705
|
-
|
|
12706
|
-
|
|
12707
|
-
|
|
12708
|
-
|
|
12709
|
-
|
|
12710
|
-
|
|
12711
|
-
|
|
12712
|
-
|
|
12713
|
-
|
|
12714
|
-
}
|
|
13295
|
+
var jsseReact = (options, ...configs) => {
|
|
13296
|
+
return jsse(
|
|
13297
|
+
{
|
|
13298
|
+
react: true,
|
|
13299
|
+
reactRefresh: true,
|
|
13300
|
+
tailwind: true,
|
|
13301
|
+
typescript: {
|
|
13302
|
+
tsconfig: ["./tsconfig.json", "./tsconfig.eslint.json"]
|
|
13303
|
+
},
|
|
13304
|
+
...options
|
|
13305
|
+
},
|
|
13306
|
+
...configs
|
|
13307
|
+
);
|
|
13308
|
+
};
|
|
12715
13309
|
// Annotate the CommonJS export names for ESM import in node:
|
|
12716
13310
|
0 && (module.exports = {
|
|
12717
13311
|
GLOB_ALL_SRC,
|
|
@@ -12728,6 +13322,7 @@ function jsseReact() {
|
|
|
12728
13322
|
GLOB_LESS,
|
|
12729
13323
|
GLOB_MARKDOWN,
|
|
12730
13324
|
GLOB_MARKDOWN_CODE,
|
|
13325
|
+
GLOB_MARKDOWN_IN_MARKDOWN,
|
|
12731
13326
|
GLOB_SCSS,
|
|
12732
13327
|
GLOB_SRC,
|
|
12733
13328
|
GLOB_SRC_EXT,
|
|
@@ -12739,8 +13334,11 @@ function jsseReact() {
|
|
|
12739
13334
|
GLOB_TSX,
|
|
12740
13335
|
GLOB_YAML,
|
|
12741
13336
|
SLOW_RULES,
|
|
13337
|
+
changeRuleEntrySeverity,
|
|
12742
13338
|
combine,
|
|
12743
13339
|
combineAsync,
|
|
13340
|
+
defineConfig,
|
|
13341
|
+
error2warn,
|
|
12744
13342
|
importJsoncLibs,
|
|
12745
13343
|
importParserJsonc,
|
|
12746
13344
|
importPluginJsdoc,
|
|
@@ -12759,7 +13357,7 @@ function jsseReact() {
|
|
|
12759
13357
|
isInEditor,
|
|
12760
13358
|
jsse,
|
|
12761
13359
|
jsseReact,
|
|
12762
|
-
|
|
13360
|
+
parserPlain,
|
|
12763
13361
|
parserTs,
|
|
12764
13362
|
pluginAntfu,
|
|
12765
13363
|
pluginEslintComments,
|
|
@@ -12770,5 +13368,8 @@ function jsseReact() {
|
|
|
12770
13368
|
pluginUnicorn,
|
|
12771
13369
|
pluginUnusedImports,
|
|
12772
13370
|
renameRules,
|
|
12773
|
-
|
|
13371
|
+
safeImportPluginTailwind,
|
|
13372
|
+
turnOffRules,
|
|
13373
|
+
uniqueStrings,
|
|
13374
|
+
warn2error
|
|
12774
13375
|
});
|