@jsse/eslint-config 0.3.7 → 0.4.0

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.
Files changed (44) hide show
  1. package/CHANGELOG.md +10 -0
  2. package/dist/cli.js +3 -3
  3. package/dist/esm/config-fns.d.ts +109 -34
  4. package/dist/esm/config-fns.js +111 -35
  5. package/dist/esm/configs/{comments.d.ts → de-morgan.d.ts} +1 -1
  6. package/dist/esm/configs/de-morgan.js +9 -0
  7. package/dist/esm/configs/eslint-comments.d.ts +2 -0
  8. package/dist/esm/configs/{comments.js → eslint-comments.js} +1 -1
  9. package/dist/esm/configs/gql.d.ts +2 -2
  10. package/dist/esm/configs/markdown.js +1 -1
  11. package/dist/esm/configs/prettier.d.ts +2 -2
  12. package/dist/esm/configs/react.d.ts +3 -3
  13. package/dist/esm/configs/stylistic.js +1 -1
  14. package/dist/esm/configs/ts/parser.d.ts +2 -2
  15. package/dist/esm/configs/ts/parser.js +7 -5
  16. package/dist/esm/configs/ts/typescript-rules.d.ts +9 -4
  17. package/dist/esm/configs/ts/typescript-rules.js +26 -62
  18. package/dist/esm/configs/ts/typescript.js +56 -43
  19. package/dist/esm/define-config.d.ts +3 -3
  20. package/dist/esm/define-config.js +38 -28
  21. package/dist/esm/fixable.d.ts +2 -1
  22. package/dist/esm/fixable.js +3 -395
  23. package/dist/esm/generated/fixable-rules-map.d.ts +2 -0
  24. package/dist/esm/generated/fixable-rules-map.js +436 -0
  25. package/dist/esm/generated/version.d.ts +1 -1
  26. package/dist/esm/generated/version.js +1 -1
  27. package/dist/esm/index.d.ts +1 -1
  28. package/dist/esm/index.js +0 -1
  29. package/dist/esm/lager.d.ts +1 -1
  30. package/dist/esm/lager.js +1 -1
  31. package/dist/esm/plugins-all.d.ts +11 -8
  32. package/dist/esm/plugins-all.js +99 -10
  33. package/dist/esm/plugins.d.ts +1 -0
  34. package/dist/esm/plugins.js +4 -1
  35. package/dist/esm/presets.d.ts +16 -0
  36. package/dist/esm/presets.js +96 -1
  37. package/dist/esm/types.d.ts +34 -22
  38. package/dist/esm/utils.d.ts +5 -5
  39. package/dist/esm/utils.js +1 -1
  40. package/dist/index.d.ts +7404 -6303
  41. package/dist/index.js +289 -227
  42. package/package.json +20 -27
  43. package/dist/esm/plugindex.d.ts +0 -7
  44. package/dist/esm/plugindex.js +0 -60
package/dist/index.js CHANGED
@@ -4,7 +4,13 @@ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
4
  var __getOwnPropNames = Object.getOwnPropertyNames;
5
5
  var __getProtoOf = Object.getPrototypeOf;
6
6
  var __hasOwnProp = Object.prototype.hasOwnProperty;
7
- var __commonJS = (cb, mod) => function __require() {
7
+ var __require = /* @__PURE__ */ ((x) => typeof require !== "undefined" ? require : typeof Proxy !== "undefined" ? new Proxy(x, {
8
+ get: (a, b) => (typeof require !== "undefined" ? require : a)[b]
9
+ }) : x)(function(x) {
10
+ if (typeof require !== "undefined") return require.apply(this, arguments);
11
+ throw Error('Dynamic require of "' + x + '" is not supported');
12
+ });
13
+ var __commonJS = (cb, mod) => function __require2() {
8
14
  return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
9
15
  };
10
16
  var __export = (target, all) => {
@@ -28,6 +34,93 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
28
34
  mod
29
35
  ));
30
36
 
37
+ // node_modules/.pnpm/eslint-plugin-tailwindcss@3.18.0_tailwindcss@3.4.17/node_modules/eslint-plugin-tailwindcss/lib/config/rules.js
38
+ var require_rules = __commonJS({
39
+ "node_modules/.pnpm/eslint-plugin-tailwindcss@3.18.0_tailwindcss@3.4.17/node_modules/eslint-plugin-tailwindcss/lib/config/rules.js"(exports, module) {
40
+ "use strict";
41
+ module.exports = {
42
+ "tailwindcss/classnames-order": "warn",
43
+ "tailwindcss/enforces-negative-arbitrary-values": "warn",
44
+ "tailwindcss/enforces-shorthand": "warn",
45
+ "tailwindcss/migration-from-tailwind-2": "warn",
46
+ "tailwindcss/no-arbitrary-value": "off",
47
+ "tailwindcss/no-custom-classname": "warn",
48
+ "tailwindcss/no-contradicting-classname": "error",
49
+ "tailwindcss/no-unnecessary-arbitrary-value": "warn"
50
+ };
51
+ }
52
+ });
53
+
54
+ // node_modules/.pnpm/eslint-plugin-tailwindcss@3.18.0_tailwindcss@3.4.17/node_modules/eslint-plugin-tailwindcss/lib/config/recommended.js
55
+ var require_recommended = __commonJS({
56
+ "node_modules/.pnpm/eslint-plugin-tailwindcss@3.18.0_tailwindcss@3.4.17/node_modules/eslint-plugin-tailwindcss/lib/config/recommended.js"(exports, module) {
57
+ "use strict";
58
+ var rules = require_rules();
59
+ module.exports = {
60
+ plugins: ["tailwindcss"],
61
+ parserOptions: {
62
+ ecmaFeatures: {
63
+ jsx: true
64
+ }
65
+ },
66
+ rules
67
+ };
68
+ }
69
+ });
70
+
71
+ // node_modules/.pnpm/eslint-plugin-tailwindcss@3.18.0_tailwindcss@3.4.17/node_modules/eslint-plugin-tailwindcss/lib/config/flat-recommended.js
72
+ var require_flat_recommended = __commonJS({
73
+ "node_modules/.pnpm/eslint-plugin-tailwindcss@3.18.0_tailwindcss@3.4.17/node_modules/eslint-plugin-tailwindcss/lib/config/flat-recommended.js"(exports, module) {
74
+ "use strict";
75
+ var rules = require_rules();
76
+ module.exports = [
77
+ {
78
+ name: "tailwindcss:base",
79
+ plugins: {
80
+ get tailwindcss() {
81
+ return require_lib();
82
+ }
83
+ },
84
+ languageOptions: {
85
+ parserOptions: {
86
+ ecmaFeatures: {
87
+ jsx: true
88
+ }
89
+ }
90
+ }
91
+ },
92
+ {
93
+ name: "tailwindcss:rules",
94
+ rules
95
+ }
96
+ ];
97
+ }
98
+ });
99
+
100
+ // node_modules/.pnpm/eslint-plugin-tailwindcss@3.18.0_tailwindcss@3.4.17/node_modules/eslint-plugin-tailwindcss/lib/index.js
101
+ var require_lib = __commonJS({
102
+ "node_modules/.pnpm/eslint-plugin-tailwindcss@3.18.0_tailwindcss@3.4.17/node_modules/eslint-plugin-tailwindcss/lib/index.js"(exports, module) {
103
+ "use strict";
104
+ var base = __dirname + "/rules/";
105
+ module.exports = {
106
+ rules: {
107
+ "classnames-order": __require(base + "classnames-order"),
108
+ "enforces-negative-arbitrary-values": __require(base + "enforces-negative-arbitrary-values"),
109
+ "enforces-shorthand": __require(base + "enforces-shorthand"),
110
+ "migration-from-tailwind-2": __require(base + "migration-from-tailwind-2"),
111
+ "no-arbitrary-value": __require(base + "no-arbitrary-value"),
112
+ "no-contradicting-classname": __require(base + "no-contradicting-classname"),
113
+ "no-custom-classname": __require(base + "no-custom-classname"),
114
+ "no-unnecessary-arbitrary-value": __require(base + "no-unnecessary-arbitrary-value")
115
+ },
116
+ configs: {
117
+ recommended: require_recommended(),
118
+ "flat/recommended": require_flat_recommended()
119
+ }
120
+ };
121
+ }
122
+ });
123
+
31
124
  // node_modules/.pnpm/globals@16.1.0/node_modules/globals/globals.json
32
125
  var require_globals = __commonJS({
33
126
  "node_modules/.pnpm/globals@16.1.0/node_modules/globals/globals.json"(exports, module) {
@@ -3281,16 +3374,16 @@ var SLOW_RULES = [
3281
3374
  ];
3282
3375
 
3283
3376
  // src/define-config.ts
3284
- import fs3 from "node:fs";
3285
- import process6 from "node:process";
3377
+ import fs3 from "fs";
3378
+ import process6 from "process";
3286
3379
 
3287
3380
  // node_modules/.pnpm/local-pkg@1.1.1/node_modules/local-pkg/dist/index.mjs
3288
- import fs2 from "node:fs";
3289
- import { createRequire as createRequire2 } from "node:module";
3290
- import path2, { dirname as dirname3, join as join2, win32 } from "node:path";
3291
- import process2 from "node:process";
3292
- import fsPromises from "node:fs/promises";
3293
- import { fileURLToPath as fileURLToPath2 } from "node:url";
3381
+ import fs2 from "fs";
3382
+ import { createRequire as createRequire2 } from "module";
3383
+ import path2, { dirname as dirname3, join as join2, win32 } from "path";
3384
+ import process2 from "process";
3385
+ import fsPromises from "fs/promises";
3386
+ import { fileURLToPath as fileURLToPath2 } from "url";
3294
3387
 
3295
3388
  // node_modules/.pnpm/acorn@8.14.1/node_modules/acorn/dist/acorn.mjs
3296
3389
  var astralIdentifierCodes = [509, 0, 227, 0, 150, 4, 294, 9, 1368, 2, 2, 1, 6, 3, 41, 2, 5, 0, 166, 1, 574, 3, 9, 9, 7, 9, 32, 4, 318, 1, 80, 3, 71, 10, 50, 3, 123, 2, 54, 14, 32, 10, 3, 1, 11, 3, 46, 10, 8, 0, 46, 9, 7, 2, 37, 13, 2, 9, 6, 1, 45, 0, 13, 2, 49, 13, 9, 3, 2, 11, 83, 11, 7, 0, 3, 0, 158, 11, 6, 9, 7, 3, 56, 1, 2, 6, 3, 1, 3, 2, 10, 0, 11, 1, 3, 6, 4, 4, 68, 8, 2, 0, 3, 0, 2, 3, 2, 4, 2, 0, 15, 1, 83, 17, 10, 9, 5, 0, 82, 19, 13, 9, 214, 6, 3, 8, 28, 1, 83, 16, 16, 9, 82, 12, 9, 9, 7, 19, 58, 14, 5, 9, 243, 14, 166, 9, 71, 5, 2, 1, 3, 3, 2, 0, 2, 1, 13, 9, 120, 6, 3, 6, 4, 0, 29, 9, 41, 6, 2, 3, 9, 0, 10, 10, 47, 15, 343, 9, 54, 7, 2, 7, 17, 9, 57, 21, 2, 13, 123, 5, 4, 0, 2, 1, 2, 6, 2, 0, 9, 9, 49, 4, 2, 1, 2, 4, 9, 9, 330, 3, 10, 1, 2, 0, 49, 6, 4, 4, 14, 10, 5350, 0, 7, 14, 11465, 27, 2343, 9, 87, 9, 39, 4, 60, 6, 26, 9, 535, 9, 470, 0, 2, 54, 8, 3, 82, 0, 12, 1, 19628, 1, 4178, 9, 519, 45, 3, 22, 543, 4, 4, 5, 9, 7, 3, 6, 31, 3, 149, 2, 1418, 49, 513, 54, 5, 49, 9, 0, 15, 0, 23, 4, 2, 14, 1361, 6, 2, 16, 3, 6, 2, 1, 2, 4, 101, 0, 161, 6, 10, 9, 357, 0, 62, 13, 499, 13, 245, 1, 2, 9, 726, 6, 110, 6, 6, 9, 4759, 9, 787719, 239];
@@ -8832,8 +8925,8 @@ Parser.acorn = {
8832
8925
  };
8833
8926
 
8834
8927
  // node_modules/.pnpm/mlly@1.7.4/node_modules/mlly/dist/index.mjs
8835
- import { builtinModules, createRequire } from "node:module";
8836
- import fs, { realpathSync, statSync, promises } from "node:fs";
8928
+ import { builtinModules, createRequire } from "module";
8929
+ import fs, { realpathSync, statSync, promises } from "fs";
8837
8930
 
8838
8931
  // node_modules/.pnpm/ufo@1.5.4/node_modules/ufo/dist/index.mjs
8839
8932
  var r = String.fromCharCode;
@@ -8889,12 +8982,12 @@ var isAbsolute = function(p) {
8889
8982
  };
8890
8983
 
8891
8984
  // node_modules/.pnpm/mlly@1.7.4/node_modules/mlly/dist/index.mjs
8892
- import { fileURLToPath as fileURLToPath$1, URL as URL$1, pathToFileURL as pathToFileURL$1 } from "node:url";
8893
- import assert from "node:assert";
8894
- import process$1 from "node:process";
8895
- import path, { dirname as dirname2 } from "node:path";
8896
- import v8 from "node:v8";
8897
- import { format as format2, inspect } from "node:util";
8985
+ import { fileURLToPath as fileURLToPath$1, URL as URL$1, pathToFileURL as pathToFileURL$1 } from "url";
8986
+ import assert from "assert";
8987
+ import process$1 from "process";
8988
+ import path, { dirname as dirname2 } from "path";
8989
+ import v8 from "v8";
8990
+ import { format as format2, inspect } from "util";
8898
8991
  var BUILTIN_MODULES = new Set(builtinModules);
8899
8992
  function normalizeSlash(path3) {
8900
8993
  return path3.replace(/\\/g, "/");
@@ -10949,11 +11042,11 @@ var Err = class {
10949
11042
  var fromThrowable = Result.fromThrowable;
10950
11043
 
10951
11044
  // src/utils.ts
10952
- import process3 from "node:process";
11045
+ import process3 from "process";
10953
11046
 
10954
11047
  // src/lager.ts
10955
11048
  import Debug from "debug";
10956
- var debug = Debug("jsse:eslint-config");
11049
+ var dbg = Debug("jsse:eslint-config");
10957
11050
  var LAGER_LEVELS = {
10958
11051
  trace: 10,
10959
11052
  debug: 20,
@@ -11098,7 +11191,7 @@ var parserPlain = {
11098
11191
  })
11099
11192
  };
11100
11193
  function turnOffRules(configs, off) {
11101
- if (off && off.length > 0) {
11194
+ if (off.length > 0) {
11102
11195
  for (const rule of off) {
11103
11196
  log.debug(`turning-off: ${rule}`);
11104
11197
  }
@@ -11178,11 +11271,12 @@ import { default as default2 } from "@eslint-community/eslint-plugin-eslint-comm
11178
11271
  import { default as default3 } from "@typescript-eslint/eslint-plugin";
11179
11272
  import * as parserTs from "@typescript-eslint/parser";
11180
11273
  import { default as default4 } from "eslint-plugin-antfu";
11274
+ import { default as default5 } from "eslint-plugin-de-morgan";
11181
11275
  import * as pluginImport from "eslint-plugin-import-x";
11182
- import { default as default5 } from "eslint-plugin-n";
11183
- import { default as default6 } from "eslint-plugin-perfectionist";
11184
- import { default as default7 } from "eslint-plugin-unicorn";
11185
- import { default as default8 } from "eslint-plugin-unused-imports";
11276
+ import { default as default6 } from "eslint-plugin-n";
11277
+ import { default as default7 } from "eslint-plugin-perfectionist";
11278
+ import { default as default8 } from "eslint-plugin-unicorn";
11279
+ import { default as default9 } from "eslint-plugin-unused-imports";
11186
11280
  async function importPluginUnicorn() {
11187
11281
  const pluginUnicorn = await interopDefault2(import("eslint-plugin-unicorn"));
11188
11282
  return {
@@ -11274,7 +11368,7 @@ async function importPluginStylistic() {
11274
11368
  async function importPluginTailwind() {
11275
11369
  const pluginTailwind = await interopDefault2(
11276
11370
  // @ts-expect-error - bad types
11277
- import("eslint-plugin-tailwindcss")
11371
+ Promise.resolve().then(() => __toESM(require_lib(), 1))
11278
11372
  );
11279
11373
  return { pluginTailwind };
11280
11374
  }
@@ -11283,11 +11377,8 @@ async function safeImportPluginTailwind() {
11283
11377
  const plugin = await importPluginTailwind();
11284
11378
  return ok(plugin);
11285
11379
  } catch (e) {
11286
- return err(
11287
- new Error(
11288
- `Failed to import \`eslint-plugin-tailwindcss\`. You might need to install it. ${e}`
11289
- )
11290
- );
11380
+ const msg = (e instanceof Error ? e.message : String(e)) || `unknown error ${String(e)}`;
11381
+ return err(new Error(msg));
11291
11382
  }
11292
11383
  }
11293
11384
 
@@ -11333,8 +11424,18 @@ var command = async () => {
11333
11424
  ];
11334
11425
  };
11335
11426
 
11336
- // src/configs/comments.ts
11337
- var comments = async () => [
11427
+ // src/configs/de-morgan.ts
11428
+ var deMorgan = async () => {
11429
+ return [
11430
+ {
11431
+ ...default5.configs.recommended,
11432
+ name: "jsse/de-morgan"
11433
+ }
11434
+ ];
11435
+ };
11436
+
11437
+ // src/configs/eslint-comments.ts
11438
+ var eslintComments = async () => [
11338
11439
  {
11339
11440
  name: "jsse/eslint-comments",
11340
11441
  plugins: {
@@ -11527,7 +11628,7 @@ var javascript = async (options) => {
11527
11628
  name: "jsse/javascript",
11528
11629
  plugins: {
11529
11630
  // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
11530
- "unused-imports": default8
11631
+ "unused-imports": default9
11531
11632
  },
11532
11633
  rules: {
11533
11634
  ...eslintjs.configs.recommended.rules,
@@ -11868,8 +11969,15 @@ var jsonc = async (options) => {
11868
11969
  import { mergeProcessors, processorPassThrough } from "eslint-merge-processors";
11869
11970
 
11870
11971
  // src/configs/ts/typescript-rules.ts
11871
- function typescriptRulesTypeAware() {
11972
+ import tseslint from "typescript-eslint";
11973
+ var extractRules = (configs) => {
11974
+ const rules = configs.filter((config) => config.rules !== void 0).map((config) => config.rules ?? {});
11975
+ return Object.assign({}, ...rules);
11976
+ };
11977
+ function typescriptRulesTypeAware(props) {
11978
+ const tsRecomendedRulesTypeChecked = props?.strict ? extractRules(tseslint.configs.strictTypeChecked) : extractRules(tseslint.configs.recommendedTypeChecked);
11872
11979
  return {
11980
+ ...tsRecomendedRulesTypeChecked,
11873
11981
  "@typescript-eslint/await-thenable": "error",
11874
11982
  "@typescript-eslint/no-for-in-array": "error",
11875
11983
  "no-implied-eval": "off",
@@ -11986,8 +12094,10 @@ function typescriptRulesTypeAware() {
11986
12094
  ]
11987
12095
  };
11988
12096
  }
11989
- function typescriptRulesTypeOblivious() {
12097
+ function typescriptRulesTypeOblivious(props) {
12098
+ const tseslintBaseRules = props?.strict ? extractRules(tseslint.configs.strict) : extractRules(tseslint.configs.recommended);
11990
12099
  return {
12100
+ ...tseslintBaseRules,
11991
12101
  eqeqeq: "error",
11992
12102
  camelcase: "off",
11993
12103
  yoda: "error",
@@ -12010,61 +12120,6 @@ function typescriptRulesTypeOblivious() {
12010
12120
  }
12011
12121
  ],
12012
12122
  "@typescript-eslint/adjacent-overload-signatures": "error",
12013
- // "@typescript-eslint/ban-types": [
12014
- // "warn",
12015
- // {
12016
- // extendDefaults: false,
12017
- // types: {
12018
- // String: {
12019
- // message: 'Use "string" instead',
12020
- // fixWith: "string",
12021
- // },
12022
- // Boolean: {
12023
- // message: 'Use "boolean" instead',
12024
- // fixWith: "boolean",
12025
- // },
12026
- // Number: {
12027
- // message: 'Use "number" instead',
12028
- // fixWith: "number",
12029
- // },
12030
- // BigInt: {
12031
- // message: "Use `bigint` instead.",
12032
- // fixWith: "bigint",
12033
- // },
12034
- // Object: {
12035
- // message:
12036
- // "The `Object` type is mostly the same as `unknown`. You probably want `Record<string, unknown>` instead. See https://github.com/typescript-eslint/typescript-eslint/pull/848",
12037
- // fixWith: "Record<string, unknown>",
12038
- // },
12039
- // object: {
12040
- // message:
12041
- // "The `object` type is hard to use. Use `Record<string, unknown>` instead. See: https://github.com/typescript-eslint/typescript-eslint/pull/848",
12042
- // fixWith: "Record<string, unknown>",
12043
- // },
12044
- // Symbol: {
12045
- // message: 'Use "symbol" instead',
12046
- // fixWith: "symbol",
12047
- // },
12048
- // Function: {
12049
- // message:
12050
- // 'The "Function" type accepts any function-like value.\nIt provides no type safety when calling the function, which can be a common source of bugs.\nIt also accepts things like class declarations, which will throw at runtime as they will not be called with "new".\nIf you are expecting the function to accept certain arguments, you should explicitly define the function shape.',
12051
- // },
12052
- // // eslint-disable-next-line @typescript-eslint/naming-convention
12053
- // "{}": {
12054
- // message:
12055
- // "The `{}` type is mostly the same as `unknown`. You probably want `Record<string, unknown>` instead.",
12056
- // fixWith: "Record<string, unknown>",
12057
- // },
12058
- // // eslint-disable-next-line @typescript-eslint/naming-convention
12059
- // "[]": "Don't use the empty array type `[]`. It only allows empty arrays. Use `SomeType[]` instead.",
12060
- // // eslint-disable-next-line @typescript-eslint/naming-convention
12061
- // "[[]]":
12062
- // "Don't use `[[]]`. It only allows an array with a single element which is an empty array. Use `SomeType[][]` instead.",
12063
- // // eslint-disable-next-line @typescript-eslint/naming-convention
12064
- // "[[[]]]": "Don't use `[[[]]]`. Use `SomeType[][][]` instead.",
12065
- // },
12066
- // },
12067
- // ],
12068
12123
  "@typescript-eslint/consistent-type-assertions": "error",
12069
12124
  "@typescript-eslint/consistent-type-definitions": ["error", "type"],
12070
12125
  "@typescript-eslint/member-ordering": [
@@ -12275,14 +12330,15 @@ function typescriptRulesTypeOblivious() {
12275
12330
  };
12276
12331
  }
12277
12332
  function typescriptRules(props) {
12278
- const { typeAware } = props ?? {};
12279
- if (typeAware === true) {
12333
+ const normalized = { typeAware: false, strict: false, ...props };
12334
+ dbg("building typescript rules: %O", normalized);
12335
+ if (normalized.typeAware) {
12280
12336
  return {
12281
- ...typescriptRulesTypeOblivious(),
12282
- ...typescriptRulesTypeAware()
12337
+ ...typescriptRulesTypeOblivious({ strict: normalized.strict }),
12338
+ ...typescriptRulesTypeAware({ strict: normalized.strict })
12283
12339
  };
12284
12340
  }
12285
- return typescriptRulesTypeOblivious();
12341
+ return typescriptRulesTypeOblivious({ strict: normalized.strict });
12286
12342
  }
12287
12343
 
12288
12344
  // src/configs/markdown.ts
@@ -12297,13 +12353,11 @@ var markdown = async (options) => {
12297
12353
  "off"
12298
12354
  ])
12299
12355
  );
12300
- const processor = mergeProcessors(
12301
- [
12302
- // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
12303
- pluginMarkdown.processors.markdown,
12304
- processorPassThrough
12305
- ].filter((processor2) => processor2 !== void 0)
12306
- );
12356
+ const processor = mergeProcessors([
12357
+ // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
12358
+ pluginMarkdown.processors.markdown,
12359
+ processorPassThrough
12360
+ ]);
12307
12361
  return [
12308
12362
  {
12309
12363
  name: "jsse/markdown/setup",
@@ -12412,7 +12466,7 @@ var n = async () => {
12412
12466
  {
12413
12467
  name: "jsse/n",
12414
12468
  plugins: {
12415
- n: default5
12469
+ n: default6
12416
12470
  },
12417
12471
  rules: {
12418
12472
  "n/handle-callback-err": ["error", "^(err|error)$"],
@@ -12462,7 +12516,7 @@ var perfectionist = async () => {
12462
12516
  name: "jsse/perfectionist",
12463
12517
  plugins: {
12464
12518
  // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
12465
- perfectionist: default6
12519
+ perfectionist: default7
12466
12520
  },
12467
12521
  rules: {
12468
12522
  "perfectionist/sort-exports": [
@@ -12640,7 +12694,7 @@ var prettier = async () => {
12640
12694
  import { fixupPluginRules } from "@eslint/compat";
12641
12695
 
12642
12696
  // src/configs/ts/typescript-language-options.ts
12643
- import process4 from "node:process";
12697
+ import process4 from "process";
12644
12698
  function typescriptLanguageOptions(options) {
12645
12699
  const { componentExts = [], react: react2, tsconfig } = options || {};
12646
12700
  const tsOptions = tsconfig ? {
@@ -13183,9 +13237,7 @@ var sortTsconfig = async (options) => {
13183
13237
  };
13184
13238
 
13185
13239
  // src/configs/stylistic.ts
13186
- function jsxStylistic({
13187
- indent
13188
- }) {
13240
+ function jsxStylistic({ indent }) {
13189
13241
  return {
13190
13242
  "@stylistic/jsx-curly-brace-presence": [
13191
13243
  "error",
@@ -13222,60 +13274,8 @@ var stylistic = async (options) => {
13222
13274
  ];
13223
13275
  };
13224
13276
 
13225
- // src/configs/tailwind.ts
13226
- var TAILWIND_ESLINT_SETTINGS_DEFAULT = {
13227
- // These are the default values but feel free to customize
13228
- callees: ["classnames", "clsx", "ctl", "cn", "cx", "twMerge", "twJoin"],
13229
- classRegex: "^class(Name)?$",
13230
- // can be modified to support custom attributes. E.g. "^tw$" for `twin.macro`
13231
- config: "tailwind.config.js",
13232
- // returned from `loadConfig()` utility if not provided
13233
- cssFiles: ["**/*.css", "!**/node_modules", "!**/.*", "!**/dist", "!**/build"],
13234
- cssFilesRefreshRate: 5e3,
13235
- removeDuplicates: true,
13236
- skipClassAttribute: false,
13237
- tags: [],
13238
- // can be set to e.g. ['tw'] for use in tw`bg-blue`
13239
- whitelist: []
13240
- };
13241
- function tailwindSettings(options) {
13242
- if (typeof options === "boolean") {
13243
- return TAILWIND_ESLINT_SETTINGS_DEFAULT;
13244
- }
13245
- return { ...TAILWIND_ESLINT_SETTINGS_DEFAULT, ...options };
13246
- }
13247
- var tailwind = async (options) => {
13248
- const importResult = await safeImportPluginTailwind();
13249
- return importResult.match(
13250
- ({ pluginTailwind }) => {
13251
- return [
13252
- {
13253
- files: [GLOB_SRC],
13254
- name: "jsse/tailwind/rules",
13255
- plugins: {
13256
- // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
13257
- tailwindcss: pluginTailwind
13258
- },
13259
- // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
13260
- rules: {
13261
- // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access
13262
- ...pluginTailwind.configs.recommended.rules
13263
- },
13264
- settings: {
13265
- tailwindcss: tailwindSettings(options)
13266
- }
13267
- }
13268
- ];
13269
- },
13270
- (error) => {
13271
- log.error(error.message);
13272
- return [];
13273
- }
13274
- );
13275
- };
13276
-
13277
13277
  // src/configs/ts/parser.ts
13278
- import process5 from "node:process";
13278
+ import process5 from "process";
13279
13279
  function autoUseParserService(options) {
13280
13280
  if (options.useProjectService !== void 0) {
13281
13281
  return options.useProjectService;
@@ -13295,12 +13295,13 @@ function typescriptParser(options) {
13295
13295
  } = options;
13296
13296
  const typeAware = !!tsconfig;
13297
13297
  if (useProjectService) {
13298
- debug("ts parser-options using `projectService`project service");
13298
+ dbg("ts parser-options using `projectService`project service");
13299
13299
  return {
13300
13300
  files,
13301
- ...ignores2 ? { ignores: ignores2 } : {},
13301
+ ...ignores2.length > 0 ? { ignores: ignores2 } : {},
13302
13302
  languageOptions: {
13303
13303
  parser: parserTs,
13304
+ // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
13304
13305
  parserOptions: {
13305
13306
  extraFileExtensions: componentExts.map((ext) => `.${ext}`),
13306
13307
  jsxPragma: react2 ? "React" : void 0,
@@ -13319,14 +13320,15 @@ function typescriptParser(options) {
13319
13320
  name: name ?? `jsse/typescript/${typeAware ? "type-aware-parser" : "parser"}`
13320
13321
  };
13321
13322
  }
13322
- debug(
13323
+ dbg(
13323
13324
  "ts parser-options NOT using `projectService`project service - using `project`"
13324
13325
  );
13325
13326
  return {
13326
13327
  files,
13327
- ...ignores2 ? { ignores: ignores2 } : {},
13328
+ ...ignores2.length > 0 ? { ignores: ignores2 } : {},
13328
13329
  languageOptions: {
13329
13330
  parser: parserTs,
13331
+ // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
13330
13332
  parserOptions: {
13331
13333
  extraFileExtensions: componentExts.map((ext) => `.${ext}`),
13332
13334
  jsxPragma: react2 ? "React" : void 0,
@@ -13345,6 +13347,7 @@ function typescriptParser(options) {
13345
13347
 
13346
13348
  // src/configs/ts/typescript.ts
13347
13349
  var typescript = async (options) => {
13350
+ dbg("typescript-options: %O", options);
13348
13351
  const {
13349
13352
  componentExts = [],
13350
13353
  filesTypeAware = [GLOB_TS, GLOB_TSX],
@@ -13353,8 +13356,9 @@ var typescript = async (options) => {
13353
13356
  parserOptions = {},
13354
13357
  prefix,
13355
13358
  react: react2 = false,
13359
+ strict = false,
13356
13360
  tsconfig: tsconfigPath,
13357
- typeAware
13361
+ typeAware = true
13358
13362
  } = options ?? {};
13359
13363
  const parserConfigs = typeAware ? [
13360
13364
  typescriptParser({
@@ -13392,11 +13396,12 @@ var typescript = async (options) => {
13392
13396
  ...default3.configs.strict?.rules,
13393
13397
  "no-invalid-this": "off",
13394
13398
  ...typescriptRules({
13395
- typeAware: false
13399
+ strict,
13400
+ typeAware
13396
13401
  }),
13397
13402
  ...overrides
13398
13403
  };
13399
- return [
13404
+ const tsEslintConfigs = [
13400
13405
  {
13401
13406
  // Install the plugins without globs, so they can be configured separately.
13402
13407
  name: "jsse/typescript/setup",
@@ -13406,30 +13411,36 @@ var typescript = async (options) => {
13406
13411
  }
13407
13412
  },
13408
13413
  ...parserConfigs,
13414
+ // ========================================================================
13415
+ // RULES - NOT TYPE AWARE
13416
+ // ========================================================================
13409
13417
  {
13410
13418
  // only apply ts rules to ts files!
13411
13419
  files: [GLOB_TS, GLOB_TSX, ...componentExts.map((ext) => `**/*.${ext}`)],
13412
13420
  name: "jsse/typescript/rules",
13413
13421
  // may not need to rename all rules here........
13414
- rules: renameRules(tsRules || {}, tsPrefix, tsPrefixTo)
13415
- },
13416
- ...typeAware ? [
13417
- {
13418
- files: filesTypeAware,
13419
- ignores: ignoresTypeAware,
13420
- name: "jsse/typescript/rules-type-aware",
13421
- rules: renameRules(
13422
- {
13423
- ...typescriptRules({
13424
- typeAware: true
13425
- }),
13426
- ...overrides
13427
- },
13428
- tsPrefix,
13429
- tsPrefixTo
13430
- )
13431
- }
13432
- ] : [],
13422
+ rules: renameRules(tsRules, tsPrefix, tsPrefixTo)
13423
+ }
13424
+ ];
13425
+ if (typeAware) {
13426
+ tsEslintConfigs.push({
13427
+ files: filesTypeAware,
13428
+ ignores: ignoresTypeAware,
13429
+ name: "jsse/typescript/rules-type-aware",
13430
+ rules: renameRules(
13431
+ {
13432
+ ...typescriptRules({
13433
+ strict,
13434
+ typeAware: true
13435
+ }),
13436
+ ...overrides
13437
+ },
13438
+ tsPrefix,
13439
+ tsPrefixTo
13440
+ )
13441
+ });
13442
+ }
13443
+ tsEslintConfigs.push(
13433
13444
  {
13434
13445
  files: ["**/*.d.ts"],
13435
13446
  name: "jsse/typescript:disables/dts",
@@ -13456,7 +13467,8 @@ var typescript = async (options) => {
13456
13467
  "@typescript-eslint/no-var-requires": "off"
13457
13468
  }
13458
13469
  }
13459
- ];
13470
+ );
13471
+ return tsEslintConfigs;
13460
13472
  };
13461
13473
 
13462
13474
  // src/configs/tsdoc.ts
@@ -13505,10 +13517,10 @@ var unicorn = async () => {
13505
13517
  name: "jsse/unicorn",
13506
13518
  plugins: {
13507
13519
  // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
13508
- unicorn: default7
13520
+ unicorn: default8
13509
13521
  },
13510
13522
  rules: {
13511
- ...unicornRecommended(default7),
13523
+ ...unicornRecommended(default8),
13512
13524
  ...unicornOff(),
13513
13525
  "unicorn/better-regex": "error",
13514
13526
  "unicorn/consistent-empty-array-spread": "error",
@@ -13688,6 +13700,7 @@ var DEBUG = ["1", "true", "t", "on", "yes", "y"].includes(
13688
13700
  process6.env.DEBUG ?? ""
13689
13701
  );
13690
13702
  function defaultOptions2() {
13703
+ const typescriptExists = isPackageExists("typescript");
13691
13704
  return {
13692
13705
  command: true,
13693
13706
  componentExts: [],
@@ -13706,7 +13719,8 @@ function defaultOptions2() {
13706
13719
  stylistic: true,
13707
13720
  test: true,
13708
13721
  tsPrefix: "@typescript-eslint",
13709
- typescript: isPackageExists("typescript")
13722
+ typeAware: false,
13723
+ typescript: typescriptExists
13710
13724
  };
13711
13725
  }
13712
13726
  function normalizeOptions(options = {}) {
@@ -13716,14 +13730,19 @@ function normalizeOptions(options = {}) {
13716
13730
  ...options.fast ? [...SLOW_RULES] : []
13717
13731
  ])
13718
13732
  ].sort(
13719
- (a, b) => a.localeCompare(b, void 0, { numeric: true, sensitivity: "base" })
13733
+ (a, b) => (
13734
+ // eslint-disable-next-line @typescript-eslint/no-unsafe-call
13735
+ a.localeCompare(b, void 0, { numeric: true, sensitivity: "base" })
13736
+ )
13720
13737
  );
13721
13738
  const stylisticOptions = options.stylistic === false ? false : typeof options.stylistic === "object" ? options.stylistic : {};
13722
13739
  if (stylisticOptions && !("jsx" in stylisticOptions)) {
13723
13740
  stylisticOptions.jsx = options.jsx ?? true;
13724
13741
  }
13742
+ const defaults = defaultOptions2();
13725
13743
  return {
13726
- ...defaultOptions2(),
13744
+ ...defaults,
13745
+ typeAware: options.typeAware ?? defaults.typeAware,
13727
13746
  ...options,
13728
13747
  off,
13729
13748
  reportUnusedDisableDirectives: options.reportUnusedDisableDirectives ?? !options.fast,
@@ -13733,26 +13752,34 @@ function normalizeOptions(options = {}) {
13733
13752
  async function jsse(options = {}, ...userConfigs) {
13734
13753
  const normalizedOptions = normalizeOptions(options);
13735
13754
  const {
13755
+ command: enableCommand,
13736
13756
  componentExts,
13737
- debug: debug2,
13757
+ debug,
13738
13758
  gitignore: enableGitignore,
13739
13759
  isInEditor: isInEditor2,
13760
+ jsonc: enableJsonc,
13761
+ markdown: enableMarkdown,
13740
13762
  off,
13741
13763
  overrides = {},
13742
13764
  prettier: enablePrettier,
13743
13765
  react: enableReact,
13744
13766
  reportUnusedDisableDirectives,
13767
+ rootId,
13768
+ // default to "jsse"
13745
13769
  stylistic: stylisticOptions,
13770
+ tailwind: tailwindOptions,
13771
+ test: enableTest,
13746
13772
  tsPrefix,
13747
13773
  typeAware,
13748
- typescript: enableTypeScript
13774
+ typescript: typescriptOptions,
13775
+ yaml: enableYaml
13749
13776
  } = normalizedOptions;
13750
- if (debug2 || process6.argv.includes("--debug")) {
13777
+ if (debug || process6.argv.includes("--debug")) {
13751
13778
  log.level = "debug";
13752
13779
  }
13753
13780
  log.debug("@jsse/eslint-config debug=true");
13754
13781
  log.debug("@jsse/eslint-config isInEditor", isInEditor2);
13755
- log.debug("@jsse/eslint-config enableTypeScript", enableTypeScript);
13782
+ log.debug("@jsse/eslint-config enableTypeScript", typescriptOptions);
13756
13783
  log.debug("@jsse/eslint-config normalizedOptions", normalizedOptions);
13757
13784
  const configs = [];
13758
13785
  if (enableGitignore) {
@@ -13784,7 +13811,7 @@ async function jsse(options = {}, ...userConfigs) {
13784
13811
  overrides: overrides.javascript,
13785
13812
  reportUnusedDisableDirectives
13786
13813
  }),
13787
- comments(),
13814
+ eslintComments(),
13788
13815
  n(),
13789
13816
  jsdoc(),
13790
13817
  imports({
@@ -13792,14 +13819,15 @@ async function jsse(options = {}, ...userConfigs) {
13792
13819
  }),
13793
13820
  unicorn(),
13794
13821
  antfu(),
13795
- perfectionist()
13822
+ perfectionist(),
13823
+ deMorgan()
13796
13824
  );
13797
- if (normalizedOptions.command) {
13825
+ if (enableCommand) {
13798
13826
  configs.push(command());
13799
13827
  }
13800
- if (enableTypeScript) {
13828
+ if (typescriptOptions) {
13801
13829
  const tscfg = typescript({
13802
- ...typeof enableTypeScript === "boolean" ? {} : enableTypeScript,
13830
+ ...typeof typescriptOptions === "boolean" ? {} : typescriptOptions,
13803
13831
  componentExts,
13804
13832
  overrides: overrides.typescript,
13805
13833
  prefix: {
@@ -13811,14 +13839,14 @@ async function jsse(options = {}, ...userConfigs) {
13811
13839
  });
13812
13840
  configs.push(tscfg, tsdoc());
13813
13841
  }
13814
- if (normalizedOptions.markdown) {
13842
+ if (enableMarkdown) {
13815
13843
  configs.push(markdown());
13816
13844
  }
13817
- if (normalizedOptions.yaml) {
13845
+ if (enableYaml) {
13818
13846
  const ymlConfig = yml();
13819
13847
  configs.push(ymlConfig);
13820
13848
  }
13821
- if (normalizedOptions.react) {
13849
+ if (enableReact) {
13822
13850
  configs.push(
13823
13851
  react({
13824
13852
  // use react refresh if not explicitly disabled w/ 'false'
@@ -13832,7 +13860,7 @@ async function jsse(options = {}, ...userConfigs) {
13832
13860
  if (stylisticOptions) {
13833
13861
  configs.push(stylistic(stylisticOptions === true ? {} : stylisticOptions));
13834
13862
  }
13835
- if (normalizedOptions.test) {
13863
+ if (enableTest) {
13836
13864
  configs.push(
13837
13865
  vitest({
13838
13866
  isInEditor: isInEditor2,
@@ -13844,7 +13872,7 @@ async function jsse(options = {}, ...userConfigs) {
13844
13872
  })
13845
13873
  );
13846
13874
  }
13847
- if (normalizedOptions.jsonc ?? true) {
13875
+ if (enableJsonc ?? true) {
13848
13876
  configs.push(
13849
13877
  jsonc({
13850
13878
  overrides: overrides.jsonc,
@@ -13856,16 +13884,8 @@ async function jsse(options = {}, ...userConfigs) {
13856
13884
  })
13857
13885
  );
13858
13886
  }
13859
- if (normalizedOptions.tailwind) {
13860
- try {
13861
- configs.push(
13862
- tailwind(
13863
- normalizedOptions.tailwind === true ? {} : normalizedOptions.tailwind
13864
- )
13865
- );
13866
- } catch (e) {
13867
- log.error("Tailwind config failed", e);
13868
- }
13887
+ if (tailwindOptions) {
13888
+ console.error("Tailwind configuration is deprecate4d...");
13869
13889
  }
13870
13890
  if (normalizedOptions.prettier) {
13871
13891
  configs.push(prettier());
@@ -13883,13 +13903,10 @@ async function jsse(options = {}, ...userConfigs) {
13883
13903
  if (off && off.length > 0) {
13884
13904
  turnOffRules(combinedConfigs, off);
13885
13905
  }
13886
- if (normalizedOptions.rootId !== "jsse") {
13906
+ if (rootId !== "jsse") {
13887
13907
  for (const config of combinedConfigs) {
13888
13908
  if (config.name && config.name.startsWith("jsse/")) {
13889
- config.name = config.name.replace(
13890
- "jsse/",
13891
- `${normalizedOptions.rootId}/`
13892
- );
13909
+ config.name = config.name.replace("jsse/", `${rootId}/`);
13893
13910
  }
13894
13911
  }
13895
13912
  }
@@ -13933,9 +13950,30 @@ async function defineConfig(options = {}, ...userConfigs) {
13933
13950
  }
13934
13951
 
13935
13952
  // src/generated/version.ts
13936
- var VERSION = "0.3.7";
13953
+ var VERSION = "0.4.0";
13937
13954
 
13938
13955
  // src/presets.ts
13956
+ var makePresetFn = (cfgFunctions) => {
13957
+ return async () => {
13958
+ const results = await Promise.allSettled(cfgFunctions.map((fn) => fn()));
13959
+ const ok2 = [];
13960
+ const err2 = [];
13961
+ for (const result of results) {
13962
+ if (result.status === "fulfilled") {
13963
+ ok2.push(...result.value);
13964
+ } else {
13965
+ err2.push(result.reason);
13966
+ }
13967
+ }
13968
+ if (err2.length > 0) {
13969
+ const errorMessage = `Some preset functions failed: ${err2.map((e) => {
13970
+ return e instanceof Error ? e.message : JSON.stringify(e);
13971
+ }).join(", ")}`;
13972
+ throw new Error(errorMessage);
13973
+ }
13974
+ return ok2;
13975
+ };
13976
+ };
13939
13977
  var jsseReact = (options, ...configs) => {
13940
13978
  return jsse(
13941
13979
  {
@@ -13950,6 +13988,29 @@ var jsseReact = (options, ...configs) => {
13950
13988
  ...configs
13951
13989
  );
13952
13990
  };
13991
+ var presetJavascript = makePresetFn([
13992
+ ignores,
13993
+ javascript,
13994
+ eslintComments,
13995
+ imports,
13996
+ unicorn,
13997
+ n,
13998
+ jsdoc,
13999
+ deMorgan
14000
+ ]);
14001
+ var presetJsonc = makePresetFn([
14002
+ jsonc,
14003
+ sortPackageJson,
14004
+ sortTsconfig
14005
+ // ...sortPnpmWorkspace(),
14006
+ ]);
14007
+ var presetLangsExtensions = makePresetFn([markdown, yml, presetJsonc]);
14008
+ var presetBasic = makePresetFn([presetJavascript, typescript]);
14009
+ var presetAll = makePresetFn([
14010
+ presetBasic,
14011
+ presetLangsExtensions,
14012
+ command
14013
+ ]);
13953
14014
  export {
13954
14015
  SLOW_RULES,
13955
14016
  VERSION,
@@ -13982,13 +14043,14 @@ export {
13982
14043
  parserPlain,
13983
14044
  parserTs,
13984
14045
  default4 as pluginAntfu,
14046
+ default5 as pluginDeMorgan,
13985
14047
  default2 as pluginEslintComments,
13986
14048
  pluginImport,
13987
- default5 as pluginN,
13988
- default6 as pluginPerfectionist,
14049
+ default6 as pluginN,
14050
+ default7 as pluginPerfectionist,
13989
14051
  default3 as pluginTs,
13990
- default7 as pluginUnicorn,
13991
- default8 as pluginUnusedImports,
14052
+ default8 as pluginUnicorn,
14053
+ default9 as pluginUnusedImports,
13992
14054
  renameRules,
13993
14055
  safeImportPluginTailwind,
13994
14056
  turnOffRules,