@jsse/eslint-config 0.1.6 → 0.1.7
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 +4 -3
- package/dist/cli.js +4 -3
- package/dist/index.cjs +299 -181
- package/dist/index.d.cts +1805 -499
- package/dist/index.d.ts +1805 -499
- package/dist/index.js +303 -186
- package/package.json +27 -7
package/dist/index.cjs
CHANGED
|
@@ -2812,33 +2812,34 @@ __export(src_exports, {
|
|
|
2812
2812
|
combine: () => combine,
|
|
2813
2813
|
combineAsync: () => combineAsync,
|
|
2814
2814
|
default: () => jsse,
|
|
2815
|
+
importJsoncLibs: () => importJsoncLibs,
|
|
2816
|
+
importParserJsonc: () => importParserJsonc,
|
|
2817
|
+
importPluginJsdoc: () => importPluginJsdoc,
|
|
2818
|
+
importPluginJsonc: () => importPluginJsonc,
|
|
2819
|
+
importPluginMarkdown: () => importPluginMarkdown,
|
|
2820
|
+
importPluginReact: () => importPluginReact,
|
|
2821
|
+
importPluginReactHooks: () => importPluginReactHooks,
|
|
2822
|
+
importPluginReactRefresh: () => importPluginReactRefresh,
|
|
2823
|
+
importPluginStylistic: () => importPluginStylistic,
|
|
2824
|
+
importPluginTailwind: () => importPluginTailwind,
|
|
2825
|
+
importReactPlugins: () => importReactPlugins,
|
|
2826
|
+
importYmlLibs: () => importYmlLibs,
|
|
2815
2827
|
interopDefault: () => interopDefault2,
|
|
2816
2828
|
isCI: () => isCI,
|
|
2817
2829
|
isInEditor: () => isInEditor,
|
|
2818
2830
|
jsse: () => jsse,
|
|
2819
2831
|
jsseReact: () => jsseReact,
|
|
2820
2832
|
jssestd: () => jssestd,
|
|
2821
|
-
parserJsonc: () => import_jsonc_eslint_parser.default,
|
|
2822
2833
|
parserTs: () => parserTs,
|
|
2823
2834
|
pluginAntfu: () => import_eslint_plugin_antfu.default,
|
|
2824
2835
|
pluginEslintComments: () => import_eslint_plugin_eslint_comments.default,
|
|
2825
2836
|
pluginImport: () => pluginImport,
|
|
2826
|
-
pluginJsdoc: () => import_eslint_plugin_jsdoc.default,
|
|
2827
|
-
pluginJsonc: () => pluginJsonc,
|
|
2828
|
-
pluginMarkdown: () => import_eslint_plugin_markdown.default,
|
|
2829
2837
|
pluginN: () => import_eslint_plugin_n.default,
|
|
2830
|
-
pluginNoOnlyTests: () => import_eslint_plugin_no_only_tests.default,
|
|
2831
2838
|
pluginPerfectionist: () => import_eslint_plugin_perfectionist.default,
|
|
2832
|
-
pluginReact: () => import_eslint_plugin_react.default,
|
|
2833
|
-
pluginReactHooks: () => import_eslint_plugin_react_hooks.default,
|
|
2834
|
-
pluginReactRefresh: () => pluginReactRefresh,
|
|
2835
2839
|
pluginSortKeys: () => pluginSortKeys,
|
|
2836
|
-
|
|
2837
|
-
pluginTailwind: () => import_eslint_plugin_tailwindcss.default,
|
|
2838
|
-
pluginTs: () => import_eslint_plugin2.default,
|
|
2840
|
+
pluginTs: () => import_eslint_plugin.default,
|
|
2839
2841
|
pluginUnicorn: () => import_eslint_plugin_unicorn.default,
|
|
2840
2842
|
pluginUnusedImports: () => import_eslint_plugin_unused_imports.default,
|
|
2841
|
-
pluginVitest: () => import_eslint_plugin_vitest.default,
|
|
2842
2843
|
renameRules: () => renameRules
|
|
2843
2844
|
});
|
|
2844
2845
|
module.exports = __toCommonJS(src_exports);
|
|
@@ -9660,6 +9661,83 @@ function resolvePackage(name, options = {}) {
|
|
|
9660
9661
|
}
|
|
9661
9662
|
}
|
|
9662
9663
|
|
|
9664
|
+
// src/lager.ts
|
|
9665
|
+
var levels = {
|
|
9666
|
+
trace: 10,
|
|
9667
|
+
debug: 20,
|
|
9668
|
+
info: 30,
|
|
9669
|
+
warn: 40,
|
|
9670
|
+
error: 50,
|
|
9671
|
+
fatal: 60
|
|
9672
|
+
};
|
|
9673
|
+
function isLagerLevel(level) {
|
|
9674
|
+
return level === "trace" || level === "debug" || level === "info" || level === "warn" || level === "error" || level === "fatal";
|
|
9675
|
+
}
|
|
9676
|
+
var Lager = class {
|
|
9677
|
+
constructor(options) {
|
|
9678
|
+
this._level = "info";
|
|
9679
|
+
this.id = "lager";
|
|
9680
|
+
this.levelNo = levels[this._level];
|
|
9681
|
+
const { level, id } = {
|
|
9682
|
+
level: "info",
|
|
9683
|
+
id: "lager",
|
|
9684
|
+
...options
|
|
9685
|
+
};
|
|
9686
|
+
this.id = id;
|
|
9687
|
+
this._level = isLagerLevel(level) ? level : "info";
|
|
9688
|
+
this.levelNo = levels[this._level];
|
|
9689
|
+
this.log = this.log.bind(this);
|
|
9690
|
+
this.debug = this.debug.bind(this);
|
|
9691
|
+
}
|
|
9692
|
+
get level() {
|
|
9693
|
+
return this._level;
|
|
9694
|
+
}
|
|
9695
|
+
set level(level) {
|
|
9696
|
+
this._level = level;
|
|
9697
|
+
this.levelNo = levels[level];
|
|
9698
|
+
}
|
|
9699
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
9700
|
+
log(...args) {
|
|
9701
|
+
console.log(...args);
|
|
9702
|
+
}
|
|
9703
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
9704
|
+
trace(...args) {
|
|
9705
|
+
if (this.levelNo > levels.trace) {
|
|
9706
|
+
return;
|
|
9707
|
+
}
|
|
9708
|
+
console.trace(...args);
|
|
9709
|
+
}
|
|
9710
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
9711
|
+
debug(...args) {
|
|
9712
|
+
if (this.levelNo > levels.debug) {
|
|
9713
|
+
return;
|
|
9714
|
+
}
|
|
9715
|
+
console.debug(...args);
|
|
9716
|
+
}
|
|
9717
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
9718
|
+
info(...args) {
|
|
9719
|
+
if (this.levelNo > levels.info) {
|
|
9720
|
+
return;
|
|
9721
|
+
}
|
|
9722
|
+
console.info(...args);
|
|
9723
|
+
}
|
|
9724
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
9725
|
+
warn(...args) {
|
|
9726
|
+
if (this.levelNo > levels.warn) {
|
|
9727
|
+
return;
|
|
9728
|
+
}
|
|
9729
|
+
console.warn(...args);
|
|
9730
|
+
}
|
|
9731
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
9732
|
+
error(...args) {
|
|
9733
|
+
if (this.levelNo > levels.error) {
|
|
9734
|
+
return;
|
|
9735
|
+
}
|
|
9736
|
+
console.error(...args);
|
|
9737
|
+
}
|
|
9738
|
+
};
|
|
9739
|
+
var log = new Lager();
|
|
9740
|
+
|
|
9663
9741
|
// src/globs.ts
|
|
9664
9742
|
var GLOB_SRC_EXT = "?([cm])[jt]s?(x)";
|
|
9665
9743
|
var GLOB_SRC = "**/*.?([cm])[jt]s?(x)";
|
|
@@ -9728,28 +9806,135 @@ var GLOB_EXCLUDE = [
|
|
|
9728
9806
|
"**/yarn.lock"
|
|
9729
9807
|
];
|
|
9730
9808
|
|
|
9809
|
+
// src/utils.ts
|
|
9810
|
+
var import_node_process3 = __toESM(require("process"), 1);
|
|
9811
|
+
async function combine(...configs) {
|
|
9812
|
+
const resolved = await Promise.all(configs);
|
|
9813
|
+
return resolved.flat();
|
|
9814
|
+
}
|
|
9815
|
+
async function combineAsync(...configs) {
|
|
9816
|
+
const resolved = await Promise.all(configs);
|
|
9817
|
+
return resolved.flatMap(
|
|
9818
|
+
(config) => Array.isArray(config) ? config : [config]
|
|
9819
|
+
);
|
|
9820
|
+
}
|
|
9821
|
+
function renameRules(rules, from, to) {
|
|
9822
|
+
if (from === to) {
|
|
9823
|
+
return rules;
|
|
9824
|
+
}
|
|
9825
|
+
return Object.fromEntries(
|
|
9826
|
+
Object.entries(rules).map(([key, value]) => {
|
|
9827
|
+
if (key.startsWith(from)) {
|
|
9828
|
+
return [to + key.slice(from.length), value];
|
|
9829
|
+
}
|
|
9830
|
+
return [key, value];
|
|
9831
|
+
})
|
|
9832
|
+
);
|
|
9833
|
+
}
|
|
9834
|
+
async function interopDefault2(m) {
|
|
9835
|
+
const resolved = await m;
|
|
9836
|
+
return resolved.default || resolved;
|
|
9837
|
+
}
|
|
9838
|
+
function isCI() {
|
|
9839
|
+
return !!import_node_process3.default.env.CI;
|
|
9840
|
+
}
|
|
9841
|
+
function isInEditor() {
|
|
9842
|
+
return !!((import_node_process3.default.env.VSCODE_PID || import_node_process3.default.env.JETBRAINS_IDE) && !isCI());
|
|
9843
|
+
}
|
|
9844
|
+
|
|
9731
9845
|
// src/plugins.ts
|
|
9732
|
-
var import_eslint_plugin = __toESM(require("@stylistic/eslint-plugin"), 1);
|
|
9733
|
-
var import_eslint_plugin2 = __toESM(require("@typescript-eslint/eslint-plugin"), 1);
|
|
9734
|
-
var parserTs = __toESM(require("@typescript-eslint/parser"), 1);
|
|
9735
9846
|
var import_eslint_plugin_antfu = __toESM(require("eslint-plugin-antfu"), 1);
|
|
9736
|
-
var import_eslint_plugin_eslint_comments = __toESM(require("eslint-plugin-eslint-comments"), 1);
|
|
9737
9847
|
var pluginImport = __toESM(require("eslint-plugin-import-x"), 1);
|
|
9738
|
-
var import_eslint_plugin_jsdoc = __toESM(require("eslint-plugin-jsdoc"), 1);
|
|
9739
|
-
var pluginJsonc = __toESM(require("eslint-plugin-jsonc"), 1);
|
|
9740
|
-
var import_eslint_plugin_markdown = __toESM(require("eslint-plugin-markdown"), 1);
|
|
9741
9848
|
var import_eslint_plugin_n = __toESM(require("eslint-plugin-n"), 1);
|
|
9742
|
-
var import_eslint_plugin_no_only_tests = __toESM(require("eslint-plugin-no-only-tests"), 1);
|
|
9743
|
-
var import_eslint_plugin_perfectionist = __toESM(require("eslint-plugin-perfectionist"), 1);
|
|
9744
|
-
var import_eslint_plugin_react = __toESM(require("eslint-plugin-react"), 1);
|
|
9745
|
-
var import_eslint_plugin_react_hooks = __toESM(require("eslint-plugin-react-hooks"), 1);
|
|
9746
|
-
var pluginReactRefresh = __toESM(require("eslint-plugin-react-refresh"), 1);
|
|
9747
|
-
var pluginSortKeys = __toESM(require_eslint_plugin_sort_keys(), 1);
|
|
9748
|
-
var import_eslint_plugin_tailwindcss = __toESM(require("eslint-plugin-tailwindcss"), 1);
|
|
9749
9849
|
var import_eslint_plugin_unicorn = __toESM(require("eslint-plugin-unicorn"), 1);
|
|
9750
9850
|
var import_eslint_plugin_unused_imports = __toESM(require("eslint-plugin-unused-imports"), 1);
|
|
9751
|
-
var
|
|
9752
|
-
var
|
|
9851
|
+
var import_eslint_plugin_perfectionist = __toESM(require("eslint-plugin-perfectionist"), 1);
|
|
9852
|
+
var import_eslint_plugin_eslint_comments = __toESM(require("eslint-plugin-eslint-comments"), 1);
|
|
9853
|
+
var import_eslint_plugin = __toESM(require("@typescript-eslint/eslint-plugin"), 1);
|
|
9854
|
+
var parserTs = __toESM(require("@typescript-eslint/parser"), 1);
|
|
9855
|
+
var pluginSortKeys = __toESM(require_eslint_plugin_sort_keys(), 1);
|
|
9856
|
+
async function importPluginReact() {
|
|
9857
|
+
const pluginReact = await interopDefault2(import("eslint-plugin-react"));
|
|
9858
|
+
return {
|
|
9859
|
+
pluginReact
|
|
9860
|
+
};
|
|
9861
|
+
}
|
|
9862
|
+
async function importPluginReactHooks() {
|
|
9863
|
+
const pluginReactHooks = await interopDefault2(
|
|
9864
|
+
import("eslint-plugin-react-hooks")
|
|
9865
|
+
);
|
|
9866
|
+
return {
|
|
9867
|
+
pluginReactHooks
|
|
9868
|
+
};
|
|
9869
|
+
}
|
|
9870
|
+
async function importPluginReactRefresh() {
|
|
9871
|
+
const pluginReactRefresh = await interopDefault2(
|
|
9872
|
+
import("eslint-plugin-react-refresh")
|
|
9873
|
+
);
|
|
9874
|
+
return {
|
|
9875
|
+
pluginReactRefresh
|
|
9876
|
+
};
|
|
9877
|
+
}
|
|
9878
|
+
async function importReactPlugins() {
|
|
9879
|
+
const [pluginReact, pluginReactHooks, pluginReactRefresh] = await Promise.all(
|
|
9880
|
+
[
|
|
9881
|
+
interopDefault2(import("eslint-plugin-react")),
|
|
9882
|
+
interopDefault2(import("eslint-plugin-react-hooks")),
|
|
9883
|
+
interopDefault2(import("eslint-plugin-react-refresh"))
|
|
9884
|
+
]
|
|
9885
|
+
);
|
|
9886
|
+
return { pluginReact, pluginReactHooks, pluginReactRefresh };
|
|
9887
|
+
}
|
|
9888
|
+
async function importParserJsonc() {
|
|
9889
|
+
const parserJsonc = await interopDefault2(import("jsonc-eslint-parser"));
|
|
9890
|
+
return {
|
|
9891
|
+
parserJsonc
|
|
9892
|
+
};
|
|
9893
|
+
}
|
|
9894
|
+
async function importPluginJsonc() {
|
|
9895
|
+
const pluginJsonc = await interopDefault2(import("eslint-plugin-jsonc"));
|
|
9896
|
+
return {
|
|
9897
|
+
pluginJsonc
|
|
9898
|
+
};
|
|
9899
|
+
}
|
|
9900
|
+
async function importJsoncLibs() {
|
|
9901
|
+
const [{ parserJsonc }, { pluginJsonc }] = await Promise.all([
|
|
9902
|
+
importParserJsonc(),
|
|
9903
|
+
importPluginJsonc()
|
|
9904
|
+
]);
|
|
9905
|
+
return { parserJsonc, pluginJsonc };
|
|
9906
|
+
}
|
|
9907
|
+
async function importYmlLibs() {
|
|
9908
|
+
const [pluginYaml, parserYaml] = await Promise.all([
|
|
9909
|
+
interopDefault2(import("eslint-plugin-yml")),
|
|
9910
|
+
interopDefault2(import("yaml-eslint-parser"))
|
|
9911
|
+
]);
|
|
9912
|
+
return { parserYaml, pluginYaml };
|
|
9913
|
+
}
|
|
9914
|
+
async function importPluginMarkdown() {
|
|
9915
|
+
const pluginMarkdown = await interopDefault2(import("eslint-plugin-markdown"));
|
|
9916
|
+
return {
|
|
9917
|
+
pluginMarkdown
|
|
9918
|
+
};
|
|
9919
|
+
}
|
|
9920
|
+
async function importPluginJsdoc() {
|
|
9921
|
+
const pluginJsdoc = await interopDefault2(import("eslint-plugin-jsdoc"));
|
|
9922
|
+
return {
|
|
9923
|
+
pluginJsdoc
|
|
9924
|
+
};
|
|
9925
|
+
}
|
|
9926
|
+
async function importPluginStylistic() {
|
|
9927
|
+
const pluginStylistic = await interopDefault2(
|
|
9928
|
+
import("@stylistic/eslint-plugin")
|
|
9929
|
+
);
|
|
9930
|
+
return { pluginStylistic };
|
|
9931
|
+
}
|
|
9932
|
+
async function importPluginTailwind() {
|
|
9933
|
+
const pluginTailwind = await interopDefault2(
|
|
9934
|
+
import("eslint-plugin-tailwindcss")
|
|
9935
|
+
);
|
|
9936
|
+
return { pluginTailwind };
|
|
9937
|
+
}
|
|
9753
9938
|
|
|
9754
9939
|
// src/configs/antfu.ts
|
|
9755
9940
|
var antfu = async () => {
|
|
@@ -9767,7 +9952,7 @@ var antfu = async () => {
|
|
|
9767
9952
|
},
|
|
9768
9953
|
{
|
|
9769
9954
|
files: ["**/src/**/*"],
|
|
9770
|
-
name: "jsse:antfu:
|
|
9955
|
+
name: "jsse:antfu:src",
|
|
9771
9956
|
// @ts-expect-error - antfu plugin types err
|
|
9772
9957
|
rules: {
|
|
9773
9958
|
"antfu/no-import-dist": "error"
|
|
@@ -9784,83 +9969,6 @@ var antfu = async () => {
|
|
|
9784
9969
|
];
|
|
9785
9970
|
};
|
|
9786
9971
|
|
|
9787
|
-
// src/lager.ts
|
|
9788
|
-
var levels = {
|
|
9789
|
-
trace: 10,
|
|
9790
|
-
debug: 20,
|
|
9791
|
-
info: 30,
|
|
9792
|
-
warn: 40,
|
|
9793
|
-
error: 50,
|
|
9794
|
-
fatal: 60
|
|
9795
|
-
};
|
|
9796
|
-
function isLagerLevel(level) {
|
|
9797
|
-
return level === "trace" || level === "debug" || level === "info" || level === "warn" || level === "error" || level === "fatal";
|
|
9798
|
-
}
|
|
9799
|
-
var Lager = class {
|
|
9800
|
-
constructor(options) {
|
|
9801
|
-
this._level = "info";
|
|
9802
|
-
this.id = "lager";
|
|
9803
|
-
this.levelNo = levels[this._level];
|
|
9804
|
-
const { level, id } = {
|
|
9805
|
-
level: "info",
|
|
9806
|
-
id: "lager",
|
|
9807
|
-
...options
|
|
9808
|
-
};
|
|
9809
|
-
this.id = id;
|
|
9810
|
-
this._level = isLagerLevel(level) ? level : "info";
|
|
9811
|
-
this.levelNo = levels[this._level];
|
|
9812
|
-
this.log = this.log.bind(this);
|
|
9813
|
-
this.debug = this.debug.bind(this);
|
|
9814
|
-
}
|
|
9815
|
-
get level() {
|
|
9816
|
-
return this._level;
|
|
9817
|
-
}
|
|
9818
|
-
set level(level) {
|
|
9819
|
-
this._level = level;
|
|
9820
|
-
this.levelNo = levels[level];
|
|
9821
|
-
}
|
|
9822
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
9823
|
-
log(...args) {
|
|
9824
|
-
console.log(...args);
|
|
9825
|
-
}
|
|
9826
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
9827
|
-
trace(...args) {
|
|
9828
|
-
if (this.levelNo > levels.trace) {
|
|
9829
|
-
return;
|
|
9830
|
-
}
|
|
9831
|
-
console.trace(...args);
|
|
9832
|
-
}
|
|
9833
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
9834
|
-
debug(...args) {
|
|
9835
|
-
if (this.levelNo > levels.debug) {
|
|
9836
|
-
return;
|
|
9837
|
-
}
|
|
9838
|
-
console.debug(...args);
|
|
9839
|
-
}
|
|
9840
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
9841
|
-
info(...args) {
|
|
9842
|
-
if (this.levelNo > levels.info) {
|
|
9843
|
-
return;
|
|
9844
|
-
}
|
|
9845
|
-
console.info(...args);
|
|
9846
|
-
}
|
|
9847
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
9848
|
-
warn(...args) {
|
|
9849
|
-
if (this.levelNo > levels.warn) {
|
|
9850
|
-
return;
|
|
9851
|
-
}
|
|
9852
|
-
console.warn(...args);
|
|
9853
|
-
}
|
|
9854
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
9855
|
-
error(...args) {
|
|
9856
|
-
if (this.levelNo > levels.error) {
|
|
9857
|
-
return;
|
|
9858
|
-
}
|
|
9859
|
-
console.error(...args);
|
|
9860
|
-
}
|
|
9861
|
-
};
|
|
9862
|
-
var log = new Lager();
|
|
9863
|
-
|
|
9864
9972
|
// src/configs/ts/typescript-rules.ts
|
|
9865
9973
|
function typescriptRulesTypeAware() {
|
|
9866
9974
|
return {
|
|
@@ -10294,6 +10402,7 @@ function typescriptRules(props) {
|
|
|
10294
10402
|
// src/configs/markdown.ts
|
|
10295
10403
|
var markdown = async (options) => {
|
|
10296
10404
|
const { componentExts = [], overrides = {} } = options ?? {};
|
|
10405
|
+
const { pluginMarkdown } = await importPluginMarkdown();
|
|
10297
10406
|
const tsRulesOff = Object.fromEntries(
|
|
10298
10407
|
// @ts-expect-error - undefined
|
|
10299
10408
|
Object.keys(typescriptRulesTypeAware()).map((key) => [
|
|
@@ -10306,7 +10415,7 @@ var markdown = async (options) => {
|
|
|
10306
10415
|
name: "jsse:markdown:setup",
|
|
10307
10416
|
plugins: {
|
|
10308
10417
|
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
|
|
10309
|
-
markdown:
|
|
10418
|
+
markdown: pluginMarkdown
|
|
10310
10419
|
}
|
|
10311
10420
|
},
|
|
10312
10421
|
{
|
|
@@ -10386,7 +10495,7 @@ var imports = async (options) => {
|
|
|
10386
10495
|
const { stylistic: stylistic2 = true } = options ?? {};
|
|
10387
10496
|
return [
|
|
10388
10497
|
{
|
|
10389
|
-
name: "jsse:
|
|
10498
|
+
name: "jsse:import",
|
|
10390
10499
|
plugins: {
|
|
10391
10500
|
import: pluginImport
|
|
10392
10501
|
},
|
|
@@ -10672,11 +10781,12 @@ var javascript = async (options) => {
|
|
|
10672
10781
|
|
|
10673
10782
|
// src/configs/jsdoc.ts
|
|
10674
10783
|
var jsdoc = async () => {
|
|
10784
|
+
const { pluginJsdoc } = await importPluginJsdoc();
|
|
10675
10785
|
return [
|
|
10676
10786
|
{
|
|
10677
10787
|
name: "jsse:jsdoc",
|
|
10678
10788
|
plugins: {
|
|
10679
|
-
jsdoc:
|
|
10789
|
+
jsdoc: pluginJsdoc
|
|
10680
10790
|
},
|
|
10681
10791
|
rules: {
|
|
10682
10792
|
"jsdoc/check-access": "warn",
|
|
@@ -10705,6 +10815,7 @@ var jsdoc = async () => {
|
|
|
10705
10815
|
var jsonc = async (options) => {
|
|
10706
10816
|
const { overrides = {}, stylistic: stylistic2 = true } = options ?? {};
|
|
10707
10817
|
const { indent = 2 } = typeof stylistic2 === "boolean" ? {} : stylistic2;
|
|
10818
|
+
const { parserJsonc, pluginJsonc } = await importJsoncLibs();
|
|
10708
10819
|
return [
|
|
10709
10820
|
{
|
|
10710
10821
|
name: "jsse:jsonc:setup",
|
|
@@ -10716,7 +10827,7 @@ var jsonc = async (options) => {
|
|
|
10716
10827
|
{
|
|
10717
10828
|
files: [GLOB_JSON, GLOB_JSON5, GLOB_JSONC],
|
|
10718
10829
|
languageOptions: {
|
|
10719
|
-
parser:
|
|
10830
|
+
parser: parserJsonc
|
|
10720
10831
|
},
|
|
10721
10832
|
name: "jsse:jsonc:rules",
|
|
10722
10833
|
rules: {
|
|
@@ -10934,7 +11045,7 @@ var prettier = async () => {
|
|
|
10934
11045
|
};
|
|
10935
11046
|
|
|
10936
11047
|
// src/configs/ts/typescript-language-options.ts
|
|
10937
|
-
var
|
|
11048
|
+
var import_node_process4 = __toESM(require("process"), 1);
|
|
10938
11049
|
function typescriptLanguageOptions(options) {
|
|
10939
11050
|
const {
|
|
10940
11051
|
componentExts = [],
|
|
@@ -10944,7 +11055,7 @@ function typescriptLanguageOptions(options) {
|
|
|
10944
11055
|
} = options || {};
|
|
10945
11056
|
const tsOptions = tsconfig ? {
|
|
10946
11057
|
project: Array.isArray(tsconfig) ? tsconfig : [tsconfig],
|
|
10947
|
-
tsconfigRootDir:
|
|
11058
|
+
tsconfigRootDir: import_node_process4.default.cwd()
|
|
10948
11059
|
} : {};
|
|
10949
11060
|
const parserOptions = {
|
|
10950
11061
|
ecmaFeatures: react2 ? { jsx: true, modules: true } : void 0,
|
|
@@ -11130,20 +11241,18 @@ function reactRules() {
|
|
|
11130
11241
|
"react/void-dom-elements-no-children": "error"
|
|
11131
11242
|
};
|
|
11132
11243
|
}
|
|
11133
|
-
function
|
|
11244
|
+
function reactRefreshFlatConfigRules() {
|
|
11134
11245
|
return [
|
|
11135
11246
|
{
|
|
11136
11247
|
files: [GLOB_SRC],
|
|
11137
|
-
|
|
11138
|
-
plugins: { "react-refresh": pluginReactRefresh },
|
|
11248
|
+
name: "jsse:react:refresh",
|
|
11139
11249
|
rules: {
|
|
11140
11250
|
"react-refresh/only-export-components": "error"
|
|
11141
11251
|
}
|
|
11142
11252
|
},
|
|
11143
11253
|
{
|
|
11144
11254
|
files: ["**/*.stories.tsx"],
|
|
11145
|
-
|
|
11146
|
-
plugins: { "react-refresh": pluginReactRefresh },
|
|
11255
|
+
name: "jsse:react:refresh:stories",
|
|
11147
11256
|
rules: {
|
|
11148
11257
|
"react-refresh/only-export-components": "off"
|
|
11149
11258
|
}
|
|
@@ -11185,6 +11294,8 @@ var react = async (options) => {
|
|
|
11185
11294
|
reactRefresh,
|
|
11186
11295
|
tsconfig
|
|
11187
11296
|
} = options ?? {};
|
|
11297
|
+
const reactPlugins = await importReactPlugins();
|
|
11298
|
+
const { pluginReact, pluginReactHooks, pluginReactRefresh } = reactPlugins;
|
|
11188
11299
|
const config = [
|
|
11189
11300
|
{
|
|
11190
11301
|
files: [GLOB_SRC],
|
|
@@ -11197,9 +11308,11 @@ var react = async (options) => {
|
|
|
11197
11308
|
name: "jsse:react:setup",
|
|
11198
11309
|
plugins: {
|
|
11199
11310
|
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
|
|
11200
|
-
react:
|
|
11311
|
+
react: pluginReact,
|
|
11201
11312
|
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
|
|
11202
|
-
"react-hooks":
|
|
11313
|
+
"react-hooks": pluginReactHooks,
|
|
11314
|
+
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
|
|
11315
|
+
"react-refresh": pluginReactRefresh
|
|
11203
11316
|
}
|
|
11204
11317
|
},
|
|
11205
11318
|
{
|
|
@@ -11208,7 +11321,7 @@ var react = async (options) => {
|
|
|
11208
11321
|
rules: {
|
|
11209
11322
|
...reactRecomendedRules(),
|
|
11210
11323
|
// eslint-disable-next-line @typescript-eslint/no-unsafe-member-access
|
|
11211
|
-
...
|
|
11324
|
+
...pluginReact.configs["jsx-runtime"].rules,
|
|
11212
11325
|
...reactRules()
|
|
11213
11326
|
},
|
|
11214
11327
|
settings: {
|
|
@@ -11219,7 +11332,7 @@ var react = async (options) => {
|
|
|
11219
11332
|
}
|
|
11220
11333
|
];
|
|
11221
11334
|
if (reactRefresh) {
|
|
11222
|
-
config.push(...
|
|
11335
|
+
config.push(...reactRefreshFlatConfigRules());
|
|
11223
11336
|
}
|
|
11224
11337
|
return config;
|
|
11225
11338
|
};
|
|
@@ -11243,12 +11356,13 @@ function jsxStylistic({
|
|
|
11243
11356
|
}
|
|
11244
11357
|
var stylistic = async (options) => {
|
|
11245
11358
|
const { indent = 2, jsx = true, quotes = "double" } = options ?? {};
|
|
11359
|
+
const { pluginStylistic } = await importPluginStylistic();
|
|
11246
11360
|
return [
|
|
11247
11361
|
{
|
|
11248
11362
|
name: "jsse:stylistic",
|
|
11249
11363
|
plugins: {
|
|
11250
11364
|
// eslint-disable-next-line @typescript-eslint/naming-convention
|
|
11251
|
-
"@stylistic":
|
|
11365
|
+
"@stylistic": pluginStylistic
|
|
11252
11366
|
},
|
|
11253
11367
|
rules: {
|
|
11254
11368
|
"@stylistic/quote-props": ["error", "as-needed"],
|
|
@@ -11264,18 +11378,44 @@ var stylistic = async (options) => {
|
|
|
11264
11378
|
};
|
|
11265
11379
|
|
|
11266
11380
|
// src/configs/tailwind.ts
|
|
11267
|
-
var
|
|
11381
|
+
var TAILWIND_ESLINT_SETTINGS_DEFAULT = {
|
|
11382
|
+
// These are the default values but feel free to customize
|
|
11383
|
+
callees: ["classnames", "clsx", "ctl", "cn", "cx", "twMerge", "twJoin"],
|
|
11384
|
+
classRegex: "^class(Name)?$",
|
|
11385
|
+
// can be modified to support custom attributes. E.g. "^tw$" for `twin.macro`
|
|
11386
|
+
config: "tailwind.config.js",
|
|
11387
|
+
// returned from `loadConfig()` utility if not provided
|
|
11388
|
+
cssFiles: ["**/*.css", "!**/node_modules", "!**/.*", "!**/dist", "!**/build"],
|
|
11389
|
+
cssFilesRefreshRate: 5e3,
|
|
11390
|
+
removeDuplicates: true,
|
|
11391
|
+
skipClassAttribute: false,
|
|
11392
|
+
tags: [],
|
|
11393
|
+
// can be set to e.g. ['tw'] for use in tw`bg-blue`
|
|
11394
|
+
whitelist: []
|
|
11395
|
+
};
|
|
11396
|
+
function tailwindSettings(options) {
|
|
11397
|
+
if (typeof options === "boolean") {
|
|
11398
|
+
return TAILWIND_ESLINT_SETTINGS_DEFAULT;
|
|
11399
|
+
}
|
|
11400
|
+
return { ...TAILWIND_ESLINT_SETTINGS_DEFAULT, ...options };
|
|
11401
|
+
}
|
|
11402
|
+
var tailwind = async (options) => {
|
|
11403
|
+
const { pluginTailwind } = await importPluginTailwind();
|
|
11268
11404
|
return [
|
|
11269
11405
|
{
|
|
11270
|
-
|
|
11406
|
+
files: [GLOB_SRC],
|
|
11407
|
+
name: "jsse:tailwind:rules",
|
|
11271
11408
|
plugins: {
|
|
11272
11409
|
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
|
|
11273
|
-
tailwindcss:
|
|
11410
|
+
tailwindcss: pluginTailwind
|
|
11274
11411
|
},
|
|
11275
11412
|
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
|
|
11276
11413
|
rules: {
|
|
11277
11414
|
// eslint-disable-next-line @typescript-eslint/no-unsafe-member-access
|
|
11278
|
-
...
|
|
11415
|
+
...pluginTailwind.configs.recommended.rules
|
|
11416
|
+
},
|
|
11417
|
+
settings: {
|
|
11418
|
+
tailwindcss: tailwindSettings(options)
|
|
11279
11419
|
}
|
|
11280
11420
|
}
|
|
11281
11421
|
];
|
|
@@ -11286,7 +11426,7 @@ var sortPackageJson = async () => {
|
|
|
11286
11426
|
return [
|
|
11287
11427
|
{
|
|
11288
11428
|
files: ["**/package.json"],
|
|
11289
|
-
name: "jsse:sort
|
|
11429
|
+
name: "jsse:sort:package-json",
|
|
11290
11430
|
rules: {
|
|
11291
11431
|
"jsonc/sort-array-values": [
|
|
11292
11432
|
"error",
|
|
@@ -11370,7 +11510,7 @@ var sortTsconfig = async () => {
|
|
|
11370
11510
|
return [
|
|
11371
11511
|
{
|
|
11372
11512
|
files: ["**/tsconfig.json", "**/tsconfig.*.json"],
|
|
11373
|
-
name: "jsse:sort
|
|
11513
|
+
name: "jsse:sort:tsconfig",
|
|
11374
11514
|
rules: {
|
|
11375
11515
|
"jsonc/sort-keys": [
|
|
11376
11516
|
"error",
|
|
@@ -11492,52 +11632,21 @@ var sortTsconfig = async () => {
|
|
|
11492
11632
|
];
|
|
11493
11633
|
};
|
|
11494
11634
|
|
|
11495
|
-
// src/utils.ts
|
|
11496
|
-
var import_node_process4 = __toESM(require("process"), 1);
|
|
11497
|
-
async function combine(...configs) {
|
|
11498
|
-
const resolved = await Promise.all(configs);
|
|
11499
|
-
return resolved.flat();
|
|
11500
|
-
}
|
|
11501
|
-
async function combineAsync(...configs) {
|
|
11502
|
-
const resolved = await Promise.all(configs);
|
|
11503
|
-
return resolved.flatMap(
|
|
11504
|
-
(config) => Array.isArray(config) ? config : [config]
|
|
11505
|
-
);
|
|
11506
|
-
}
|
|
11507
|
-
function renameRules(rules, from, to) {
|
|
11508
|
-
if (from === to) {
|
|
11509
|
-
return rules;
|
|
11510
|
-
}
|
|
11511
|
-
return Object.fromEntries(
|
|
11512
|
-
Object.entries(rules).map(([key, value]) => {
|
|
11513
|
-
if (key.startsWith(from)) {
|
|
11514
|
-
return [to + key.slice(from.length), value];
|
|
11515
|
-
}
|
|
11516
|
-
return [key, value];
|
|
11517
|
-
})
|
|
11518
|
-
);
|
|
11519
|
-
}
|
|
11520
|
-
async function interopDefault2(m) {
|
|
11521
|
-
const resolved = await m;
|
|
11522
|
-
return resolved.default || resolved;
|
|
11523
|
-
}
|
|
11524
|
-
function isCI() {
|
|
11525
|
-
return !!import_node_process4.default.env.CI;
|
|
11526
|
-
}
|
|
11527
|
-
function isInEditor() {
|
|
11528
|
-
return !!((import_node_process4.default.env.VSCODE_PID || import_node_process4.default.env.JETBRAINS_IDE) && !isCI());
|
|
11529
|
-
}
|
|
11530
|
-
|
|
11531
11635
|
// src/configs/test.ts
|
|
11532
11636
|
var test = async (options = {}) => {
|
|
11533
11637
|
const { isInEditor: isInEditor2 = false, overrides = {} } = options;
|
|
11638
|
+
const [pluginNoOnlyTests, pluginVitest] = await Promise.all([
|
|
11639
|
+
// @ts-expect-error - types are incorrect/missing
|
|
11640
|
+
interopDefault2(import("eslint-plugin-no-only-tests")),
|
|
11641
|
+
interopDefault2(import("eslint-plugin-vitest"))
|
|
11642
|
+
]);
|
|
11534
11643
|
return [
|
|
11535
11644
|
{
|
|
11536
11645
|
name: "jsse:test:setup",
|
|
11537
11646
|
plugins: {
|
|
11538
11647
|
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
|
|
11539
|
-
"no-only-tests":
|
|
11540
|
-
vitest:
|
|
11648
|
+
"no-only-tests": pluginNoOnlyTests,
|
|
11649
|
+
vitest: pluginVitest
|
|
11541
11650
|
}
|
|
11542
11651
|
},
|
|
11543
11652
|
{
|
|
@@ -11574,9 +11683,9 @@ var typescript = async (options) => {
|
|
|
11574
11683
|
const tsPrefixTo = prefix?.to ?? "@typescript-eslint";
|
|
11575
11684
|
const tsrules = {
|
|
11576
11685
|
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
11577
|
-
...
|
|
11686
|
+
...import_eslint_plugin.default.configs["eslint-recommended"].overrides[0].rules,
|
|
11578
11687
|
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
11579
|
-
...
|
|
11688
|
+
...import_eslint_plugin.default.configs.strict.rules,
|
|
11580
11689
|
"no-invalid-this": "off",
|
|
11581
11690
|
...typescriptRules(
|
|
11582
11691
|
typeAware !== false && tsconfigPath ? { typeAware: true } : { typeAware: false }
|
|
@@ -11589,7 +11698,7 @@ var typescript = async (options) => {
|
|
|
11589
11698
|
name: "jsse:typescript:setup",
|
|
11590
11699
|
plugins: {
|
|
11591
11700
|
import: pluginImport,
|
|
11592
|
-
[tsPrefixTo]:
|
|
11701
|
+
[tsPrefixTo]: import_eslint_plugin.default
|
|
11593
11702
|
}
|
|
11594
11703
|
},
|
|
11595
11704
|
// ...tseslint.configs.recommended,
|
|
@@ -11974,7 +12083,15 @@ async function jsse(options = {}, ...userConfigs) {
|
|
|
11974
12083
|
);
|
|
11975
12084
|
}
|
|
11976
12085
|
if (normalizedOptions.tailwind) {
|
|
11977
|
-
|
|
12086
|
+
try {
|
|
12087
|
+
configs.push(
|
|
12088
|
+
tailwind(
|
|
12089
|
+
normalizedOptions.tailwind === true ? {} : normalizedOptions.tailwind
|
|
12090
|
+
)
|
|
12091
|
+
);
|
|
12092
|
+
} catch (e) {
|
|
12093
|
+
log.error("Tailwind config failed", e);
|
|
12094
|
+
}
|
|
11978
12095
|
}
|
|
11979
12096
|
const fusedConfig = flatConfigProps.reduce((acc, key) => {
|
|
11980
12097
|
if (key in options) {
|
|
@@ -12078,33 +12195,34 @@ function jsseReact() {
|
|
|
12078
12195
|
GLOB_YAML,
|
|
12079
12196
|
combine,
|
|
12080
12197
|
combineAsync,
|
|
12198
|
+
importJsoncLibs,
|
|
12199
|
+
importParserJsonc,
|
|
12200
|
+
importPluginJsdoc,
|
|
12201
|
+
importPluginJsonc,
|
|
12202
|
+
importPluginMarkdown,
|
|
12203
|
+
importPluginReact,
|
|
12204
|
+
importPluginReactHooks,
|
|
12205
|
+
importPluginReactRefresh,
|
|
12206
|
+
importPluginStylistic,
|
|
12207
|
+
importPluginTailwind,
|
|
12208
|
+
importReactPlugins,
|
|
12209
|
+
importYmlLibs,
|
|
12081
12210
|
interopDefault,
|
|
12082
12211
|
isCI,
|
|
12083
12212
|
isInEditor,
|
|
12084
12213
|
jsse,
|
|
12085
12214
|
jsseReact,
|
|
12086
12215
|
jssestd,
|
|
12087
|
-
parserJsonc,
|
|
12088
12216
|
parserTs,
|
|
12089
12217
|
pluginAntfu,
|
|
12090
12218
|
pluginEslintComments,
|
|
12091
12219
|
pluginImport,
|
|
12092
|
-
pluginJsdoc,
|
|
12093
|
-
pluginJsonc,
|
|
12094
|
-
pluginMarkdown,
|
|
12095
12220
|
pluginN,
|
|
12096
|
-
pluginNoOnlyTests,
|
|
12097
12221
|
pluginPerfectionist,
|
|
12098
|
-
pluginReact,
|
|
12099
|
-
pluginReactHooks,
|
|
12100
|
-
pluginReactRefresh,
|
|
12101
12222
|
pluginSortKeys,
|
|
12102
|
-
pluginStylistic,
|
|
12103
|
-
pluginTailwind,
|
|
12104
12223
|
pluginTs,
|
|
12105
12224
|
pluginUnicorn,
|
|
12106
12225
|
pluginUnusedImports,
|
|
12107
|
-
pluginVitest,
|
|
12108
12226
|
renameRules
|
|
12109
12227
|
});
|
|
12110
12228
|
/*! Bundled license information:
|