@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.js
CHANGED
|
@@ -9594,6 +9594,83 @@ function resolvePackage(name, options = {}) {
|
|
|
9594
9594
|
}
|
|
9595
9595
|
}
|
|
9596
9596
|
|
|
9597
|
+
// src/lager.ts
|
|
9598
|
+
var levels = {
|
|
9599
|
+
trace: 10,
|
|
9600
|
+
debug: 20,
|
|
9601
|
+
info: 30,
|
|
9602
|
+
warn: 40,
|
|
9603
|
+
error: 50,
|
|
9604
|
+
fatal: 60
|
|
9605
|
+
};
|
|
9606
|
+
function isLagerLevel(level) {
|
|
9607
|
+
return level === "trace" || level === "debug" || level === "info" || level === "warn" || level === "error" || level === "fatal";
|
|
9608
|
+
}
|
|
9609
|
+
var Lager = class {
|
|
9610
|
+
constructor(options) {
|
|
9611
|
+
this._level = "info";
|
|
9612
|
+
this.id = "lager";
|
|
9613
|
+
this.levelNo = levels[this._level];
|
|
9614
|
+
const { level, id } = {
|
|
9615
|
+
level: "info",
|
|
9616
|
+
id: "lager",
|
|
9617
|
+
...options
|
|
9618
|
+
};
|
|
9619
|
+
this.id = id;
|
|
9620
|
+
this._level = isLagerLevel(level) ? level : "info";
|
|
9621
|
+
this.levelNo = levels[this._level];
|
|
9622
|
+
this.log = this.log.bind(this);
|
|
9623
|
+
this.debug = this.debug.bind(this);
|
|
9624
|
+
}
|
|
9625
|
+
get level() {
|
|
9626
|
+
return this._level;
|
|
9627
|
+
}
|
|
9628
|
+
set level(level) {
|
|
9629
|
+
this._level = level;
|
|
9630
|
+
this.levelNo = levels[level];
|
|
9631
|
+
}
|
|
9632
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
9633
|
+
log(...args) {
|
|
9634
|
+
console.log(...args);
|
|
9635
|
+
}
|
|
9636
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
9637
|
+
trace(...args) {
|
|
9638
|
+
if (this.levelNo > levels.trace) {
|
|
9639
|
+
return;
|
|
9640
|
+
}
|
|
9641
|
+
console.trace(...args);
|
|
9642
|
+
}
|
|
9643
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
9644
|
+
debug(...args) {
|
|
9645
|
+
if (this.levelNo > levels.debug) {
|
|
9646
|
+
return;
|
|
9647
|
+
}
|
|
9648
|
+
console.debug(...args);
|
|
9649
|
+
}
|
|
9650
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
9651
|
+
info(...args) {
|
|
9652
|
+
if (this.levelNo > levels.info) {
|
|
9653
|
+
return;
|
|
9654
|
+
}
|
|
9655
|
+
console.info(...args);
|
|
9656
|
+
}
|
|
9657
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
9658
|
+
warn(...args) {
|
|
9659
|
+
if (this.levelNo > levels.warn) {
|
|
9660
|
+
return;
|
|
9661
|
+
}
|
|
9662
|
+
console.warn(...args);
|
|
9663
|
+
}
|
|
9664
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
9665
|
+
error(...args) {
|
|
9666
|
+
if (this.levelNo > levels.error) {
|
|
9667
|
+
return;
|
|
9668
|
+
}
|
|
9669
|
+
console.error(...args);
|
|
9670
|
+
}
|
|
9671
|
+
};
|
|
9672
|
+
var log = new Lager();
|
|
9673
|
+
|
|
9597
9674
|
// src/globs.ts
|
|
9598
9675
|
var GLOB_SRC_EXT = "?([cm])[jt]s?(x)";
|
|
9599
9676
|
var GLOB_SRC = "**/*.?([cm])[jt]s?(x)";
|
|
@@ -9662,28 +9739,135 @@ var GLOB_EXCLUDE = [
|
|
|
9662
9739
|
"**/yarn.lock"
|
|
9663
9740
|
];
|
|
9664
9741
|
|
|
9742
|
+
// src/utils.ts
|
|
9743
|
+
import process3 from "process";
|
|
9744
|
+
async function combine(...configs) {
|
|
9745
|
+
const resolved = await Promise.all(configs);
|
|
9746
|
+
return resolved.flat();
|
|
9747
|
+
}
|
|
9748
|
+
async function combineAsync(...configs) {
|
|
9749
|
+
const resolved = await Promise.all(configs);
|
|
9750
|
+
return resolved.flatMap(
|
|
9751
|
+
(config) => Array.isArray(config) ? config : [config]
|
|
9752
|
+
);
|
|
9753
|
+
}
|
|
9754
|
+
function renameRules(rules, from, to) {
|
|
9755
|
+
if (from === to) {
|
|
9756
|
+
return rules;
|
|
9757
|
+
}
|
|
9758
|
+
return Object.fromEntries(
|
|
9759
|
+
Object.entries(rules).map(([key, value]) => {
|
|
9760
|
+
if (key.startsWith(from)) {
|
|
9761
|
+
return [to + key.slice(from.length), value];
|
|
9762
|
+
}
|
|
9763
|
+
return [key, value];
|
|
9764
|
+
})
|
|
9765
|
+
);
|
|
9766
|
+
}
|
|
9767
|
+
async function interopDefault2(m) {
|
|
9768
|
+
const resolved = await m;
|
|
9769
|
+
return resolved.default || resolved;
|
|
9770
|
+
}
|
|
9771
|
+
function isCI() {
|
|
9772
|
+
return !!process3.env.CI;
|
|
9773
|
+
}
|
|
9774
|
+
function isInEditor() {
|
|
9775
|
+
return !!((process3.env.VSCODE_PID || process3.env.JETBRAINS_IDE) && !isCI());
|
|
9776
|
+
}
|
|
9777
|
+
|
|
9665
9778
|
// src/plugins.ts
|
|
9666
9779
|
var pluginSortKeys = __toESM(require_eslint_plugin_sort_keys(), 1);
|
|
9667
|
-
import { default as default2 } from "
|
|
9668
|
-
import { default as default3 } from "@typescript-eslint/eslint-plugin";
|
|
9669
|
-
import * as parserTs from "@typescript-eslint/parser";
|
|
9670
|
-
import { default as default4 } from "eslint-plugin-antfu";
|
|
9671
|
-
import { default as default5 } from "eslint-plugin-eslint-comments";
|
|
9780
|
+
import { default as default2 } from "eslint-plugin-antfu";
|
|
9672
9781
|
import * as pluginImport from "eslint-plugin-import-x";
|
|
9673
|
-
import { default as
|
|
9674
|
-
import
|
|
9675
|
-
import { default as
|
|
9676
|
-
import { default as
|
|
9677
|
-
import { default as
|
|
9678
|
-
import { default as
|
|
9679
|
-
import
|
|
9680
|
-
|
|
9681
|
-
|
|
9682
|
-
|
|
9683
|
-
|
|
9684
|
-
|
|
9685
|
-
|
|
9686
|
-
|
|
9782
|
+
import { default as default3 } from "eslint-plugin-n";
|
|
9783
|
+
import { default as default4 } from "eslint-plugin-unicorn";
|
|
9784
|
+
import { default as default5 } from "eslint-plugin-unused-imports";
|
|
9785
|
+
import { default as default6 } from "eslint-plugin-perfectionist";
|
|
9786
|
+
import { default as default7 } from "eslint-plugin-eslint-comments";
|
|
9787
|
+
import { default as default8 } from "@typescript-eslint/eslint-plugin";
|
|
9788
|
+
import * as parserTs from "@typescript-eslint/parser";
|
|
9789
|
+
async function importPluginReact() {
|
|
9790
|
+
const pluginReact = await interopDefault2(import("eslint-plugin-react"));
|
|
9791
|
+
return {
|
|
9792
|
+
pluginReact
|
|
9793
|
+
};
|
|
9794
|
+
}
|
|
9795
|
+
async function importPluginReactHooks() {
|
|
9796
|
+
const pluginReactHooks = await interopDefault2(
|
|
9797
|
+
import("eslint-plugin-react-hooks")
|
|
9798
|
+
);
|
|
9799
|
+
return {
|
|
9800
|
+
pluginReactHooks
|
|
9801
|
+
};
|
|
9802
|
+
}
|
|
9803
|
+
async function importPluginReactRefresh() {
|
|
9804
|
+
const pluginReactRefresh = await interopDefault2(
|
|
9805
|
+
import("eslint-plugin-react-refresh")
|
|
9806
|
+
);
|
|
9807
|
+
return {
|
|
9808
|
+
pluginReactRefresh
|
|
9809
|
+
};
|
|
9810
|
+
}
|
|
9811
|
+
async function importReactPlugins() {
|
|
9812
|
+
const [pluginReact, pluginReactHooks, pluginReactRefresh] = await Promise.all(
|
|
9813
|
+
[
|
|
9814
|
+
interopDefault2(import("eslint-plugin-react")),
|
|
9815
|
+
interopDefault2(import("eslint-plugin-react-hooks")),
|
|
9816
|
+
interopDefault2(import("eslint-plugin-react-refresh"))
|
|
9817
|
+
]
|
|
9818
|
+
);
|
|
9819
|
+
return { pluginReact, pluginReactHooks, pluginReactRefresh };
|
|
9820
|
+
}
|
|
9821
|
+
async function importParserJsonc() {
|
|
9822
|
+
const parserJsonc = await interopDefault2(import("jsonc-eslint-parser"));
|
|
9823
|
+
return {
|
|
9824
|
+
parserJsonc
|
|
9825
|
+
};
|
|
9826
|
+
}
|
|
9827
|
+
async function importPluginJsonc() {
|
|
9828
|
+
const pluginJsonc = await interopDefault2(import("eslint-plugin-jsonc"));
|
|
9829
|
+
return {
|
|
9830
|
+
pluginJsonc
|
|
9831
|
+
};
|
|
9832
|
+
}
|
|
9833
|
+
async function importJsoncLibs() {
|
|
9834
|
+
const [{ parserJsonc }, { pluginJsonc }] = await Promise.all([
|
|
9835
|
+
importParserJsonc(),
|
|
9836
|
+
importPluginJsonc()
|
|
9837
|
+
]);
|
|
9838
|
+
return { parserJsonc, pluginJsonc };
|
|
9839
|
+
}
|
|
9840
|
+
async function importYmlLibs() {
|
|
9841
|
+
const [pluginYaml, parserYaml] = await Promise.all([
|
|
9842
|
+
interopDefault2(import("eslint-plugin-yml")),
|
|
9843
|
+
interopDefault2(import("yaml-eslint-parser"))
|
|
9844
|
+
]);
|
|
9845
|
+
return { parserYaml, pluginYaml };
|
|
9846
|
+
}
|
|
9847
|
+
async function importPluginMarkdown() {
|
|
9848
|
+
const pluginMarkdown = await interopDefault2(import("eslint-plugin-markdown"));
|
|
9849
|
+
return {
|
|
9850
|
+
pluginMarkdown
|
|
9851
|
+
};
|
|
9852
|
+
}
|
|
9853
|
+
async function importPluginJsdoc() {
|
|
9854
|
+
const pluginJsdoc = await interopDefault2(import("eslint-plugin-jsdoc"));
|
|
9855
|
+
return {
|
|
9856
|
+
pluginJsdoc
|
|
9857
|
+
};
|
|
9858
|
+
}
|
|
9859
|
+
async function importPluginStylistic() {
|
|
9860
|
+
const pluginStylistic = await interopDefault2(
|
|
9861
|
+
import("@stylistic/eslint-plugin")
|
|
9862
|
+
);
|
|
9863
|
+
return { pluginStylistic };
|
|
9864
|
+
}
|
|
9865
|
+
async function importPluginTailwind() {
|
|
9866
|
+
const pluginTailwind = await interopDefault2(
|
|
9867
|
+
import("eslint-plugin-tailwindcss")
|
|
9868
|
+
);
|
|
9869
|
+
return { pluginTailwind };
|
|
9870
|
+
}
|
|
9687
9871
|
|
|
9688
9872
|
// src/configs/antfu.ts
|
|
9689
9873
|
var antfu = async () => {
|
|
@@ -9691,7 +9875,7 @@ var antfu = async () => {
|
|
|
9691
9875
|
{
|
|
9692
9876
|
name: "jsse:antfu",
|
|
9693
9877
|
plugins: {
|
|
9694
|
-
antfu:
|
|
9878
|
+
antfu: default2
|
|
9695
9879
|
},
|
|
9696
9880
|
// @ts-expect-error - antfu plugin types err
|
|
9697
9881
|
rules: {
|
|
@@ -9701,7 +9885,7 @@ var antfu = async () => {
|
|
|
9701
9885
|
},
|
|
9702
9886
|
{
|
|
9703
9887
|
files: ["**/src/**/*"],
|
|
9704
|
-
name: "jsse:antfu:
|
|
9888
|
+
name: "jsse:antfu:src",
|
|
9705
9889
|
// @ts-expect-error - antfu plugin types err
|
|
9706
9890
|
rules: {
|
|
9707
9891
|
"antfu/no-import-dist": "error"
|
|
@@ -9718,83 +9902,6 @@ var antfu = async () => {
|
|
|
9718
9902
|
];
|
|
9719
9903
|
};
|
|
9720
9904
|
|
|
9721
|
-
// src/lager.ts
|
|
9722
|
-
var levels = {
|
|
9723
|
-
trace: 10,
|
|
9724
|
-
debug: 20,
|
|
9725
|
-
info: 30,
|
|
9726
|
-
warn: 40,
|
|
9727
|
-
error: 50,
|
|
9728
|
-
fatal: 60
|
|
9729
|
-
};
|
|
9730
|
-
function isLagerLevel(level) {
|
|
9731
|
-
return level === "trace" || level === "debug" || level === "info" || level === "warn" || level === "error" || level === "fatal";
|
|
9732
|
-
}
|
|
9733
|
-
var Lager = class {
|
|
9734
|
-
constructor(options) {
|
|
9735
|
-
this._level = "info";
|
|
9736
|
-
this.id = "lager";
|
|
9737
|
-
this.levelNo = levels[this._level];
|
|
9738
|
-
const { level, id } = {
|
|
9739
|
-
level: "info",
|
|
9740
|
-
id: "lager",
|
|
9741
|
-
...options
|
|
9742
|
-
};
|
|
9743
|
-
this.id = id;
|
|
9744
|
-
this._level = isLagerLevel(level) ? level : "info";
|
|
9745
|
-
this.levelNo = levels[this._level];
|
|
9746
|
-
this.log = this.log.bind(this);
|
|
9747
|
-
this.debug = this.debug.bind(this);
|
|
9748
|
-
}
|
|
9749
|
-
get level() {
|
|
9750
|
-
return this._level;
|
|
9751
|
-
}
|
|
9752
|
-
set level(level) {
|
|
9753
|
-
this._level = level;
|
|
9754
|
-
this.levelNo = levels[level];
|
|
9755
|
-
}
|
|
9756
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
9757
|
-
log(...args) {
|
|
9758
|
-
console.log(...args);
|
|
9759
|
-
}
|
|
9760
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
9761
|
-
trace(...args) {
|
|
9762
|
-
if (this.levelNo > levels.trace) {
|
|
9763
|
-
return;
|
|
9764
|
-
}
|
|
9765
|
-
console.trace(...args);
|
|
9766
|
-
}
|
|
9767
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
9768
|
-
debug(...args) {
|
|
9769
|
-
if (this.levelNo > levels.debug) {
|
|
9770
|
-
return;
|
|
9771
|
-
}
|
|
9772
|
-
console.debug(...args);
|
|
9773
|
-
}
|
|
9774
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
9775
|
-
info(...args) {
|
|
9776
|
-
if (this.levelNo > levels.info) {
|
|
9777
|
-
return;
|
|
9778
|
-
}
|
|
9779
|
-
console.info(...args);
|
|
9780
|
-
}
|
|
9781
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
9782
|
-
warn(...args) {
|
|
9783
|
-
if (this.levelNo > levels.warn) {
|
|
9784
|
-
return;
|
|
9785
|
-
}
|
|
9786
|
-
console.warn(...args);
|
|
9787
|
-
}
|
|
9788
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
9789
|
-
error(...args) {
|
|
9790
|
-
if (this.levelNo > levels.error) {
|
|
9791
|
-
return;
|
|
9792
|
-
}
|
|
9793
|
-
console.error(...args);
|
|
9794
|
-
}
|
|
9795
|
-
};
|
|
9796
|
-
var log = new Lager();
|
|
9797
|
-
|
|
9798
9905
|
// src/configs/ts/typescript-rules.ts
|
|
9799
9906
|
function typescriptRulesTypeAware() {
|
|
9800
9907
|
return {
|
|
@@ -10228,6 +10335,7 @@ function typescriptRules(props) {
|
|
|
10228
10335
|
// src/configs/markdown.ts
|
|
10229
10336
|
var markdown = async (options) => {
|
|
10230
10337
|
const { componentExts = [], overrides = {} } = options ?? {};
|
|
10338
|
+
const { pluginMarkdown } = await importPluginMarkdown();
|
|
10231
10339
|
const tsRulesOff = Object.fromEntries(
|
|
10232
10340
|
// @ts-expect-error - undefined
|
|
10233
10341
|
Object.keys(typescriptRulesTypeAware()).map((key) => [
|
|
@@ -10240,7 +10348,7 @@ var markdown = async (options) => {
|
|
|
10240
10348
|
name: "jsse:markdown:setup",
|
|
10241
10349
|
plugins: {
|
|
10242
10350
|
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
|
|
10243
|
-
markdown:
|
|
10351
|
+
markdown: pluginMarkdown
|
|
10244
10352
|
}
|
|
10245
10353
|
},
|
|
10246
10354
|
{
|
|
@@ -10295,7 +10403,7 @@ var comments = async () => [
|
|
|
10295
10403
|
name: "jsse:eslint-comments",
|
|
10296
10404
|
plugins: {
|
|
10297
10405
|
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
|
|
10298
|
-
"eslint-comments":
|
|
10406
|
+
"eslint-comments": default7
|
|
10299
10407
|
},
|
|
10300
10408
|
rules: {
|
|
10301
10409
|
"eslint-comments/no-aggregating-enable": "error",
|
|
@@ -10320,7 +10428,7 @@ var imports = async (options) => {
|
|
|
10320
10428
|
const { stylistic: stylistic2 = true } = options ?? {};
|
|
10321
10429
|
return [
|
|
10322
10430
|
{
|
|
10323
|
-
name: "jsse:
|
|
10431
|
+
name: "jsse:import",
|
|
10324
10432
|
plugins: {
|
|
10325
10433
|
import: pluginImport
|
|
10326
10434
|
},
|
|
@@ -10379,7 +10487,7 @@ var javascript = async (options) => {
|
|
|
10379
10487
|
name: "jsse:javascript",
|
|
10380
10488
|
plugins: {
|
|
10381
10489
|
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
|
|
10382
|
-
"unused-imports":
|
|
10490
|
+
"unused-imports": default5
|
|
10383
10491
|
},
|
|
10384
10492
|
rules: {
|
|
10385
10493
|
...eslintjs.configs.recommended.rules,
|
|
@@ -10606,11 +10714,12 @@ var javascript = async (options) => {
|
|
|
10606
10714
|
|
|
10607
10715
|
// src/configs/jsdoc.ts
|
|
10608
10716
|
var jsdoc = async () => {
|
|
10717
|
+
const { pluginJsdoc } = await importPluginJsdoc();
|
|
10609
10718
|
return [
|
|
10610
10719
|
{
|
|
10611
10720
|
name: "jsse:jsdoc",
|
|
10612
10721
|
plugins: {
|
|
10613
|
-
jsdoc:
|
|
10722
|
+
jsdoc: pluginJsdoc
|
|
10614
10723
|
},
|
|
10615
10724
|
rules: {
|
|
10616
10725
|
"jsdoc/check-access": "warn",
|
|
@@ -10639,6 +10748,7 @@ var jsdoc = async () => {
|
|
|
10639
10748
|
var jsonc = async (options) => {
|
|
10640
10749
|
const { overrides = {}, stylistic: stylistic2 = true } = options ?? {};
|
|
10641
10750
|
const { indent = 2 } = typeof stylistic2 === "boolean" ? {} : stylistic2;
|
|
10751
|
+
const { parserJsonc, pluginJsonc } = await importJsoncLibs();
|
|
10642
10752
|
return [
|
|
10643
10753
|
{
|
|
10644
10754
|
name: "jsse:jsonc:setup",
|
|
@@ -10650,7 +10760,7 @@ var jsonc = async (options) => {
|
|
|
10650
10760
|
{
|
|
10651
10761
|
files: [GLOB_JSON, GLOB_JSON5, GLOB_JSONC],
|
|
10652
10762
|
languageOptions: {
|
|
10653
|
-
parser:
|
|
10763
|
+
parser: parserJsonc
|
|
10654
10764
|
},
|
|
10655
10765
|
name: "jsse:jsonc:rules",
|
|
10656
10766
|
rules: {
|
|
@@ -10714,7 +10824,7 @@ var n = async () => {
|
|
|
10714
10824
|
name: "jsse:n",
|
|
10715
10825
|
plugins: {
|
|
10716
10826
|
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
|
|
10717
|
-
n:
|
|
10827
|
+
n: default3
|
|
10718
10828
|
},
|
|
10719
10829
|
rules: {
|
|
10720
10830
|
"n/handle-callback-err": ["error", "^(err|error)$"],
|
|
@@ -10737,7 +10847,7 @@ var perfectionist = async () => {
|
|
|
10737
10847
|
name: "jsse:perfectionist",
|
|
10738
10848
|
plugins: {
|
|
10739
10849
|
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
|
|
10740
|
-
perfectionist:
|
|
10850
|
+
perfectionist: default6
|
|
10741
10851
|
}
|
|
10742
10852
|
}
|
|
10743
10853
|
];
|
|
@@ -10868,7 +10978,7 @@ var prettier = async () => {
|
|
|
10868
10978
|
};
|
|
10869
10979
|
|
|
10870
10980
|
// src/configs/ts/typescript-language-options.ts
|
|
10871
|
-
import
|
|
10981
|
+
import process4 from "process";
|
|
10872
10982
|
function typescriptLanguageOptions(options) {
|
|
10873
10983
|
const {
|
|
10874
10984
|
componentExts = [],
|
|
@@ -10878,7 +10988,7 @@ function typescriptLanguageOptions(options) {
|
|
|
10878
10988
|
} = options || {};
|
|
10879
10989
|
const tsOptions = tsconfig ? {
|
|
10880
10990
|
project: Array.isArray(tsconfig) ? tsconfig : [tsconfig],
|
|
10881
|
-
tsconfigRootDir:
|
|
10991
|
+
tsconfigRootDir: process4.cwd()
|
|
10882
10992
|
} : {};
|
|
10883
10993
|
const parserOptions = {
|
|
10884
10994
|
ecmaFeatures: react2 ? { jsx: true, modules: true } : void 0,
|
|
@@ -11064,20 +11174,18 @@ function reactRules() {
|
|
|
11064
11174
|
"react/void-dom-elements-no-children": "error"
|
|
11065
11175
|
};
|
|
11066
11176
|
}
|
|
11067
|
-
function
|
|
11177
|
+
function reactRefreshFlatConfigRules() {
|
|
11068
11178
|
return [
|
|
11069
11179
|
{
|
|
11070
11180
|
files: [GLOB_SRC],
|
|
11071
|
-
|
|
11072
|
-
plugins: { "react-refresh": pluginReactRefresh },
|
|
11181
|
+
name: "jsse:react:refresh",
|
|
11073
11182
|
rules: {
|
|
11074
11183
|
"react-refresh/only-export-components": "error"
|
|
11075
11184
|
}
|
|
11076
11185
|
},
|
|
11077
11186
|
{
|
|
11078
11187
|
files: ["**/*.stories.tsx"],
|
|
11079
|
-
|
|
11080
|
-
plugins: { "react-refresh": pluginReactRefresh },
|
|
11188
|
+
name: "jsse:react:refresh:stories",
|
|
11081
11189
|
rules: {
|
|
11082
11190
|
"react-refresh/only-export-components": "off"
|
|
11083
11191
|
}
|
|
@@ -11119,6 +11227,8 @@ var react = async (options) => {
|
|
|
11119
11227
|
reactRefresh,
|
|
11120
11228
|
tsconfig
|
|
11121
11229
|
} = options ?? {};
|
|
11230
|
+
const reactPlugins = await importReactPlugins();
|
|
11231
|
+
const { pluginReact, pluginReactHooks, pluginReactRefresh } = reactPlugins;
|
|
11122
11232
|
const config = [
|
|
11123
11233
|
{
|
|
11124
11234
|
files: [GLOB_SRC],
|
|
@@ -11131,9 +11241,11 @@ var react = async (options) => {
|
|
|
11131
11241
|
name: "jsse:react:setup",
|
|
11132
11242
|
plugins: {
|
|
11133
11243
|
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
|
|
11134
|
-
react:
|
|
11244
|
+
react: pluginReact,
|
|
11245
|
+
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
|
|
11246
|
+
"react-hooks": pluginReactHooks,
|
|
11135
11247
|
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
|
|
11136
|
-
"react-
|
|
11248
|
+
"react-refresh": pluginReactRefresh
|
|
11137
11249
|
}
|
|
11138
11250
|
},
|
|
11139
11251
|
{
|
|
@@ -11142,7 +11254,7 @@ var react = async (options) => {
|
|
|
11142
11254
|
rules: {
|
|
11143
11255
|
...reactRecomendedRules(),
|
|
11144
11256
|
// eslint-disable-next-line @typescript-eslint/no-unsafe-member-access
|
|
11145
|
-
...
|
|
11257
|
+
...pluginReact.configs["jsx-runtime"].rules,
|
|
11146
11258
|
...reactRules()
|
|
11147
11259
|
},
|
|
11148
11260
|
settings: {
|
|
@@ -11153,7 +11265,7 @@ var react = async (options) => {
|
|
|
11153
11265
|
}
|
|
11154
11266
|
];
|
|
11155
11267
|
if (reactRefresh) {
|
|
11156
|
-
config.push(...
|
|
11268
|
+
config.push(...reactRefreshFlatConfigRules());
|
|
11157
11269
|
}
|
|
11158
11270
|
return config;
|
|
11159
11271
|
};
|
|
@@ -11177,12 +11289,13 @@ function jsxStylistic({
|
|
|
11177
11289
|
}
|
|
11178
11290
|
var stylistic = async (options) => {
|
|
11179
11291
|
const { indent = 2, jsx = true, quotes = "double" } = options ?? {};
|
|
11292
|
+
const { pluginStylistic } = await importPluginStylistic();
|
|
11180
11293
|
return [
|
|
11181
11294
|
{
|
|
11182
11295
|
name: "jsse:stylistic",
|
|
11183
11296
|
plugins: {
|
|
11184
11297
|
// eslint-disable-next-line @typescript-eslint/naming-convention
|
|
11185
|
-
"@stylistic":
|
|
11298
|
+
"@stylistic": pluginStylistic
|
|
11186
11299
|
},
|
|
11187
11300
|
rules: {
|
|
11188
11301
|
"@stylistic/quote-props": ["error", "as-needed"],
|
|
@@ -11198,18 +11311,44 @@ var stylistic = async (options) => {
|
|
|
11198
11311
|
};
|
|
11199
11312
|
|
|
11200
11313
|
// src/configs/tailwind.ts
|
|
11201
|
-
var
|
|
11314
|
+
var TAILWIND_ESLINT_SETTINGS_DEFAULT = {
|
|
11315
|
+
// These are the default values but feel free to customize
|
|
11316
|
+
callees: ["classnames", "clsx", "ctl", "cn", "cx", "twMerge", "twJoin"],
|
|
11317
|
+
classRegex: "^class(Name)?$",
|
|
11318
|
+
// can be modified to support custom attributes. E.g. "^tw$" for `twin.macro`
|
|
11319
|
+
config: "tailwind.config.js",
|
|
11320
|
+
// returned from `loadConfig()` utility if not provided
|
|
11321
|
+
cssFiles: ["**/*.css", "!**/node_modules", "!**/.*", "!**/dist", "!**/build"],
|
|
11322
|
+
cssFilesRefreshRate: 5e3,
|
|
11323
|
+
removeDuplicates: true,
|
|
11324
|
+
skipClassAttribute: false,
|
|
11325
|
+
tags: [],
|
|
11326
|
+
// can be set to e.g. ['tw'] for use in tw`bg-blue`
|
|
11327
|
+
whitelist: []
|
|
11328
|
+
};
|
|
11329
|
+
function tailwindSettings(options) {
|
|
11330
|
+
if (typeof options === "boolean") {
|
|
11331
|
+
return TAILWIND_ESLINT_SETTINGS_DEFAULT;
|
|
11332
|
+
}
|
|
11333
|
+
return { ...TAILWIND_ESLINT_SETTINGS_DEFAULT, ...options };
|
|
11334
|
+
}
|
|
11335
|
+
var tailwind = async (options) => {
|
|
11336
|
+
const { pluginTailwind } = await importPluginTailwind();
|
|
11202
11337
|
return [
|
|
11203
11338
|
{
|
|
11204
|
-
|
|
11339
|
+
files: [GLOB_SRC],
|
|
11340
|
+
name: "jsse:tailwind:rules",
|
|
11205
11341
|
plugins: {
|
|
11206
11342
|
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
|
|
11207
|
-
tailwindcss:
|
|
11343
|
+
tailwindcss: pluginTailwind
|
|
11208
11344
|
},
|
|
11209
11345
|
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
|
|
11210
11346
|
rules: {
|
|
11211
11347
|
// eslint-disable-next-line @typescript-eslint/no-unsafe-member-access
|
|
11212
|
-
...
|
|
11348
|
+
...pluginTailwind.configs.recommended.rules
|
|
11349
|
+
},
|
|
11350
|
+
settings: {
|
|
11351
|
+
tailwindcss: tailwindSettings(options)
|
|
11213
11352
|
}
|
|
11214
11353
|
}
|
|
11215
11354
|
];
|
|
@@ -11220,7 +11359,7 @@ var sortPackageJson = async () => {
|
|
|
11220
11359
|
return [
|
|
11221
11360
|
{
|
|
11222
11361
|
files: ["**/package.json"],
|
|
11223
|
-
name: "jsse:sort
|
|
11362
|
+
name: "jsse:sort:package-json",
|
|
11224
11363
|
rules: {
|
|
11225
11364
|
"jsonc/sort-array-values": [
|
|
11226
11365
|
"error",
|
|
@@ -11304,7 +11443,7 @@ var sortTsconfig = async () => {
|
|
|
11304
11443
|
return [
|
|
11305
11444
|
{
|
|
11306
11445
|
files: ["**/tsconfig.json", "**/tsconfig.*.json"],
|
|
11307
|
-
name: "jsse:sort
|
|
11446
|
+
name: "jsse:sort:tsconfig",
|
|
11308
11447
|
rules: {
|
|
11309
11448
|
"jsonc/sort-keys": [
|
|
11310
11449
|
"error",
|
|
@@ -11426,52 +11565,21 @@ var sortTsconfig = async () => {
|
|
|
11426
11565
|
];
|
|
11427
11566
|
};
|
|
11428
11567
|
|
|
11429
|
-
// src/utils.ts
|
|
11430
|
-
import process4 from "process";
|
|
11431
|
-
async function combine(...configs) {
|
|
11432
|
-
const resolved = await Promise.all(configs);
|
|
11433
|
-
return resolved.flat();
|
|
11434
|
-
}
|
|
11435
|
-
async function combineAsync(...configs) {
|
|
11436
|
-
const resolved = await Promise.all(configs);
|
|
11437
|
-
return resolved.flatMap(
|
|
11438
|
-
(config) => Array.isArray(config) ? config : [config]
|
|
11439
|
-
);
|
|
11440
|
-
}
|
|
11441
|
-
function renameRules(rules, from, to) {
|
|
11442
|
-
if (from === to) {
|
|
11443
|
-
return rules;
|
|
11444
|
-
}
|
|
11445
|
-
return Object.fromEntries(
|
|
11446
|
-
Object.entries(rules).map(([key, value]) => {
|
|
11447
|
-
if (key.startsWith(from)) {
|
|
11448
|
-
return [to + key.slice(from.length), value];
|
|
11449
|
-
}
|
|
11450
|
-
return [key, value];
|
|
11451
|
-
})
|
|
11452
|
-
);
|
|
11453
|
-
}
|
|
11454
|
-
async function interopDefault2(m) {
|
|
11455
|
-
const resolved = await m;
|
|
11456
|
-
return resolved.default || resolved;
|
|
11457
|
-
}
|
|
11458
|
-
function isCI() {
|
|
11459
|
-
return !!process4.env.CI;
|
|
11460
|
-
}
|
|
11461
|
-
function isInEditor() {
|
|
11462
|
-
return !!((process4.env.VSCODE_PID || process4.env.JETBRAINS_IDE) && !isCI());
|
|
11463
|
-
}
|
|
11464
|
-
|
|
11465
11568
|
// src/configs/test.ts
|
|
11466
11569
|
var test = async (options = {}) => {
|
|
11467
11570
|
const { isInEditor: isInEditor2 = false, overrides = {} } = options;
|
|
11571
|
+
const [pluginNoOnlyTests, pluginVitest] = await Promise.all([
|
|
11572
|
+
// @ts-expect-error - types are incorrect/missing
|
|
11573
|
+
interopDefault2(import("eslint-plugin-no-only-tests")),
|
|
11574
|
+
interopDefault2(import("eslint-plugin-vitest"))
|
|
11575
|
+
]);
|
|
11468
11576
|
return [
|
|
11469
11577
|
{
|
|
11470
11578
|
name: "jsse:test:setup",
|
|
11471
11579
|
plugins: {
|
|
11472
11580
|
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
|
|
11473
|
-
"no-only-tests":
|
|
11474
|
-
vitest:
|
|
11581
|
+
"no-only-tests": pluginNoOnlyTests,
|
|
11582
|
+
vitest: pluginVitest
|
|
11475
11583
|
}
|
|
11476
11584
|
},
|
|
11477
11585
|
{
|
|
@@ -11508,9 +11616,9 @@ var typescript = async (options) => {
|
|
|
11508
11616
|
const tsPrefixTo = prefix?.to ?? "@typescript-eslint";
|
|
11509
11617
|
const tsrules = {
|
|
11510
11618
|
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
11511
|
-
...
|
|
11619
|
+
...default8.configs["eslint-recommended"].overrides[0].rules,
|
|
11512
11620
|
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
11513
|
-
...
|
|
11621
|
+
...default8.configs.strict.rules,
|
|
11514
11622
|
"no-invalid-this": "off",
|
|
11515
11623
|
...typescriptRules(
|
|
11516
11624
|
typeAware !== false && tsconfigPath ? { typeAware: true } : { typeAware: false }
|
|
@@ -11523,7 +11631,7 @@ var typescript = async (options) => {
|
|
|
11523
11631
|
name: "jsse:typescript:setup",
|
|
11524
11632
|
plugins: {
|
|
11525
11633
|
import: pluginImport,
|
|
11526
|
-
[tsPrefixTo]:
|
|
11634
|
+
[tsPrefixTo]: default8
|
|
11527
11635
|
}
|
|
11528
11636
|
},
|
|
11529
11637
|
// ...tseslint.configs.recommended,
|
|
@@ -11589,7 +11697,7 @@ function unicornOff() {
|
|
|
11589
11697
|
};
|
|
11590
11698
|
}
|
|
11591
11699
|
function unicornRecommended() {
|
|
11592
|
-
return
|
|
11700
|
+
return default4.configs.recommended.rules;
|
|
11593
11701
|
}
|
|
11594
11702
|
var unicorn = async () => {
|
|
11595
11703
|
return [
|
|
@@ -11597,7 +11705,7 @@ var unicorn = async () => {
|
|
|
11597
11705
|
name: "jsse:unicorn",
|
|
11598
11706
|
plugins: {
|
|
11599
11707
|
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
|
|
11600
|
-
unicorn:
|
|
11708
|
+
unicorn: default4
|
|
11601
11709
|
},
|
|
11602
11710
|
rules: {
|
|
11603
11711
|
...unicornRecommended(),
|
|
@@ -11908,7 +12016,15 @@ async function jsse(options = {}, ...userConfigs) {
|
|
|
11908
12016
|
);
|
|
11909
12017
|
}
|
|
11910
12018
|
if (normalizedOptions.tailwind) {
|
|
11911
|
-
|
|
12019
|
+
try {
|
|
12020
|
+
configs.push(
|
|
12021
|
+
tailwind(
|
|
12022
|
+
normalizedOptions.tailwind === true ? {} : normalizedOptions.tailwind
|
|
12023
|
+
)
|
|
12024
|
+
);
|
|
12025
|
+
} catch (e) {
|
|
12026
|
+
log.error("Tailwind config failed", e);
|
|
12027
|
+
}
|
|
11912
12028
|
}
|
|
11913
12029
|
const fusedConfig = flatConfigProps.reduce((acc, key) => {
|
|
11914
12030
|
if (key in options) {
|
|
@@ -12012,33 +12128,34 @@ export {
|
|
|
12012
12128
|
combine,
|
|
12013
12129
|
combineAsync,
|
|
12014
12130
|
jsse as default,
|
|
12131
|
+
importJsoncLibs,
|
|
12132
|
+
importParserJsonc,
|
|
12133
|
+
importPluginJsdoc,
|
|
12134
|
+
importPluginJsonc,
|
|
12135
|
+
importPluginMarkdown,
|
|
12136
|
+
importPluginReact,
|
|
12137
|
+
importPluginReactHooks,
|
|
12138
|
+
importPluginReactRefresh,
|
|
12139
|
+
importPluginStylistic,
|
|
12140
|
+
importPluginTailwind,
|
|
12141
|
+
importReactPlugins,
|
|
12142
|
+
importYmlLibs,
|
|
12015
12143
|
interopDefault2 as interopDefault,
|
|
12016
12144
|
isCI,
|
|
12017
12145
|
isInEditor,
|
|
12018
12146
|
jsse,
|
|
12019
12147
|
jsseReact,
|
|
12020
12148
|
jssestd,
|
|
12021
|
-
default17 as parserJsonc,
|
|
12022
12149
|
parserTs,
|
|
12023
|
-
|
|
12024
|
-
|
|
12150
|
+
default2 as pluginAntfu,
|
|
12151
|
+
default7 as pluginEslintComments,
|
|
12025
12152
|
pluginImport,
|
|
12026
|
-
|
|
12027
|
-
|
|
12028
|
-
default7 as pluginMarkdown,
|
|
12029
|
-
default8 as pluginN,
|
|
12030
|
-
default9 as pluginNoOnlyTests,
|
|
12031
|
-
default10 as pluginPerfectionist,
|
|
12032
|
-
default11 as pluginReact,
|
|
12033
|
-
default12 as pluginReactHooks,
|
|
12034
|
-
pluginReactRefresh,
|
|
12153
|
+
default3 as pluginN,
|
|
12154
|
+
default6 as pluginPerfectionist,
|
|
12035
12155
|
pluginSortKeys,
|
|
12036
|
-
|
|
12037
|
-
|
|
12038
|
-
|
|
12039
|
-
default14 as pluginUnicorn,
|
|
12040
|
-
default15 as pluginUnusedImports,
|
|
12041
|
-
default16 as pluginVitest,
|
|
12156
|
+
default8 as pluginTs,
|
|
12157
|
+
default4 as pluginUnicorn,
|
|
12158
|
+
default5 as pluginUnusedImports,
|
|
12042
12159
|
renameRules
|
|
12043
12160
|
};
|
|
12044
12161
|
/*! Bundled license information:
|