@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/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 "@stylistic/eslint-plugin";
9668
- import { default as default3 } from "@typescript-eslint/eslint-plugin";
9780
+ import { default as default2 } from "eslint-plugin-antfu";
9781
+ import * as pluginImport from "eslint-plugin-import-x";
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";
9669
9788
  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";
9672
- import * as pluginImport from "eslint-plugin-i";
9673
- import { default as default6 } from "eslint-plugin-jsdoc";
9674
- import * as pluginJsonc from "eslint-plugin-jsonc";
9675
- import { default as default7 } from "eslint-plugin-markdown";
9676
- import { default as default8 } from "eslint-plugin-n";
9677
- import { default as default9 } from "eslint-plugin-no-only-tests";
9678
- import { default as default10 } from "eslint-plugin-perfectionist";
9679
- import { default as default11 } from "eslint-plugin-react";
9680
- import { default as default12 } from "eslint-plugin-react-hooks";
9681
- import * as pluginReactRefresh from "eslint-plugin-react-refresh";
9682
- import { default as default13 } from "eslint-plugin-tailwindcss";
9683
- import { default as default14 } from "eslint-plugin-unicorn";
9684
- import { default as default15 } from "eslint-plugin-unused-imports";
9685
- import { default as default16 } from "eslint-plugin-vitest";
9686
- import { default as default17 } from "jsonc-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: default4
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:bin",
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: default7
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": default5
10406
+ "eslint-comments": default7
10299
10407
  },
10300
10408
  rules: {
10301
10409
  "eslint-comments/no-aggregating-enable": "error",
@@ -10320,9 +10428,8 @@ var imports = async (options) => {
10320
10428
  const { stylistic: stylistic2 = true } = options ?? {};
10321
10429
  return [
10322
10430
  {
10323
- name: "jsse:imports",
10431
+ name: "jsse:import",
10324
10432
  plugins: {
10325
- // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
10326
10433
  import: pluginImport
10327
10434
  },
10328
10435
  rules: {
@@ -10380,7 +10487,7 @@ var javascript = async (options) => {
10380
10487
  name: "jsse:javascript",
10381
10488
  plugins: {
10382
10489
  // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
10383
- "unused-imports": default15
10490
+ "unused-imports": default5
10384
10491
  },
10385
10492
  rules: {
10386
10493
  ...eslintjs.configs.recommended.rules,
@@ -10607,11 +10714,12 @@ var javascript = async (options) => {
10607
10714
 
10608
10715
  // src/configs/jsdoc.ts
10609
10716
  var jsdoc = async () => {
10717
+ const { pluginJsdoc } = await importPluginJsdoc();
10610
10718
  return [
10611
10719
  {
10612
10720
  name: "jsse:jsdoc",
10613
10721
  plugins: {
10614
- jsdoc: default6
10722
+ jsdoc: pluginJsdoc
10615
10723
  },
10616
10724
  rules: {
10617
10725
  "jsdoc/check-access": "warn",
@@ -10640,6 +10748,7 @@ var jsdoc = async () => {
10640
10748
  var jsonc = async (options) => {
10641
10749
  const { overrides = {}, stylistic: stylistic2 = true } = options ?? {};
10642
10750
  const { indent = 2 } = typeof stylistic2 === "boolean" ? {} : stylistic2;
10751
+ const { parserJsonc, pluginJsonc } = await importJsoncLibs();
10643
10752
  return [
10644
10753
  {
10645
10754
  name: "jsse:jsonc:setup",
@@ -10651,7 +10760,7 @@ var jsonc = async (options) => {
10651
10760
  {
10652
10761
  files: [GLOB_JSON, GLOB_JSON5, GLOB_JSONC],
10653
10762
  languageOptions: {
10654
- parser: default17
10763
+ parser: parserJsonc
10655
10764
  },
10656
10765
  name: "jsse:jsonc:rules",
10657
10766
  rules: {
@@ -10715,7 +10824,7 @@ var n = async () => {
10715
10824
  name: "jsse:n",
10716
10825
  plugins: {
10717
10826
  // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
10718
- n: default8
10827
+ n: default3
10719
10828
  },
10720
10829
  rules: {
10721
10830
  "n/handle-callback-err": ["error", "^(err|error)$"],
@@ -10738,7 +10847,7 @@ var perfectionist = async () => {
10738
10847
  name: "jsse:perfectionist",
10739
10848
  plugins: {
10740
10849
  // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
10741
- perfectionist: default10
10850
+ perfectionist: default6
10742
10851
  }
10743
10852
  }
10744
10853
  ];
@@ -10869,7 +10978,7 @@ var prettier = async () => {
10869
10978
  };
10870
10979
 
10871
10980
  // src/configs/ts/typescript-language-options.ts
10872
- import process3 from "process";
10981
+ import process4 from "process";
10873
10982
  function typescriptLanguageOptions(options) {
10874
10983
  const {
10875
10984
  componentExts = [],
@@ -10879,7 +10988,7 @@ function typescriptLanguageOptions(options) {
10879
10988
  } = options || {};
10880
10989
  const tsOptions = tsconfig ? {
10881
10990
  project: Array.isArray(tsconfig) ? tsconfig : [tsconfig],
10882
- tsconfigRootDir: process3.cwd()
10991
+ tsconfigRootDir: process4.cwd()
10883
10992
  } : {};
10884
10993
  const parserOptions = {
10885
10994
  ecmaFeatures: react2 ? { jsx: true, modules: true } : void 0,
@@ -11065,20 +11174,18 @@ function reactRules() {
11065
11174
  "react/void-dom-elements-no-children": "error"
11066
11175
  };
11067
11176
  }
11068
- function reactRefreshFlatConfigs() {
11177
+ function reactRefreshFlatConfigRules() {
11069
11178
  return [
11070
11179
  {
11071
11180
  files: [GLOB_SRC],
11072
- // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
11073
- plugins: { "react-refresh": pluginReactRefresh },
11181
+ name: "jsse:react:refresh",
11074
11182
  rules: {
11075
11183
  "react-refresh/only-export-components": "error"
11076
11184
  }
11077
11185
  },
11078
11186
  {
11079
11187
  files: ["**/*.stories.tsx"],
11080
- // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
11081
- plugins: { "react-refresh": pluginReactRefresh },
11188
+ name: "jsse:react:refresh:stories",
11082
11189
  rules: {
11083
11190
  "react-refresh/only-export-components": "off"
11084
11191
  }
@@ -11120,6 +11227,8 @@ var react = async (options) => {
11120
11227
  reactRefresh,
11121
11228
  tsconfig
11122
11229
  } = options ?? {};
11230
+ const reactPlugins = await importReactPlugins();
11231
+ const { pluginReact, pluginReactHooks, pluginReactRefresh } = reactPlugins;
11123
11232
  const config = [
11124
11233
  {
11125
11234
  files: [GLOB_SRC],
@@ -11132,9 +11241,11 @@ var react = async (options) => {
11132
11241
  name: "jsse:react:setup",
11133
11242
  plugins: {
11134
11243
  // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
11135
- react: default11,
11244
+ react: pluginReact,
11136
11245
  // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
11137
- "react-hooks": default12
11246
+ "react-hooks": pluginReactHooks,
11247
+ // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
11248
+ "react-refresh": pluginReactRefresh
11138
11249
  }
11139
11250
  },
11140
11251
  {
@@ -11143,7 +11254,7 @@ var react = async (options) => {
11143
11254
  rules: {
11144
11255
  ...reactRecomendedRules(),
11145
11256
  // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access
11146
- ...default11.configs["jsx-runtime"].rules,
11257
+ ...pluginReact.configs["jsx-runtime"].rules,
11147
11258
  ...reactRules()
11148
11259
  },
11149
11260
  settings: {
@@ -11154,7 +11265,7 @@ var react = async (options) => {
11154
11265
  }
11155
11266
  ];
11156
11267
  if (reactRefresh) {
11157
- config.push(...reactRefreshFlatConfigs());
11268
+ config.push(...reactRefreshFlatConfigRules());
11158
11269
  }
11159
11270
  return config;
11160
11271
  };
@@ -11178,12 +11289,13 @@ function jsxStylistic({
11178
11289
  }
11179
11290
  var stylistic = async (options) => {
11180
11291
  const { indent = 2, jsx = true, quotes = "double" } = options ?? {};
11292
+ const { pluginStylistic } = await importPluginStylistic();
11181
11293
  return [
11182
11294
  {
11183
11295
  name: "jsse:stylistic",
11184
11296
  plugins: {
11185
11297
  // eslint-disable-next-line @typescript-eslint/naming-convention
11186
- "@stylistic": default2
11298
+ "@stylistic": pluginStylistic
11187
11299
  },
11188
11300
  rules: {
11189
11301
  "@stylistic/quote-props": ["error", "as-needed"],
@@ -11199,18 +11311,44 @@ var stylistic = async (options) => {
11199
11311
  };
11200
11312
 
11201
11313
  // src/configs/tailwind.ts
11202
- var tailwind = async () => {
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();
11203
11337
  return [
11204
11338
  {
11205
- name: "jsse:tailwind",
11339
+ files: [GLOB_SRC],
11340
+ name: "jsse:tailwind:rules",
11206
11341
  plugins: {
11207
11342
  // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
11208
- tailwindcss: default13
11343
+ tailwindcss: pluginTailwind
11209
11344
  },
11210
11345
  // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
11211
11346
  rules: {
11212
11347
  // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access
11213
- ...default13.configs.recommended.rules
11348
+ ...pluginTailwind.configs.recommended.rules
11349
+ },
11350
+ settings: {
11351
+ tailwindcss: tailwindSettings(options)
11214
11352
  }
11215
11353
  }
11216
11354
  ];
@@ -11221,7 +11359,7 @@ var sortPackageJson = async () => {
11221
11359
  return [
11222
11360
  {
11223
11361
  files: ["**/package.json"],
11224
- name: "jsse:sort-package-json",
11362
+ name: "jsse:sort:package-json",
11225
11363
  rules: {
11226
11364
  "jsonc/sort-array-values": [
11227
11365
  "error",
@@ -11305,7 +11443,7 @@ var sortTsconfig = async () => {
11305
11443
  return [
11306
11444
  {
11307
11445
  files: ["**/tsconfig.json", "**/tsconfig.*.json"],
11308
- name: "jsse:sort-tsconfig",
11446
+ name: "jsse:sort:tsconfig",
11309
11447
  rules: {
11310
11448
  "jsonc/sort-keys": [
11311
11449
  "error",
@@ -11427,52 +11565,21 @@ var sortTsconfig = async () => {
11427
11565
  ];
11428
11566
  };
11429
11567
 
11430
- // src/utils.ts
11431
- import process4 from "process";
11432
- async function combine(...configs) {
11433
- const resolved = await Promise.all(configs);
11434
- return resolved.flat();
11435
- }
11436
- async function combineAsync(...configs) {
11437
- const resolved = await Promise.all(configs);
11438
- return resolved.flatMap(
11439
- (config) => Array.isArray(config) ? config : [config]
11440
- );
11441
- }
11442
- function renameRules(rules, from, to) {
11443
- if (from === to) {
11444
- return rules;
11445
- }
11446
- return Object.fromEntries(
11447
- Object.entries(rules).map(([key, value]) => {
11448
- if (key.startsWith(from)) {
11449
- return [to + key.slice(from.length), value];
11450
- }
11451
- return [key, value];
11452
- })
11453
- );
11454
- }
11455
- async function interopDefault2(m) {
11456
- const resolved = await m;
11457
- return resolved.default || resolved;
11458
- }
11459
- function isCI() {
11460
- return !!process4.env.CI;
11461
- }
11462
- function isInEditor() {
11463
- return !!((process4.env.VSCODE_PID || process4.env.JETBRAINS_IDE) && !isCI());
11464
- }
11465
-
11466
11568
  // src/configs/test.ts
11467
11569
  var test = async (options = {}) => {
11468
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
+ ]);
11469
11576
  return [
11470
11577
  {
11471
11578
  name: "jsse:test:setup",
11472
11579
  plugins: {
11473
11580
  // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
11474
- "no-only-tests": default9,
11475
- vitest: default16
11581
+ "no-only-tests": pluginNoOnlyTests,
11582
+ vitest: pluginVitest
11476
11583
  }
11477
11584
  },
11478
11585
  {
@@ -11509,9 +11616,9 @@ var typescript = async (options) => {
11509
11616
  const tsPrefixTo = prefix?.to ?? "@typescript-eslint";
11510
11617
  const tsrules = {
11511
11618
  // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
11512
- ...default3.configs["eslint-recommended"].overrides[0].rules,
11619
+ ...default8.configs["eslint-recommended"].overrides[0].rules,
11513
11620
  // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
11514
- ...default3.configs.strict.rules,
11621
+ ...default8.configs.strict.rules,
11515
11622
  "no-invalid-this": "off",
11516
11623
  ...typescriptRules(
11517
11624
  typeAware !== false && tsconfigPath ? { typeAware: true } : { typeAware: false }
@@ -11523,9 +11630,8 @@ var typescript = async (options) => {
11523
11630
  // Install the plugins without globs, so they can be configured separately.
11524
11631
  name: "jsse:typescript:setup",
11525
11632
  plugins: {
11526
- // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
11527
11633
  import: pluginImport,
11528
- [tsPrefixTo]: default3
11634
+ [tsPrefixTo]: default8
11529
11635
  }
11530
11636
  },
11531
11637
  // ...tseslint.configs.recommended,
@@ -11591,7 +11697,7 @@ function unicornOff() {
11591
11697
  };
11592
11698
  }
11593
11699
  function unicornRecommended() {
11594
- return default14.configs.recommended.rules;
11700
+ return default4.configs.recommended.rules;
11595
11701
  }
11596
11702
  var unicorn = async () => {
11597
11703
  return [
@@ -11599,7 +11705,7 @@ var unicorn = async () => {
11599
11705
  name: "jsse:unicorn",
11600
11706
  plugins: {
11601
11707
  // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
11602
- unicorn: default14
11708
+ unicorn: default4
11603
11709
  },
11604
11710
  rules: {
11605
11711
  ...unicornRecommended(),
@@ -11910,7 +12016,15 @@ async function jsse(options = {}, ...userConfigs) {
11910
12016
  );
11911
12017
  }
11912
12018
  if (normalizedOptions.tailwind) {
11913
- configs.push(tailwind());
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
+ }
11914
12028
  }
11915
12029
  const fusedConfig = flatConfigProps.reduce((acc, key) => {
11916
12030
  if (key in options) {
@@ -12014,33 +12128,34 @@ export {
12014
12128
  combine,
12015
12129
  combineAsync,
12016
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,
12017
12143
  interopDefault2 as interopDefault,
12018
12144
  isCI,
12019
12145
  isInEditor,
12020
12146
  jsse,
12021
12147
  jsseReact,
12022
12148
  jssestd,
12023
- default17 as parserJsonc,
12024
12149
  parserTs,
12025
- default4 as pluginAntfu,
12026
- default5 as pluginEslintComments,
12150
+ default2 as pluginAntfu,
12151
+ default7 as pluginEslintComments,
12027
12152
  pluginImport,
12028
- default6 as pluginJsdoc,
12029
- pluginJsonc,
12030
- default7 as pluginMarkdown,
12031
- default8 as pluginN,
12032
- default9 as pluginNoOnlyTests,
12033
- default10 as pluginPerfectionist,
12034
- default11 as pluginReact,
12035
- default12 as pluginReactHooks,
12036
- pluginReactRefresh,
12153
+ default3 as pluginN,
12154
+ default6 as pluginPerfectionist,
12037
12155
  pluginSortKeys,
12038
- default2 as pluginStylistic,
12039
- default13 as pluginTailwind,
12040
- default3 as pluginTs,
12041
- default14 as pluginUnicorn,
12042
- default15 as pluginUnusedImports,
12043
- default16 as pluginVitest,
12156
+ default8 as pluginTs,
12157
+ default4 as pluginUnicorn,
12158
+ default5 as pluginUnusedImports,
12044
12159
  renameRules
12045
12160
  };
12046
12161
  /*! Bundled license information: