@jsse/eslint-config 0.1.5 → 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 +300 -184
- package/dist/index.d.cts +1861 -549
- package/dist/index.d.ts +1861 -549
- package/dist/index.js +303 -188
- 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
|
|
9737
|
-
var pluginImport = __toESM(require("eslint-plugin-i"), 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);
|
|
9847
|
+
var pluginImport = __toESM(require("eslint-plugin-import-x"), 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,9 +10495,8 @@ 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
|
-
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
|
|
10392
10500
|
import: pluginImport
|
|
10393
10501
|
},
|
|
10394
10502
|
rules: {
|
|
@@ -10673,11 +10781,12 @@ var javascript = async (options) => {
|
|
|
10673
10781
|
|
|
10674
10782
|
// src/configs/jsdoc.ts
|
|
10675
10783
|
var jsdoc = async () => {
|
|
10784
|
+
const { pluginJsdoc } = await importPluginJsdoc();
|
|
10676
10785
|
return [
|
|
10677
10786
|
{
|
|
10678
10787
|
name: "jsse:jsdoc",
|
|
10679
10788
|
plugins: {
|
|
10680
|
-
jsdoc:
|
|
10789
|
+
jsdoc: pluginJsdoc
|
|
10681
10790
|
},
|
|
10682
10791
|
rules: {
|
|
10683
10792
|
"jsdoc/check-access": "warn",
|
|
@@ -10706,6 +10815,7 @@ var jsdoc = async () => {
|
|
|
10706
10815
|
var jsonc = async (options) => {
|
|
10707
10816
|
const { overrides = {}, stylistic: stylistic2 = true } = options ?? {};
|
|
10708
10817
|
const { indent = 2 } = typeof stylistic2 === "boolean" ? {} : stylistic2;
|
|
10818
|
+
const { parserJsonc, pluginJsonc } = await importJsoncLibs();
|
|
10709
10819
|
return [
|
|
10710
10820
|
{
|
|
10711
10821
|
name: "jsse:jsonc:setup",
|
|
@@ -10717,7 +10827,7 @@ var jsonc = async (options) => {
|
|
|
10717
10827
|
{
|
|
10718
10828
|
files: [GLOB_JSON, GLOB_JSON5, GLOB_JSONC],
|
|
10719
10829
|
languageOptions: {
|
|
10720
|
-
parser:
|
|
10830
|
+
parser: parserJsonc
|
|
10721
10831
|
},
|
|
10722
10832
|
name: "jsse:jsonc:rules",
|
|
10723
10833
|
rules: {
|
|
@@ -10935,7 +11045,7 @@ var prettier = async () => {
|
|
|
10935
11045
|
};
|
|
10936
11046
|
|
|
10937
11047
|
// src/configs/ts/typescript-language-options.ts
|
|
10938
|
-
var
|
|
11048
|
+
var import_node_process4 = __toESM(require("process"), 1);
|
|
10939
11049
|
function typescriptLanguageOptions(options) {
|
|
10940
11050
|
const {
|
|
10941
11051
|
componentExts = [],
|
|
@@ -10945,7 +11055,7 @@ function typescriptLanguageOptions(options) {
|
|
|
10945
11055
|
} = options || {};
|
|
10946
11056
|
const tsOptions = tsconfig ? {
|
|
10947
11057
|
project: Array.isArray(tsconfig) ? tsconfig : [tsconfig],
|
|
10948
|
-
tsconfigRootDir:
|
|
11058
|
+
tsconfigRootDir: import_node_process4.default.cwd()
|
|
10949
11059
|
} : {};
|
|
10950
11060
|
const parserOptions = {
|
|
10951
11061
|
ecmaFeatures: react2 ? { jsx: true, modules: true } : void 0,
|
|
@@ -11131,20 +11241,18 @@ function reactRules() {
|
|
|
11131
11241
|
"react/void-dom-elements-no-children": "error"
|
|
11132
11242
|
};
|
|
11133
11243
|
}
|
|
11134
|
-
function
|
|
11244
|
+
function reactRefreshFlatConfigRules() {
|
|
11135
11245
|
return [
|
|
11136
11246
|
{
|
|
11137
11247
|
files: [GLOB_SRC],
|
|
11138
|
-
|
|
11139
|
-
plugins: { "react-refresh": pluginReactRefresh },
|
|
11248
|
+
name: "jsse:react:refresh",
|
|
11140
11249
|
rules: {
|
|
11141
11250
|
"react-refresh/only-export-components": "error"
|
|
11142
11251
|
}
|
|
11143
11252
|
},
|
|
11144
11253
|
{
|
|
11145
11254
|
files: ["**/*.stories.tsx"],
|
|
11146
|
-
|
|
11147
|
-
plugins: { "react-refresh": pluginReactRefresh },
|
|
11255
|
+
name: "jsse:react:refresh:stories",
|
|
11148
11256
|
rules: {
|
|
11149
11257
|
"react-refresh/only-export-components": "off"
|
|
11150
11258
|
}
|
|
@@ -11186,6 +11294,8 @@ var react = async (options) => {
|
|
|
11186
11294
|
reactRefresh,
|
|
11187
11295
|
tsconfig
|
|
11188
11296
|
} = options ?? {};
|
|
11297
|
+
const reactPlugins = await importReactPlugins();
|
|
11298
|
+
const { pluginReact, pluginReactHooks, pluginReactRefresh } = reactPlugins;
|
|
11189
11299
|
const config = [
|
|
11190
11300
|
{
|
|
11191
11301
|
files: [GLOB_SRC],
|
|
@@ -11198,9 +11308,11 @@ var react = async (options) => {
|
|
|
11198
11308
|
name: "jsse:react:setup",
|
|
11199
11309
|
plugins: {
|
|
11200
11310
|
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
|
|
11201
|
-
react:
|
|
11311
|
+
react: pluginReact,
|
|
11202
11312
|
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
|
|
11203
|
-
"react-hooks":
|
|
11313
|
+
"react-hooks": pluginReactHooks,
|
|
11314
|
+
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
|
|
11315
|
+
"react-refresh": pluginReactRefresh
|
|
11204
11316
|
}
|
|
11205
11317
|
},
|
|
11206
11318
|
{
|
|
@@ -11209,7 +11321,7 @@ var react = async (options) => {
|
|
|
11209
11321
|
rules: {
|
|
11210
11322
|
...reactRecomendedRules(),
|
|
11211
11323
|
// eslint-disable-next-line @typescript-eslint/no-unsafe-member-access
|
|
11212
|
-
...
|
|
11324
|
+
...pluginReact.configs["jsx-runtime"].rules,
|
|
11213
11325
|
...reactRules()
|
|
11214
11326
|
},
|
|
11215
11327
|
settings: {
|
|
@@ -11220,7 +11332,7 @@ var react = async (options) => {
|
|
|
11220
11332
|
}
|
|
11221
11333
|
];
|
|
11222
11334
|
if (reactRefresh) {
|
|
11223
|
-
config.push(...
|
|
11335
|
+
config.push(...reactRefreshFlatConfigRules());
|
|
11224
11336
|
}
|
|
11225
11337
|
return config;
|
|
11226
11338
|
};
|
|
@@ -11244,12 +11356,13 @@ function jsxStylistic({
|
|
|
11244
11356
|
}
|
|
11245
11357
|
var stylistic = async (options) => {
|
|
11246
11358
|
const { indent = 2, jsx = true, quotes = "double" } = options ?? {};
|
|
11359
|
+
const { pluginStylistic } = await importPluginStylistic();
|
|
11247
11360
|
return [
|
|
11248
11361
|
{
|
|
11249
11362
|
name: "jsse:stylistic",
|
|
11250
11363
|
plugins: {
|
|
11251
11364
|
// eslint-disable-next-line @typescript-eslint/naming-convention
|
|
11252
|
-
"@stylistic":
|
|
11365
|
+
"@stylistic": pluginStylistic
|
|
11253
11366
|
},
|
|
11254
11367
|
rules: {
|
|
11255
11368
|
"@stylistic/quote-props": ["error", "as-needed"],
|
|
@@ -11265,18 +11378,44 @@ var stylistic = async (options) => {
|
|
|
11265
11378
|
};
|
|
11266
11379
|
|
|
11267
11380
|
// src/configs/tailwind.ts
|
|
11268
|
-
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();
|
|
11269
11404
|
return [
|
|
11270
11405
|
{
|
|
11271
|
-
|
|
11406
|
+
files: [GLOB_SRC],
|
|
11407
|
+
name: "jsse:tailwind:rules",
|
|
11272
11408
|
plugins: {
|
|
11273
11409
|
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
|
|
11274
|
-
tailwindcss:
|
|
11410
|
+
tailwindcss: pluginTailwind
|
|
11275
11411
|
},
|
|
11276
11412
|
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
|
|
11277
11413
|
rules: {
|
|
11278
11414
|
// eslint-disable-next-line @typescript-eslint/no-unsafe-member-access
|
|
11279
|
-
...
|
|
11415
|
+
...pluginTailwind.configs.recommended.rules
|
|
11416
|
+
},
|
|
11417
|
+
settings: {
|
|
11418
|
+
tailwindcss: tailwindSettings(options)
|
|
11280
11419
|
}
|
|
11281
11420
|
}
|
|
11282
11421
|
];
|
|
@@ -11287,7 +11426,7 @@ var sortPackageJson = async () => {
|
|
|
11287
11426
|
return [
|
|
11288
11427
|
{
|
|
11289
11428
|
files: ["**/package.json"],
|
|
11290
|
-
name: "jsse:sort
|
|
11429
|
+
name: "jsse:sort:package-json",
|
|
11291
11430
|
rules: {
|
|
11292
11431
|
"jsonc/sort-array-values": [
|
|
11293
11432
|
"error",
|
|
@@ -11371,7 +11510,7 @@ var sortTsconfig = async () => {
|
|
|
11371
11510
|
return [
|
|
11372
11511
|
{
|
|
11373
11512
|
files: ["**/tsconfig.json", "**/tsconfig.*.json"],
|
|
11374
|
-
name: "jsse:sort
|
|
11513
|
+
name: "jsse:sort:tsconfig",
|
|
11375
11514
|
rules: {
|
|
11376
11515
|
"jsonc/sort-keys": [
|
|
11377
11516
|
"error",
|
|
@@ -11493,52 +11632,21 @@ var sortTsconfig = async () => {
|
|
|
11493
11632
|
];
|
|
11494
11633
|
};
|
|
11495
11634
|
|
|
11496
|
-
// src/utils.ts
|
|
11497
|
-
var import_node_process4 = __toESM(require("process"), 1);
|
|
11498
|
-
async function combine(...configs) {
|
|
11499
|
-
const resolved = await Promise.all(configs);
|
|
11500
|
-
return resolved.flat();
|
|
11501
|
-
}
|
|
11502
|
-
async function combineAsync(...configs) {
|
|
11503
|
-
const resolved = await Promise.all(configs);
|
|
11504
|
-
return resolved.flatMap(
|
|
11505
|
-
(config) => Array.isArray(config) ? config : [config]
|
|
11506
|
-
);
|
|
11507
|
-
}
|
|
11508
|
-
function renameRules(rules, from, to) {
|
|
11509
|
-
if (from === to) {
|
|
11510
|
-
return rules;
|
|
11511
|
-
}
|
|
11512
|
-
return Object.fromEntries(
|
|
11513
|
-
Object.entries(rules).map(([key, value]) => {
|
|
11514
|
-
if (key.startsWith(from)) {
|
|
11515
|
-
return [to + key.slice(from.length), value];
|
|
11516
|
-
}
|
|
11517
|
-
return [key, value];
|
|
11518
|
-
})
|
|
11519
|
-
);
|
|
11520
|
-
}
|
|
11521
|
-
async function interopDefault2(m) {
|
|
11522
|
-
const resolved = await m;
|
|
11523
|
-
return resolved.default || resolved;
|
|
11524
|
-
}
|
|
11525
|
-
function isCI() {
|
|
11526
|
-
return !!import_node_process4.default.env.CI;
|
|
11527
|
-
}
|
|
11528
|
-
function isInEditor() {
|
|
11529
|
-
return !!((import_node_process4.default.env.VSCODE_PID || import_node_process4.default.env.JETBRAINS_IDE) && !isCI());
|
|
11530
|
-
}
|
|
11531
|
-
|
|
11532
11635
|
// src/configs/test.ts
|
|
11533
11636
|
var test = async (options = {}) => {
|
|
11534
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
|
+
]);
|
|
11535
11643
|
return [
|
|
11536
11644
|
{
|
|
11537
11645
|
name: "jsse:test:setup",
|
|
11538
11646
|
plugins: {
|
|
11539
11647
|
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
|
|
11540
|
-
"no-only-tests":
|
|
11541
|
-
vitest:
|
|
11648
|
+
"no-only-tests": pluginNoOnlyTests,
|
|
11649
|
+
vitest: pluginVitest
|
|
11542
11650
|
}
|
|
11543
11651
|
},
|
|
11544
11652
|
{
|
|
@@ -11575,9 +11683,9 @@ var typescript = async (options) => {
|
|
|
11575
11683
|
const tsPrefixTo = prefix?.to ?? "@typescript-eslint";
|
|
11576
11684
|
const tsrules = {
|
|
11577
11685
|
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
11578
|
-
...
|
|
11686
|
+
...import_eslint_plugin.default.configs["eslint-recommended"].overrides[0].rules,
|
|
11579
11687
|
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
11580
|
-
...
|
|
11688
|
+
...import_eslint_plugin.default.configs.strict.rules,
|
|
11581
11689
|
"no-invalid-this": "off",
|
|
11582
11690
|
...typescriptRules(
|
|
11583
11691
|
typeAware !== false && tsconfigPath ? { typeAware: true } : { typeAware: false }
|
|
@@ -11589,9 +11697,8 @@ var typescript = async (options) => {
|
|
|
11589
11697
|
// Install the plugins without globs, so they can be configured separately.
|
|
11590
11698
|
name: "jsse:typescript:setup",
|
|
11591
11699
|
plugins: {
|
|
11592
|
-
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
|
|
11593
11700
|
import: pluginImport,
|
|
11594
|
-
[tsPrefixTo]:
|
|
11701
|
+
[tsPrefixTo]: import_eslint_plugin.default
|
|
11595
11702
|
}
|
|
11596
11703
|
},
|
|
11597
11704
|
// ...tseslint.configs.recommended,
|
|
@@ -11976,7 +12083,15 @@ async function jsse(options = {}, ...userConfigs) {
|
|
|
11976
12083
|
);
|
|
11977
12084
|
}
|
|
11978
12085
|
if (normalizedOptions.tailwind) {
|
|
11979
|
-
|
|
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
|
+
}
|
|
11980
12095
|
}
|
|
11981
12096
|
const fusedConfig = flatConfigProps.reduce((acc, key) => {
|
|
11982
12097
|
if (key in options) {
|
|
@@ -12080,33 +12195,34 @@ function jsseReact() {
|
|
|
12080
12195
|
GLOB_YAML,
|
|
12081
12196
|
combine,
|
|
12082
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,
|
|
12083
12210
|
interopDefault,
|
|
12084
12211
|
isCI,
|
|
12085
12212
|
isInEditor,
|
|
12086
12213
|
jsse,
|
|
12087
12214
|
jsseReact,
|
|
12088
12215
|
jssestd,
|
|
12089
|
-
parserJsonc,
|
|
12090
12216
|
parserTs,
|
|
12091
12217
|
pluginAntfu,
|
|
12092
12218
|
pluginEslintComments,
|
|
12093
12219
|
pluginImport,
|
|
12094
|
-
pluginJsdoc,
|
|
12095
|
-
pluginJsonc,
|
|
12096
|
-
pluginMarkdown,
|
|
12097
12220
|
pluginN,
|
|
12098
|
-
pluginNoOnlyTests,
|
|
12099
12221
|
pluginPerfectionist,
|
|
12100
|
-
pluginReact,
|
|
12101
|
-
pluginReactHooks,
|
|
12102
|
-
pluginReactRefresh,
|
|
12103
12222
|
pluginSortKeys,
|
|
12104
|
-
pluginStylistic,
|
|
12105
|
-
pluginTailwind,
|
|
12106
12223
|
pluginTs,
|
|
12107
12224
|
pluginUnicorn,
|
|
12108
12225
|
pluginUnusedImports,
|
|
12109
|
-
pluginVitest,
|
|
12110
12226
|
renameRules
|
|
12111
12227
|
});
|
|
12112
12228
|
/*! Bundled license information:
|