@luxass/eslint-config 4.0.0-beta.9 → 4.0.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 (149) hide show
  1. package/README.md +351 -48
  2. package/dist/{chunk-TQ476NL2.mjs → chunk-4YBQZLPS.mjs} +13 -2
  3. package/dist/{chunk-NDNDG7BH.mjs → chunk-5NK24IKQ.mjs} +2 -5
  4. package/dist/{chunk-2SW2E3TH.mjs → chunk-5SDSWPKR.mjs} +14 -4
  5. package/dist/chunk-6T7MXPCT.mjs +17 -0
  6. package/dist/{chunk-ADP4MYOS.mjs → chunk-ANUYBAYV.mjs} +1 -1
  7. package/dist/{chunk-R4NSLRAE.mjs → chunk-ATRL3UZP.mjs} +14 -8
  8. package/dist/{chunk-P3N5WLFL.mjs → chunk-BXBN56WI.mjs} +11 -7
  9. package/dist/chunk-CJ3ZUYUJ.mjs +183 -0
  10. package/dist/chunk-DAJA5AV3.mjs +29 -0
  11. package/dist/{chunk-FK567E7G.mjs → chunk-DVQQVCGF.mjs} +7 -3
  12. package/dist/chunk-DZCXT6HT.mjs +288 -0
  13. package/dist/chunk-FU5SRKZU.mjs +104 -0
  14. package/dist/{chunk-LQLF2CMA.mjs → chunk-GBLPCM3X.mjs} +14 -17
  15. package/dist/chunk-KJ7ZCBK4.mjs +48 -0
  16. package/dist/{chunk-BAKUP7QM.mjs → chunk-P3QUAOFO.mjs} +36 -34
  17. package/dist/{chunk-QZTI72NS.mjs → chunk-PYS26PF3.mjs} +13 -9
  18. package/dist/chunk-Q57BF3CR.mjs +63 -0
  19. package/dist/{chunk-SPQZTV4E.mjs → chunk-QK56GX3F.mjs} +12 -14
  20. package/dist/{chunk-3QHLEAXK.mjs → chunk-RDZJT36Z.mjs} +22 -8
  21. package/dist/{chunk-HE56XDG6.mjs → chunk-RVSUTDCE.mjs} +15 -5
  22. package/dist/chunk-UMUUVFB7.mjs +69 -0
  23. package/dist/{chunk-NUG6FLHN.mjs → chunk-VZ2YFMWH.mjs} +54 -11
  24. package/dist/chunk-WDSV2EFG.mjs +7 -0
  25. package/dist/{chunk-M5WNLLBT.mjs → chunk-WOYZWHPM.mjs} +20 -7
  26. package/dist/chunk-WRURTO5T.mjs +144 -0
  27. package/dist/configs/astro.cjs +11 -21
  28. package/dist/configs/astro.d.cts +3 -6
  29. package/dist/configs/astro.d.ts +3 -6
  30. package/dist/configs/astro.mjs +3 -3
  31. package/dist/configs/comments.cjs +9 -12
  32. package/dist/configs/comments.d.cts +3 -2
  33. package/dist/configs/comments.d.ts +3 -2
  34. package/dist/configs/comments.mjs +1 -2
  35. package/dist/configs/formatters.cjs +274 -0
  36. package/dist/configs/formatters.d.cts +11 -0
  37. package/dist/configs/formatters.d.ts +11 -0
  38. package/dist/configs/formatters.mjs +9 -0
  39. package/dist/configs/ignores.cjs +1 -8
  40. package/dist/configs/ignores.d.cts +3 -2
  41. package/dist/configs/ignores.d.ts +3 -2
  42. package/dist/configs/ignores.mjs +2 -2
  43. package/dist/configs/imports.cjs +35 -9
  44. package/dist/configs/imports.d.cts +13 -4
  45. package/dist/configs/imports.d.ts +13 -4
  46. package/dist/configs/imports.mjs +2 -2
  47. package/dist/configs/index.cjs +1104 -710
  48. package/dist/configs/index.d.cts +7 -18
  49. package/dist/configs/index.d.ts +7 -18
  50. package/dist/configs/index.mjs +40 -36
  51. package/dist/configs/javascript.cjs +9 -23
  52. package/dist/configs/javascript.d.cts +3 -6
  53. package/dist/configs/javascript.d.ts +3 -6
  54. package/dist/configs/javascript.mjs +2 -3
  55. package/dist/configs/jsdoc.cjs +6 -2
  56. package/dist/configs/jsdoc.d.cts +17 -4
  57. package/dist/configs/jsdoc.d.ts +17 -4
  58. package/dist/configs/jsdoc.mjs +2 -2
  59. package/dist/configs/jsonc.cjs +8 -11
  60. package/dist/configs/jsonc.d.cts +3 -6
  61. package/dist/configs/jsonc.d.ts +3 -6
  62. package/dist/configs/jsonc.mjs +3 -3
  63. package/dist/configs/markdown.cjs +46 -35
  64. package/dist/configs/markdown.d.cts +25 -4
  65. package/dist/configs/markdown.d.ts +25 -4
  66. package/dist/configs/markdown.mjs +3 -3
  67. package/dist/configs/nextjs.cjs +13 -11
  68. package/dist/configs/nextjs.d.cts +3 -6
  69. package/dist/configs/nextjs.d.ts +3 -6
  70. package/dist/configs/nextjs.mjs +3 -3
  71. package/dist/configs/node.cjs +0 -10
  72. package/dist/configs/node.d.cts +3 -2
  73. package/dist/configs/node.d.ts +3 -2
  74. package/dist/configs/node.mjs +1 -2
  75. package/dist/configs/perfectionist.cjs +2 -20
  76. package/dist/configs/perfectionist.d.cts +4 -3
  77. package/dist/configs/perfectionist.d.ts +4 -3
  78. package/dist/configs/perfectionist.mjs +1 -2
  79. package/dist/configs/react.cjs +201 -203
  80. package/dist/configs/react.d.cts +3 -6
  81. package/dist/configs/react.d.ts +3 -6
  82. package/dist/configs/react.mjs +3 -3
  83. package/dist/configs/sort.cjs +6 -6
  84. package/dist/configs/sort.d.cts +3 -2
  85. package/dist/configs/sort.d.ts +3 -2
  86. package/dist/configs/sort.mjs +1 -1
  87. package/dist/configs/stylistic.cjs +20 -11
  88. package/dist/configs/stylistic.d.cts +4 -7
  89. package/dist/configs/stylistic.d.ts +4 -7
  90. package/dist/configs/stylistic.mjs +4 -3
  91. package/dist/configs/tailwindcss.cjs +33 -47
  92. package/dist/configs/tailwindcss.d.cts +3 -6
  93. package/dist/configs/tailwindcss.d.ts +3 -6
  94. package/dist/configs/tailwindcss.mjs +3 -3
  95. package/dist/configs/test.cjs +103 -16
  96. package/dist/configs/test.d.cts +3 -6
  97. package/dist/configs/test.d.ts +3 -6
  98. package/dist/configs/test.mjs +4 -3
  99. package/dist/configs/toml.cjs +131 -0
  100. package/dist/configs/toml.d.cts +11 -0
  101. package/dist/configs/toml.d.ts +11 -0
  102. package/dist/configs/toml.mjs +8 -0
  103. package/dist/configs/typescript.cjs +32 -43
  104. package/dist/configs/typescript.d.cts +3 -6
  105. package/dist/configs/typescript.d.ts +3 -6
  106. package/dist/configs/typescript.mjs +3 -4
  107. package/dist/configs/unicorn.cjs +13 -10
  108. package/dist/configs/unicorn.d.cts +3 -2
  109. package/dist/configs/unicorn.d.ts +3 -2
  110. package/dist/configs/unicorn.mjs +1 -2
  111. package/dist/configs/unocss.cjs +48 -20
  112. package/dist/configs/unocss.d.cts +3 -6
  113. package/dist/configs/unocss.d.ts +3 -6
  114. package/dist/configs/unocss.mjs +3 -3
  115. package/dist/configs/vue.cjs +51 -15
  116. package/dist/configs/vue.d.cts +3 -6
  117. package/dist/configs/vue.d.ts +3 -6
  118. package/dist/configs/vue.mjs +3 -3
  119. package/dist/configs/yaml.cjs +17 -11
  120. package/dist/configs/yaml.d.cts +3 -6
  121. package/dist/configs/yaml.d.ts +3 -6
  122. package/dist/configs/yaml.mjs +3 -3
  123. package/dist/custom-rules/utils.cjs +31 -0
  124. package/dist/custom-rules/utils.d.cts +6 -0
  125. package/dist/custom-rules/utils.d.ts +6 -0
  126. package/dist/custom-rules/utils.mjs +6 -0
  127. package/dist/globs.cjs +157 -0
  128. package/dist/globs.d.cts +28 -0
  129. package/dist/globs.d.ts +28 -0
  130. package/dist/globs.mjs +56 -0
  131. package/dist/index.cjs +1246 -837
  132. package/dist/index.d.cts +10 -44
  133. package/dist/index.d.ts +10 -44
  134. package/dist/index.mjs +107 -147
  135. package/dist/types-spTEGSaV.d.cts +632 -0
  136. package/dist/types-spTEGSaV.d.ts +632 -0
  137. package/package.json +69 -37
  138. package/dist/chunk-24KJPXII.mjs +0 -51
  139. package/dist/chunk-4HH6LYJ6.mjs +0 -25
  140. package/dist/chunk-AL47KNVD.mjs +0 -37
  141. package/dist/chunk-C5VMTRKT.mjs +0 -18
  142. package/dist/chunk-ERFDRAGW.mjs +0 -86
  143. package/dist/chunk-HLDEUDLN.mjs +0 -28
  144. package/dist/chunk-O4O6V7LI.mjs +0 -70
  145. package/dist/chunk-UBPIYSHC.mjs +0 -284
  146. package/dist/types-h9izbkUX.d.cts +0 -241
  147. package/dist/types-h9izbkUX.d.ts +0 -241
  148. package/dist/{chunk-FKAOMYGL.mjs → chunk-ME2OAMS3.mjs} +0 -0
  149. package/dist/{chunk-FOIFEV73.mjs → chunk-XBASVDU6.mjs} +6 -6
package/dist/index.cjs CHANGED
@@ -30,31 +30,10 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
30
30
  // src/index.ts
31
31
  var src_exports = {};
32
32
  __export(src_exports, {
33
- GLOB_ASTRO: () => GLOB_ASTRO,
34
- GLOB_CSS: () => GLOB_CSS,
35
- GLOB_EXCLUDE: () => GLOB_EXCLUDE,
36
- GLOB_HTML: () => GLOB_HTML,
37
- GLOB_JS: () => GLOB_JS,
38
- GLOB_JSON: () => GLOB_JSON,
39
- GLOB_JSON5: () => GLOB_JSON5,
40
- GLOB_JSONC: () => GLOB_JSONC,
41
- GLOB_JSX: () => GLOB_JSX,
42
- GLOB_JSX_EXT: () => GLOB_JSX_EXT,
43
- GLOB_LESS: () => GLOB_LESS,
44
- GLOB_MARKDOWN: () => GLOB_MARKDOWN,
45
- GLOB_MARKDOWN_CODE: () => GLOB_MARKDOWN_CODE,
46
- GLOB_NEXTJS_OG: () => GLOB_NEXTJS_OG,
47
- GLOB_NEXTJS_ROUTES: () => GLOB_NEXTJS_ROUTES,
48
- GLOB_SCSS: () => GLOB_SCSS,
49
- GLOB_SRC: () => GLOB_SRC,
50
- GLOB_SRC_EXT: () => GLOB_SRC_EXT,
51
- GLOB_STYLE: () => GLOB_STYLE,
52
- GLOB_TESTS: () => GLOB_TESTS,
53
- GLOB_TS: () => GLOB_TS,
54
- GLOB_VUE: () => GLOB_VUE,
55
- GLOB_YAML: () => GLOB_YAML,
56
33
  astro: () => astro,
57
34
  comments: () => comments,
35
+ default: () => src_default,
36
+ formatters: () => formatters,
58
37
  ignores: () => ignores,
59
38
  imports: () => imports,
60
39
  javascript: () => javascript,
@@ -79,16 +58,13 @@ __export(src_exports, {
79
58
  });
80
59
  module.exports = __toCommonJS(src_exports);
81
60
 
82
- // src/plugins.ts
83
- var import_eslint_plugin_antfu = __toESM(require("eslint-plugin-antfu"), 1);
84
- var import_eslint_plugin_eslint_comments = __toESM(require("eslint-plugin-eslint-comments"), 1);
85
- var pluginImport = __toESM(require("eslint-plugin-i"), 1);
86
- var import_eslint_plugin_n = __toESM(require("eslint-plugin-n"), 1);
87
- var import_eslint_plugin_unicorn = __toESM(require("eslint-plugin-unicorn"), 1);
88
- var import_eslint_plugin_unused_imports = __toESM(require("eslint-plugin-unused-imports"), 1);
89
- var import_eslint_plugin_perfectionist = __toESM(require("eslint-plugin-perfectionist"), 1);
61
+ // src/factory.ts
62
+ var import_node_process3 = __toESM(require("process"), 1);
63
+ var import_node_fs = require("fs");
64
+ var import_local_pkg2 = require("local-pkg");
90
65
 
91
66
  // src/configs/comments.ts
67
+ var import_eslint_plugin_eslint_comments = __toESM(require("@eslint-community/eslint-plugin-eslint-comments"), 1);
92
68
  async function comments() {
93
69
  return [
94
70
  {
@@ -97,10 +73,71 @@ async function comments() {
97
73
  "eslint-comments": import_eslint_plugin_eslint_comments.default
98
74
  },
99
75
  rules: {
76
+ // https://github.com/eslint-community/eslint-plugin-eslint-comments/blob/main/docs/rules/disable-enable-pair.md
77
+ "eslint-comments/disable-enable-pair": "error",
78
+ // https://github.com/eslint-community/eslint-plugin-eslint-comments/blob/main/docs/rules/no-aggregating-enable.md
100
79
  "eslint-comments/no-aggregating-enable": "error",
80
+ // https://github.com/eslint-community/eslint-plugin-eslint-comments/blob/main/docs/rules/no-duplicate-disable.md
101
81
  "eslint-comments/no-duplicate-disable": "error",
82
+ // https://github.com/eslint-community/eslint-plugin-eslint-comments/blob/main/docs/rules/no-unlimited-disable.md
102
83
  "eslint-comments/no-unlimited-disable": "error",
103
- "eslint-comments/no-unused-enable": "error"
84
+ // Deprecated in favor of official reportUnusedDisableDirectives
85
+ // https://github.com/eslint-community/eslint-plugin-eslint-comments/issues/133
86
+ "eslint-comments/no-unused-enable": "off"
87
+ }
88
+ }
89
+ ];
90
+ }
91
+
92
+ // src/configs/unicorn.ts
93
+ var import_eslint_plugin_unicorn = __toESM(require("eslint-plugin-unicorn"), 1);
94
+ function unicorn() {
95
+ return [
96
+ {
97
+ name: "luxass:unicorn",
98
+ plugins: {
99
+ unicorn: import_eslint_plugin_unicorn.default
100
+ },
101
+ rules: {
102
+ // Pass error message when throwing errors
103
+ // https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/error-message.md
104
+ "unicorn/error-message": "error",
105
+ // Uppercase regex escapes
106
+ // https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/escape-case.md
107
+ "unicorn/escape-case": "error",
108
+ // Array.isArray instead of instanceof
109
+ // https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/no-instanceof-array.md
110
+ "unicorn/no-instanceof-array": "error",
111
+ // Ban `new Array` as `Array` constructor's params are ambiguous
112
+ // https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/no-new-array.md
113
+ "unicorn/no-new-array": "error",
114
+ // Prevent deprecated `new Buffer()`
115
+ // https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/no-new-buffer.md
116
+ "unicorn/no-new-buffer": "error",
117
+ // Lowercase number formatting for octal, hex, binary (0x1'error' instead of 0X1'error')
118
+ // https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/number-literal-case.md
119
+ "unicorn/number-literal-case": "error",
120
+ // textContent instead of innerText
121
+ // https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/prefer-dom-node-text-content.md
122
+ "unicorn/prefer-dom-node-text-content": "error",
123
+ // includes over indexOf when checking for existence
124
+ // https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/prefer-includes.md
125
+ "unicorn/prefer-includes": "error",
126
+ // Prefer using the node: protocol
127
+ // https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/prefer-node-protocol.md
128
+ "unicorn/prefer-node-protocol": "error",
129
+ // Prefer using number properties like `Number.isNaN` rather than `isNaN`
130
+ // https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/prefer-number-properties.md
131
+ "unicorn/prefer-number-properties": "error",
132
+ // String methods startsWith/endsWith instead of more complicated stuff
133
+ // https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/prefer-string-starts-ends-with.md
134
+ "unicorn/prefer-string-starts-ends-with": "error",
135
+ // Enforce throwing type error when throwing error while checking typeof
136
+ // https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/prefer-type-error.md
137
+ "unicorn/prefer-type-error": "error",
138
+ // Use new when throwing error
139
+ // https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/throw-new-error.md
140
+ "unicorn/throw-new-error": "error"
104
141
  }
105
142
  }
106
143
  ];
@@ -108,22 +145,22 @@ async function comments() {
108
145
 
109
146
  // src/globs.ts
110
147
  var GLOB_SRC_EXT = "?([cm])[jt]s?(x)";
111
- var GLOB_SRC = "**/*.?([cm])[jt]s?(x)";
112
- var GLOB_JS = "**/*.?([cm])js";
148
+ var GLOB_SRC = `**/*.${GLOB_SRC_EXT}`;
149
+ var GLOB_JSX = "**/*.?([cm])jsx";
113
150
  var GLOB_TS = "**/*.?([cm])ts";
114
- var GLOB_JSX_EXT = "[jt]sx";
115
- var GLOB_JSX = `**/*.${GLOB_JSX_EXT}`;
116
- var GLOB_STYLE = "**/*.{c,le,sc}ss";
151
+ var GLOB_TSX = "**/*.?([cm])tsx";
117
152
  var GLOB_CSS = "**/*.css";
153
+ var GLOB_POSTCSS = "**/*.{p,post}css";
118
154
  var GLOB_LESS = "**/*.less";
119
155
  var GLOB_SCSS = "**/*.scss";
120
156
  var GLOB_JSON = "**/*.json";
121
157
  var GLOB_JSON5 = "**/*.json5";
122
158
  var GLOB_JSONC = "**/*.jsonc";
123
159
  var GLOB_MARKDOWN = "**/*.md";
160
+ var GLOB_MARKDOWN_IN_MARKDOWN = "**/*.md/*.md";
124
161
  var GLOB_VUE = "**/*.vue";
125
162
  var GLOB_YAML = "**/*.y?(a)ml";
126
- var GLOB_HTML = "**/*.htm?(l)";
163
+ var GLOB_TOML = "**/*.toml";
127
164
  var GLOB_ASTRO = "**/*.astro";
128
165
  var GLOB_MARKDOWN_CODE = `${GLOB_MARKDOWN}/${GLOB_SRC}`;
129
166
  var GLOB_TESTS = [
@@ -134,9 +171,9 @@ var GLOB_TESTS = [
134
171
  `**/*.benchmark.${GLOB_SRC_EXT}`
135
172
  ];
136
173
  var GLOB_NEXTJS_OG = [
137
- `**/app/**/opengraph-image.${GLOB_JSX_EXT}`,
138
- `**/app/**/twitter-image.${GLOB_JSX_EXT}`,
139
- `**/app/**/route.${GLOB_JSX_EXT}`
174
+ `**/app/**/opengraph-image.[jt]s?(x)`,
175
+ `**/app/**/twitter-image.[jt]s?(x)`,
176
+ `**/app/**/route.[jt]s?(x)`
140
177
  ];
141
178
  var GLOB_NEXTJS_ROUTES = [
142
179
  `**/app/**/page.${GLOB_SRC_EXT}`,
@@ -192,7 +229,257 @@ function ignores() {
192
229
  ];
193
230
  }
194
231
 
232
+ // src/configs/node.ts
233
+ var import_eslint_plugin_n = __toESM(require("eslint-plugin-n"), 1);
234
+ function node() {
235
+ return [
236
+ {
237
+ name: "luxass:node",
238
+ plugins: {
239
+ node: import_eslint_plugin_n.default
240
+ },
241
+ rules: {
242
+ "node/handle-callback-err": ["error", "^(err|error)$"],
243
+ "node/no-deprecated-api": "error",
244
+ "node/no-exports-assign": "error",
245
+ "node/no-new-require": "error",
246
+ "node/no-path-concat": "error",
247
+ "node/prefer-global/buffer": ["error", "never"],
248
+ "node/prefer-global/process": ["error", "never"],
249
+ "node/process-exit-as-throw": "error"
250
+ }
251
+ }
252
+ ];
253
+ }
254
+
255
+ // src/configs/sort.ts
256
+ function sortPackageJson() {
257
+ return [
258
+ {
259
+ name: "luxass:sort-package-json",
260
+ files: ["**/package.json"],
261
+ rules: {
262
+ "jsonc/sort-array-values": [
263
+ "error",
264
+ {
265
+ order: { type: "asc" },
266
+ pathPattern: "^files$"
267
+ }
268
+ ],
269
+ "jsonc/sort-keys": [
270
+ "error",
271
+ {
272
+ order: [
273
+ "name",
274
+ "displayName",
275
+ "version",
276
+ "description",
277
+ "type",
278
+ "private",
279
+ "author",
280
+ "publisher",
281
+ "packageManager",
282
+ "license",
283
+ "funding",
284
+ "homepage",
285
+ "repository",
286
+ "bugs",
287
+ "keywords",
288
+ "categories",
289
+ "sideEffects",
290
+ "exports",
291
+ "main",
292
+ "module",
293
+ "unpkg",
294
+ "jsdelivr",
295
+ "types",
296
+ "typesVersions",
297
+ "bin",
298
+ "icon",
299
+ "files",
300
+ "engines",
301
+ "activationEvents",
302
+ "contributes",
303
+ "scripts",
304
+ "peerDependencies",
305
+ "peerDependenciesMeta",
306
+ "dependencies",
307
+ "optionalDependencies",
308
+ "devDependencies",
309
+ "pnpm",
310
+ "overrides",
311
+ "resolutions",
312
+ "husky",
313
+ "simple-git-hooks",
314
+ "lint-staged",
315
+ "eslintConfig"
316
+ ],
317
+ pathPattern: "^$"
318
+ },
319
+ {
320
+ order: { type: "asc" },
321
+ pathPattern: "^(?:dev|peer|optional|bundled)?[Dd]ependencies$"
322
+ },
323
+ {
324
+ order: { type: "asc" },
325
+ pathPattern: "^resolutions$"
326
+ },
327
+ {
328
+ order: { type: "asc" },
329
+ pathPattern: "^pnpm.overrides$"
330
+ },
331
+ {
332
+ order: ["types", "import", "require", "default"],
333
+ pathPattern: "^exports.*$"
334
+ }
335
+ ]
336
+ }
337
+ }
338
+ ];
339
+ }
340
+ function sortTsconfig() {
341
+ return [
342
+ {
343
+ name: "luxass:sort-tsconfig",
344
+ files: ["**/tsconfig.json", "**/tsconfig.*.json"],
345
+ rules: {
346
+ "jsonc/sort-keys": [
347
+ "error",
348
+ {
349
+ order: [
350
+ "extends",
351
+ "compilerOptions",
352
+ "references",
353
+ "files",
354
+ "include",
355
+ "exclude"
356
+ ],
357
+ pathPattern: "^$"
358
+ },
359
+ {
360
+ order: [
361
+ /* Projects */
362
+ "incremental",
363
+ "composite",
364
+ "tsBuildInfoFile",
365
+ "disableSourceOfProjectReferenceRedirect",
366
+ "disableSolutionSearching",
367
+ "disableReferencedProjectLoad",
368
+ /* Language and Environment */
369
+ "target",
370
+ "jsx",
371
+ "jsxFactory",
372
+ "jsxFragmentFactory",
373
+ "jsxImportSource",
374
+ "lib",
375
+ "moduleDetection",
376
+ "noLib",
377
+ "reactNamespace",
378
+ "useDefineForClassFields",
379
+ "emitDecoratorMetadata",
380
+ "experimentalDecorators",
381
+ /* Modules */
382
+ "baseUrl",
383
+ "rootDir",
384
+ "rootDirs",
385
+ "customConditions",
386
+ "module",
387
+ "moduleResolution",
388
+ "moduleSuffixes",
389
+ "noResolve",
390
+ "paths",
391
+ "resolveJsonModule",
392
+ "resolvePackageJsonExports",
393
+ "resolvePackageJsonImports",
394
+ "typeRoots",
395
+ "types",
396
+ "allowArbitraryExtensions",
397
+ "allowImportingTsExtensions",
398
+ "allowUmdGlobalAccess",
399
+ /* JavaScript Support */
400
+ "allowJs",
401
+ "checkJs",
402
+ "maxNodeModuleJsDepth",
403
+ /* Type Checking */
404
+ "strict",
405
+ "strictBindCallApply",
406
+ "strictFunctionTypes",
407
+ "strictNullChecks",
408
+ "strictPropertyInitialization",
409
+ "allowUnreachableCode",
410
+ "allowUnusedLabels",
411
+ "alwaysStrict",
412
+ "exactOptionalPropertyTypes",
413
+ "noFallthroughCasesInSwitch",
414
+ "noImplicitAny",
415
+ "noImplicitOverride",
416
+ "noImplicitReturns",
417
+ "noImplicitThis",
418
+ "noPropertyAccessFromIndexSignature",
419
+ "noUncheckedIndexedAccess",
420
+ "noUnusedLocals",
421
+ "noUnusedParameters",
422
+ "useUnknownInCatchVariables",
423
+ /* Emit */
424
+ "declaration",
425
+ "declarationDir",
426
+ "declarationMap",
427
+ "downlevelIteration",
428
+ "emitBOM",
429
+ "emitDeclarationOnly",
430
+ "importHelpers",
431
+ "importsNotUsedAsValues",
432
+ "inlineSourceMap",
433
+ "inlineSources",
434
+ "mapRoot",
435
+ "newLine",
436
+ "noEmit",
437
+ "noEmitHelpers",
438
+ "noEmitOnError",
439
+ "outDir",
440
+ "outFile",
441
+ "preserveConstEnums",
442
+ "preserveValueImports",
443
+ "removeComments",
444
+ "sourceMap",
445
+ "sourceRoot",
446
+ "stripInternal",
447
+ /* Interop Constraints */
448
+ "allowSyntheticDefaultImports",
449
+ "esModuleInterop",
450
+ "forceConsistentCasingInFileNames",
451
+ "isolatedModules",
452
+ "preserveSymlinks",
453
+ "verbatimModuleSyntax",
454
+ /* Completeness */
455
+ "skipDefaultLibCheck",
456
+ "skipLibCheck"
457
+ ],
458
+ pathPattern: "^compilerOptions$"
459
+ }
460
+ ]
461
+ }
462
+ }
463
+ ];
464
+ }
465
+
466
+ // src/configs/perfectionist.ts
467
+ var import_eslint_plugin_perfectionist = __toESM(require("eslint-plugin-perfectionist"), 1);
468
+ async function perfectionist() {
469
+ return [
470
+ {
471
+ name: "luxass:perfectionist",
472
+ plugins: {
473
+ perfectionist: import_eslint_plugin_perfectionist.default
474
+ },
475
+ rules: {}
476
+ }
477
+ ];
478
+ }
479
+
195
480
  // src/configs/imports.ts
481
+ var import_eslint_plugin_i = __toESM(require("eslint-plugin-i"), 1);
482
+ var import_eslint_plugin_antfu = __toESM(require("eslint-plugin-antfu"), 1);
196
483
  async function imports(options = {}) {
197
484
  const {
198
485
  stylistic: stylistic2 = true
@@ -202,10 +489,11 @@ async function imports(options = {}) {
202
489
  name: "luxass:imports",
203
490
  plugins: {
204
491
  antfu: import_eslint_plugin_antfu.default,
205
- import: pluginImport
492
+ import: import_eslint_plugin_i.default
206
493
  },
207
494
  rules: {
208
495
  "antfu/import-dedupe": "error",
496
+ "antfu/no-import-dist": "error",
209
497
  "antfu/no-import-node-modules-by-path": "error",
210
498
  "import/first": "error",
211
499
  "import/no-duplicates": "error",
@@ -218,16 +506,27 @@ async function imports(options = {}) {
218
506
  "import/newline-after-import": ["error", { considerComments: true, count: 1 }]
219
507
  } : {}
220
508
  }
509
+ },
510
+ {
511
+ name: "luxass:imports:bin",
512
+ files: ["**/bin/**/*", `**/bin.${GLOB_SRC_EXT}`],
513
+ rules: {
514
+ "antfu/no-import-dist": "off",
515
+ "antfu/no-import-node-modules-by-path": "off"
516
+ }
221
517
  }
222
518
  ];
223
519
  }
224
520
 
225
521
  // src/configs/javascript.ts
226
522
  var import_globals = __toESM(require("globals"), 1);
523
+ var import_eslint_plugin_unused_imports = __toESM(require("eslint-plugin-unused-imports"), 1);
524
+ var import_eslint_plugin_antfu2 = __toESM(require("eslint-plugin-antfu"), 1);
227
525
  async function javascript(options = {}) {
228
- const { isEditor = false, overrides = {} } = options;
526
+ const { editor = false, overrides = {} } = options;
229
527
  return [
230
528
  {
529
+ name: "luxass:javascript",
231
530
  languageOptions: {
232
531
  ecmaVersion: 2022,
233
532
  globals: {
@@ -250,9 +549,8 @@ async function javascript(options = {}) {
250
549
  linterOptions: {
251
550
  reportUnusedDisableDirectives: true
252
551
  },
253
- name: "luxass:javascript",
254
552
  plugins: {
255
- "antfu": import_eslint_plugin_antfu.default,
553
+ "antfu": import_eslint_plugin_antfu2.default,
256
554
  "unused-imports": import_eslint_plugin_unused_imports.default
257
555
  },
258
556
  rules: {
@@ -279,7 +577,7 @@ async function javascript(options = {}) {
279
577
  "no-compare-neg-zero": "error",
280
578
  "no-cond-assign": ["error", "always"],
281
579
  "no-console": [
282
- isEditor ? "off" : "error",
580
+ editor ? "off" : "error",
283
581
  { allow: ["warn", "error"] }
284
582
  ],
285
583
  "no-const-assign": "error",
@@ -326,8 +624,8 @@ async function javascript(options = {}) {
326
624
  "no-regex-spaces": "error",
327
625
  "no-restricted-globals": [
328
626
  "error",
329
- { message: "Use `globalThis` instead.", name: "global" },
330
- { message: "Use `globalThis` instead.", name: "self" }
627
+ { name: "global", message: "Use `globalThis` instead." },
628
+ { name: "self", message: "Use `globalThis` instead." }
331
629
  ],
332
630
  "no-restricted-properties": [
333
631
  "error",
@@ -448,7 +746,7 @@ async function javascript(options = {}) {
448
746
  ],
449
747
  "symbol-description": "error",
450
748
  "unicode-bom": ["error", "never"],
451
- "unused-imports/no-unused-imports": isEditor ? "off" : "error",
749
+ "unused-imports/no-unused-imports": editor ? "off" : "error",
452
750
  "unused-imports/no-unused-vars": [
453
751
  "error",
454
752
  {
@@ -469,8 +767,8 @@ async function javascript(options = {}) {
469
767
  }
470
768
  },
471
769
  {
472
- files: [`scripts/${GLOB_SRC}`, `cli.${GLOB_SRC_EXT}`],
473
770
  name: "luxass:scripts-overrides",
771
+ files: [`scripts/${GLOB_SRC}`, `cli.${GLOB_SRC_EXT}`],
474
772
  rules: {
475
773
  "no-console": "off"
476
774
  }
@@ -515,8 +813,8 @@ async function ensure(packages) {
515
813
  const { default: prompts } = await import("prompts");
516
814
  const { result } = await prompts([
517
815
  {
518
- message: `${nonExistingPackages.length === 1 ? "Package is" : "Packages are"} required for this config: ${nonExistingPackages.join(", ")}. Do you want to install them?`,
519
816
  name: "result",
817
+ message: `${nonExistingPackages.length === 1 ? "Package is" : "Packages are"} required for this config: ${nonExistingPackages.join(", ")}. Do you want to install them?`,
520
818
  type: "confirm"
521
819
  }
522
820
  ]);
@@ -527,10 +825,22 @@ async function ensure(packages) {
527
825
  }
528
826
  ;
529
827
  }
828
+ function resolveSubOptions(options, key) {
829
+ return typeof options[key] === "boolean" ? {} : options[key] || {};
830
+ }
831
+ function getOverrides(options, key) {
832
+ const sub = resolveSubOptions(options, key);
833
+ return {
834
+ ..."overrides" in sub ? sub.overrides : {}
835
+ };
836
+ }
530
837
 
531
838
  // src/configs/jsdoc.ts
532
839
  async function jsdoc(options = {}) {
533
- const { stylistic: stylistic2 = true } = options;
840
+ const {
841
+ overrides,
842
+ stylistic: stylistic2 = true
843
+ } = options;
534
844
  return [
535
845
  {
536
846
  name: "luxass:jsdoc",
@@ -556,7 +866,8 @@ async function jsdoc(options = {}) {
556
866
  ...stylistic2 ? {
557
867
  "jsdoc/check-alignment": "warn",
558
868
  "jsdoc/multiline-blocks": "warn"
559
- } : {}
869
+ } : {},
870
+ ...overrides
560
871
  }
561
872
  }
562
873
  ];
@@ -564,7 +875,11 @@ async function jsdoc(options = {}) {
564
875
 
565
876
  // src/configs/jsonc.ts
566
877
  async function jsonc(options = {}) {
567
- const { overrides = {}, stylistic: stylistic2 = true } = options;
878
+ const {
879
+ files = [GLOB_JSON, GLOB_JSON5, GLOB_JSONC],
880
+ overrides = {},
881
+ stylistic: stylistic2 = true
882
+ } = options;
568
883
  const [
569
884
  pluginJsonc,
570
885
  parserJsonc
@@ -580,11 +895,11 @@ async function jsonc(options = {}) {
580
895
  }
581
896
  },
582
897
  {
583
- files: [GLOB_JSON, GLOB_JSON5, GLOB_JSONC],
898
+ name: "luxass:jsonc:rules",
899
+ files,
584
900
  languageOptions: {
585
901
  parser: parserJsonc
586
902
  },
587
- name: "luxass:jsonc:rules",
588
903
  rules: {
589
904
  "jsonc/no-bigint-literals": "error",
590
905
  "jsonc/no-binary-expression": "error",
@@ -640,24 +955,46 @@ async function jsonc(options = {}) {
640
955
  }
641
956
 
642
957
  // src/configs/markdown.ts
958
+ var parserPlain = __toESM(require("eslint-parser-plain"), 1);
959
+ var import_eslint_merge_processors = require("eslint-merge-processors");
643
960
  async function markdown(options = {}) {
644
- const { componentExts = [], overrides = {} } = options;
961
+ const {
962
+ exts = [],
963
+ files = [GLOB_MARKDOWN],
964
+ overrides = {}
965
+ } = options;
966
+ const markdown2 = await interop(import("eslint-plugin-markdown"));
645
967
  return [
646
968
  {
647
969
  name: "luxass:markdown:setup",
648
970
  plugins: {
649
- markdown: await interop(import("eslint-plugin-markdown"))
971
+ markdown: markdown2
650
972
  }
651
973
  },
652
974
  {
653
- files: [GLOB_MARKDOWN],
654
975
  name: "luxass:markdown:processor",
655
- processor: "markdown/markdown"
976
+ files,
977
+ ignores: [GLOB_MARKDOWN_IN_MARKDOWN],
978
+ // `eslint-plugin-markdown` only creates virtual files for code blocks,
979
+ // but not the markdown file itself. We use `eslint-merge-processors` to
980
+ // add a pass-through processor for the markdown file itself.
981
+ processor: (0, import_eslint_merge_processors.mergeProcessors)([
982
+ markdown2.processors.markdown,
983
+ import_eslint_merge_processors.processorPassThrough
984
+ ])
985
+ },
986
+ {
987
+ name: "luxass:markdown:parser",
988
+ files,
989
+ languageOptions: {
990
+ parser: parserPlain
991
+ }
656
992
  },
657
993
  {
994
+ name: "luxass:markdown:disables",
658
995
  files: [
659
996
  GLOB_MARKDOWN_CODE,
660
- ...componentExts.map((ext) => `${GLOB_MARKDOWN}/**/*.${ext}`)
997
+ ...exts.map((ext) => `${GLOB_MARKDOWN}/**/*.${ext}`)
661
998
  ],
662
999
  languageOptions: {
663
1000
  parserOptions: {
@@ -666,10 +1003,7 @@ async function markdown(options = {}) {
666
1003
  }
667
1004
  }
668
1005
  },
669
- name: "luxass:markdown:rules",
670
1006
  rules: {
671
- "antfu/no-cjs-exports": "off",
672
- "antfu/no-ts-export-equal": "off",
673
1007
  "import/newline-after-import": "off",
674
1008
  "no-alert": "off",
675
1009
  "no-console": "off",
@@ -679,277 +1013,58 @@ async function markdown(options = {}) {
679
1013
  "node/prefer-global/process": "off",
680
1014
  "style/comma-dangle": "off",
681
1015
  "style/eol-last": "off",
1016
+ // Type aware rules
1017
+ "ts/await-thenable": "off",
682
1018
  "ts/consistent-type-imports": "off",
1019
+ "ts/dot-notation": "off",
1020
+ "ts/no-floating-promises": "off",
1021
+ "ts/no-for-in-array": "off",
1022
+ "ts/no-implied-eval": "off",
1023
+ "ts/no-misused-promises": "off",
683
1024
  "ts/no-namespace": "off",
684
1025
  "ts/no-redeclare": "off",
685
1026
  "ts/no-require-imports": "off",
1027
+ "ts/no-throw-literal": "off",
1028
+ "ts/no-unnecessary-type-assertion": "off",
1029
+ "ts/no-unsafe-argument": "off",
1030
+ "ts/no-unsafe-assignment": "off",
1031
+ "ts/no-unsafe-call": "off",
1032
+ "ts/no-unsafe-member-access": "off",
1033
+ "ts/no-unsafe-return": "off",
686
1034
  "ts/no-unused-vars": "off",
687
1035
  "ts/no-use-before-define": "off",
688
1036
  "ts/no-var-requires": "off",
1037
+ "ts/restrict-plus-operands": "off",
1038
+ "ts/restrict-template-expressions": "off",
1039
+ "ts/unbound-method": "off",
689
1040
  "unicode-bom": "off",
690
1041
  "unused-imports/no-unused-imports": "off",
691
1042
  "unused-imports/no-unused-vars": "off",
692
- // Type aware rules
693
- ...{
694
- "ts/await-thenable": "off",
695
- "ts/dot-notation": "off",
696
- "ts/no-floating-promises": "off",
697
- "ts/no-for-in-array": "off",
698
- "ts/no-implied-eval": "off",
699
- "ts/no-misused-promises": "off",
700
- "ts/no-throw-literal": "off",
701
- "ts/no-unnecessary-type-assertion": "off",
702
- "ts/no-unsafe-argument": "off",
703
- "ts/no-unsafe-assignment": "off",
704
- "ts/no-unsafe-call": "off",
705
- "ts/no-unsafe-member-access": "off",
706
- "ts/no-unsafe-return": "off",
707
- "ts/restrict-plus-operands": "off",
708
- "ts/restrict-template-expressions": "off",
709
- "ts/unbound-method": "off"
710
- },
711
1043
  ...overrides
712
1044
  }
713
1045
  }
714
1046
  ];
715
1047
  }
716
1048
 
717
- // src/configs/node.ts
718
- function node() {
719
- return [
720
- {
721
- name: "luxass:node",
722
- plugins: {
723
- node: import_eslint_plugin_n.default
724
- },
725
- rules: {
726
- "node/handle-callback-err": ["error", "^(err|error)$"],
727
- "node/no-deprecated-api": "error",
728
- "node/no-exports-assign": "error",
729
- "node/no-new-require": "error",
730
- "node/no-path-concat": "error",
731
- "node/prefer-global/buffer": ["error", "never"],
732
- "node/prefer-global/process": ["error", "never"],
733
- "node/process-exit-as-throw": "error"
734
- }
735
- }
736
- ];
737
- }
738
-
739
- // src/configs/sort.ts
740
- function sortPackageJson() {
741
- return [
742
- {
743
- files: ["**/package.json"],
744
- name: "luxass:sort-package-json",
745
- rules: {
746
- "jsonc/sort-array-values": [
747
- "error",
748
- {
749
- order: { type: "asc" },
750
- pathPattern: "^files$"
751
- }
752
- ],
753
- "jsonc/sort-keys": [
754
- "error",
755
- {
756
- order: [
757
- "publisher",
758
- "name",
759
- "displayName",
760
- "type",
761
- "version",
762
- "private",
763
- "packageManager",
764
- "description",
765
- "author",
766
- "license",
767
- "funding",
768
- "homepage",
769
- "repository",
770
- "bugs",
771
- "keywords",
772
- "categories",
773
- "sideEffects",
774
- "exports",
775
- "main",
776
- "module",
777
- "unpkg",
778
- "jsdelivr",
779
- "types",
780
- "typesVersions",
781
- "bin",
782
- "icon",
783
- "files",
784
- "engines",
785
- "activationEvents",
786
- "contributes",
787
- "scripts",
788
- "peerDependencies",
789
- "peerDependenciesMeta",
790
- "dependencies",
791
- "optionalDependencies",
792
- "devDependencies",
793
- "pnpm",
794
- "overrides",
795
- "resolutions",
796
- "husky",
797
- "simple-git-hooks",
798
- "lint-staged",
799
- "eslintConfig"
800
- ],
801
- pathPattern: "^$"
802
- },
803
- {
804
- order: { type: "asc" },
805
- pathPattern: "^(?:dev|peer|optional|bundled)?[Dd]ependencies$"
806
- },
807
- {
808
- order: { type: "asc" },
809
- pathPattern: "^resolutions$"
810
- },
811
- {
812
- order: { type: "asc" },
813
- pathPattern: "^pnpm.overrides$"
814
- },
815
- {
816
- order: ["types", "import", "require", "default"],
817
- pathPattern: "^exports.*$"
818
- }
819
- ]
820
- }
821
- }
822
- ];
823
- }
824
- function sortTsconfig() {
825
- return [
826
- {
827
- files: ["**/tsconfig.json", "**/tsconfig.*.json"],
828
- name: "luxass:sort-tsconfig",
829
- rules: {
830
- "jsonc/sort-keys": [
831
- "error",
832
- {
833
- order: [
834
- "extends",
835
- "compilerOptions",
836
- "references",
837
- "files",
838
- "include",
839
- "exclude"
840
- ],
841
- pathPattern: "^$"
842
- },
843
- {
844
- order: [
845
- /* Projects */
846
- "incremental",
847
- "composite",
848
- "tsBuildInfoFile",
849
- "disableSourceOfProjectReferenceRedirect",
850
- "disableSolutionSearching",
851
- "disableReferencedProjectLoad",
852
- /* Language and Environment */
853
- "target",
854
- "jsx",
855
- "jsxFactory",
856
- "jsxFragmentFactory",
857
- "jsxImportSource",
858
- "lib",
859
- "moduleDetection",
860
- "noLib",
861
- "reactNamespace",
862
- "useDefineForClassFields",
863
- "emitDecoratorMetadata",
864
- "experimentalDecorators",
865
- /* Modules */
866
- "baseUrl",
867
- "rootDir",
868
- "rootDirs",
869
- "customConditions",
870
- "module",
871
- "moduleResolution",
872
- "moduleSuffixes",
873
- "noResolve",
874
- "paths",
875
- "resolveJsonModule",
876
- "resolvePackageJsonExports",
877
- "resolvePackageJsonImports",
878
- "typeRoots",
879
- "types",
880
- "allowArbitraryExtensions",
881
- "allowImportingTsExtensions",
882
- "allowUmdGlobalAccess",
883
- /* JavaScript Support */
884
- "allowJs",
885
- "checkJs",
886
- "maxNodeModuleJsDepth",
887
- /* Type Checking */
888
- "strict",
889
- "strictBindCallApply",
890
- "strictFunctionTypes",
891
- "strictNullChecks",
892
- "strictPropertyInitialization",
893
- "allowUnreachableCode",
894
- "allowUnusedLabels",
895
- "alwaysStrict",
896
- "exactOptionalPropertyTypes",
897
- "noFallthroughCasesInSwitch",
898
- "noImplicitAny",
899
- "noImplicitOverride",
900
- "noImplicitReturns",
901
- "noImplicitThis",
902
- "noPropertyAccessFromIndexSignature",
903
- "noUncheckedIndexedAccess",
904
- "noUnusedLocals",
905
- "noUnusedParameters",
906
- "useUnknownInCatchVariables",
907
- /* Emit */
908
- "declaration",
909
- "declarationDir",
910
- "declarationMap",
911
- "downlevelIteration",
912
- "emitBOM",
913
- "emitDeclarationOnly",
914
- "importHelpers",
915
- "importsNotUsedAsValues",
916
- "inlineSourceMap",
917
- "inlineSources",
918
- "mapRoot",
919
- "newLine",
920
- "noEmit",
921
- "noEmitHelpers",
922
- "noEmitOnError",
923
- "outDir",
924
- "outFile",
925
- "preserveConstEnums",
926
- "preserveValueImports",
927
- "removeComments",
928
- "sourceMap",
929
- "sourceRoot",
930
- "stripInternal",
931
- /* Interop Constraints */
932
- "allowSyntheticDefaultImports",
933
- "esModuleInterop",
934
- "forceConsistentCasingInFileNames",
935
- "isolatedModules",
936
- "preserveSymlinks",
937
- "verbatimModuleSyntax",
938
- /* Completeness */
939
- "skipDefaultLibCheck",
940
- "skipLibCheck"
941
- ],
942
- pathPattern: "^compilerOptions$"
943
- }
944
- ]
945
- }
946
- }
947
- ];
948
- }
949
-
950
1049
  // src/configs/stylistic.ts
1050
+ var import_eslint_plugin_antfu3 = __toESM(require("eslint-plugin-antfu"), 1);
1051
+ var StylisticConfigDefaults = {
1052
+ indent: 2,
1053
+ jsx: true,
1054
+ quotes: "double",
1055
+ semi: true
1056
+ };
951
1057
  async function stylistic(options = {}) {
952
- const { indent = 2, jsx = true, quotes = "double", semi = true } = options;
1058
+ const {
1059
+ indent,
1060
+ jsx,
1061
+ overrides = {},
1062
+ quotes,
1063
+ semi
1064
+ } = {
1065
+ ...StylisticConfigDefaults,
1066
+ ...options
1067
+ };
953
1068
  const pluginStylistic = await interop(import("@stylistic/eslint-plugin"));
954
1069
  const config = pluginStylistic.configs.customize({
955
1070
  flat: true,
@@ -963,18 +1078,18 @@ async function stylistic(options = {}) {
963
1078
  {
964
1079
  name: "luxass:stylistic",
965
1080
  plugins: {
966
- antfu: import_eslint_plugin_antfu.default,
1081
+ antfu: import_eslint_plugin_antfu3.default,
967
1082
  style: pluginStylistic
968
1083
  },
969
1084
  rules: {
970
1085
  ...config.rules,
971
1086
  "antfu/consistent-list-newline": "error",
972
1087
  "antfu/if-newline": "off",
973
- "antfu/indent-binary-ops": ["error", { indent }],
974
1088
  "antfu/top-level-function": "error",
975
1089
  "curly": ["error", "multi-line", "consistent"],
976
1090
  "style/arrow-parens": ["error", "always", { requireForBlockBody: true }],
977
- "style/brace-style": ["error", "1tbs", { allowSingleLine: true }]
1091
+ "style/brace-style": ["error", "1tbs", { allowSingleLine: true }],
1092
+ ...overrides
978
1093
  }
979
1094
  }
980
1095
  ];
@@ -982,9 +1097,10 @@ async function stylistic(options = {}) {
982
1097
 
983
1098
  // src/configs/typescript.ts
984
1099
  var import_node_process2 = __toESM(require("process"), 1);
985
- async function typescript(options) {
1100
+ var import_eslint_plugin_antfu4 = __toESM(require("eslint-plugin-antfu"), 1);
1101
+ async function typescript(options = {}) {
986
1102
  const {
987
- componentExts = [],
1103
+ exts = [],
988
1104
  overrides = {},
989
1105
  parserOptions = {}
990
1106
  } = options ?? {};
@@ -1009,6 +1125,11 @@ async function typescript(options) {
1009
1125
  "ts/restrict-template-expressions": "error",
1010
1126
  "ts/unbound-method": "error"
1011
1127
  };
1128
+ const files = options.files ?? [
1129
+ GLOB_SRC,
1130
+ ...exts.map((ext) => `**/*.${ext}`)
1131
+ ];
1132
+ const filesTypeAware = options.typeAwareFileS ?? [GLOB_TS, GLOB_TSX];
1012
1133
  const tsconfigPath = options?.tsconfigPath ? toArray(options.tsconfigPath) : void 0;
1013
1134
  const [
1014
1135
  pluginTs,
@@ -1022,16 +1143,17 @@ async function typescript(options) {
1022
1143
  // Install the plugins without globs, so they can be configured separately.
1023
1144
  name: "luxass:typescript:setup",
1024
1145
  plugins: {
1025
- antfu: import_eslint_plugin_antfu.default,
1146
+ antfu: import_eslint_plugin_antfu4.default,
1026
1147
  ts: pluginTs
1027
1148
  }
1028
1149
  },
1029
1150
  {
1030
- files: [GLOB_SRC, ...componentExts.map((ext) => `**/*.${ext}`)],
1151
+ name: "luxass:typescript:rules",
1152
+ files,
1031
1153
  languageOptions: {
1032
1154
  parser: parserTs,
1033
1155
  parserOptions: {
1034
- extraFileExtensions: componentExts.map((ext) => `.${ext}`),
1156
+ extraFileExtensions: exts.map((ext) => `.${ext}`),
1035
1157
  sourceType: "module",
1036
1158
  ...tsconfigPath ? {
1037
1159
  project: tsconfigPath,
@@ -1040,7 +1162,6 @@ async function typescript(options) {
1040
1162
  ...parserOptions
1041
1163
  }
1042
1164
  },
1043
- name: "luxass:typescript:rules",
1044
1165
  rules: {
1045
1166
  ...renameRules(
1046
1167
  pluginTs.configs["eslint-recommended"].overrides[0].rules,
@@ -1052,9 +1173,6 @@ async function typescript(options) {
1052
1173
  "@typescript-eslint/",
1053
1174
  "ts/"
1054
1175
  ),
1055
- "antfu/generic-spacing": "error",
1056
- "antfu/named-tuple-spacing": "error",
1057
- "antfu/no-cjs-exports": "error",
1058
1176
  "no-dupe-class-members": "off",
1059
1177
  "no-invalid-this": "off",
1060
1178
  "no-loss-of-precision": "off",
@@ -1068,41 +1186,34 @@ async function typescript(options) {
1068
1186
  "ts/ban-types": ["error", {
1069
1187
  extendDefaults: false,
1070
1188
  types: {
1071
- "BigInt": {
1189
+ BigInt: {
1072
1190
  fixWith: "bigint",
1073
1191
  message: "Use `bigint` instead."
1074
1192
  },
1075
- "Boolean": {
1193
+ Boolean: {
1076
1194
  fixWith: "boolean",
1077
1195
  message: "Use `boolean` instead."
1078
1196
  },
1079
- "Function": "Use a specific function type instead, like `() => void`.",
1080
- "Number": {
1197
+ Function: "Use a specific function type instead, like `() => void`.",
1198
+ Number: {
1081
1199
  fixWith: "number",
1082
1200
  message: "Use `number` instead."
1083
1201
  },
1084
- "Object": {
1202
+ Object: {
1085
1203
  fixWith: "Record<string, unknown>",
1086
1204
  message: "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"
1087
1205
  },
1088
- "String": {
1206
+ String: {
1089
1207
  fixWith: "string",
1090
1208
  message: "Use `string` instead."
1091
1209
  },
1092
- "Symbol": {
1210
+ Symbol: {
1093
1211
  fixWith: "symbol",
1094
1212
  message: "Use `symbol` instead."
1095
1213
  },
1096
- "[]": {
1097
- message: "Don't use the empty array type `[]`. It only allows empty arrays. Use `SomeType[]` instead."
1098
- },
1099
- "object": {
1214
+ object: {
1100
1215
  fixWith: "Record<string, unknown>",
1101
1216
  message: "The `object` type is hard to use. Use `Record<string, unknown>` instead. See: https://github.com/typescript-eslint/typescript-eslint/pull/848"
1102
- },
1103
- "{}": {
1104
- fixWith: "Record<string, unknown>",
1105
- message: "The `{}` type is mostly the same as `unknown`. You probably want `Record<string, unknown>` instead."
1106
1217
  }
1107
1218
  }
1108
1219
  }],
@@ -1131,13 +1242,20 @@ async function typescript(options) {
1131
1242
  "ts/prefer-ts-expect-error": "error",
1132
1243
  "ts/triple-slash-reference": "off",
1133
1244
  "ts/unified-signatures": "off",
1245
+ ...overrides
1246
+ }
1247
+ },
1248
+ {
1249
+ name: "luxass:typescript:rules-type-aware",
1250
+ files: filesTypeAware,
1251
+ rules: {
1134
1252
  ...tsconfigPath ? typeAwareRules : {},
1135
1253
  ...overrides
1136
1254
  }
1137
1255
  },
1138
1256
  {
1139
- files: ["**/*.d.ts"],
1140
1257
  name: "luxass:typescript:dts-overrides",
1258
+ files: ["**/*.d.ts"],
1141
1259
  rules: {
1142
1260
  "eslint-comments/no-unlimited-disable": "off",
1143
1261
  "import/no-duplicates": "off",
@@ -1146,15 +1264,15 @@ async function typescript(options) {
1146
1264
  }
1147
1265
  },
1148
1266
  {
1149
- files: ["**/*.{test,spec}.ts?(x)"],
1150
1267
  name: "luxass:typescript:tests-overrides",
1268
+ files: ["**/*.{test,spec}.ts?(x)"],
1151
1269
  rules: {
1152
1270
  "no-unused-expressions": "off"
1153
1271
  }
1154
1272
  },
1155
1273
  {
1156
- files: ["**/*.js", "**/*.cjs"],
1157
1274
  name: "luxass:typescript:javascript-overrides",
1275
+ files: ["**/*.js", "**/*.cjs"],
1158
1276
  rules: {
1159
1277
  "ts/no-require-imports": "off",
1160
1278
  "ts/no-var-requires": "off"
@@ -1163,56 +1281,27 @@ async function typescript(options) {
1163
1281
  ];
1164
1282
  }
1165
1283
 
1166
- // src/configs/unicorn.ts
1167
- function unicorn() {
1168
- return [
1169
- {
1170
- name: "luxass:unicorn",
1171
- plugins: {
1172
- unicorn: import_eslint_plugin_unicorn.default
1173
- },
1174
- rules: {
1175
- // Pass error message when throwing errors
1176
- "unicorn/error-message": "error",
1177
- // Uppercase regex escapes
1178
- "unicorn/escape-case": "error",
1179
- // Array.isArray instead of instanceof
1180
- "unicorn/no-instanceof-array": "error",
1181
- // Ban `new Array` as `Array` constructor's params are ambiguous
1182
- "unicorn/no-new-array": "error",
1183
- // Prevent deprecated `new Buffer()`
1184
- "unicorn/no-new-buffer": "error",
1185
- // Lowercase number formatting for octal, hex, binary (0x1'error' instead of 0X1'error')
1186
- "unicorn/number-literal-case": "error",
1187
- // textContent instead of innerText
1188
- "unicorn/prefer-dom-node-text-content": "error",
1189
- // includes over indexOf when checking for existence
1190
- "unicorn/prefer-includes": "error",
1191
- // Prefer using the node: protocol
1192
- "unicorn/prefer-node-protocol": "error",
1193
- // Prefer using number properties like `Number.isNaN` rather than `isNaN`
1194
- "unicorn/prefer-number-properties": "error",
1195
- // String methods startsWith/endsWith instead of more complicated stuff
1196
- "unicorn/prefer-string-starts-ends-with": "error",
1197
- // Enforce throwing type error when throwing error while checking typeof
1198
- "unicorn/prefer-type-error": "error",
1199
- // Use new when throwing error
1200
- "unicorn/throw-new-error": "error"
1201
- }
1202
- }
1203
- ];
1204
- }
1205
-
1206
1284
  // src/configs/vue.ts
1285
+ var import_eslint_merge_processors2 = require("eslint-merge-processors");
1207
1286
  async function vue(options = {}) {
1208
- const { overrides = {}, stylistic: stylistic2 = true } = options;
1287
+ const {
1288
+ a11y = true,
1289
+ files = [GLOB_VUE],
1290
+ overrides = {},
1291
+ stylistic: stylistic2 = true
1292
+ } = options;
1209
1293
  const [
1210
1294
  pluginVue,
1211
- parserVue
1295
+ parserVue,
1296
+ processorVueBlocks,
1297
+ pluginA11y
1212
1298
  ] = await Promise.all([
1213
1299
  interop(import("eslint-plugin-vue")),
1214
- interop(import("vue-eslint-parser"))
1300
+ interop(import("vue-eslint-parser")),
1301
+ interop(import("eslint-processor-vue-blocks")),
1302
+ ...a11y ? [interop(import("eslint-plugin-vuejs-accessibility"))] : []
1215
1303
  ]);
1304
+ const sfcBlocks = options.sfcBlocks === true ? {} : options.sfcBlocks ?? {};
1216
1305
  const {
1217
1306
  indent = 2
1218
1307
  } = typeof stylistic2 === "boolean" ? {} : stylistic2;
@@ -1220,11 +1309,13 @@ async function vue(options = {}) {
1220
1309
  {
1221
1310
  name: "luxass:vue:setup",
1222
1311
  plugins: {
1223
- vue: pluginVue
1312
+ vue: pluginVue,
1313
+ ...a11y ? { "vue-a11y": pluginA11y } : {}
1224
1314
  }
1225
1315
  },
1226
1316
  {
1227
- files: [GLOB_VUE],
1317
+ name: "luxass:vue:rules",
1318
+ files,
1228
1319
  languageOptions: {
1229
1320
  parser: parserVue,
1230
1321
  parserOptions: {
@@ -1236,8 +1327,16 @@ async function vue(options = {}) {
1236
1327
  sourceType: "module"
1237
1328
  }
1238
1329
  },
1239
- name: "luxass:vue:rules",
1240
- processor: pluginVue.processors[".vue"],
1330
+ processor: sfcBlocks === false ? pluginVue.processors[".vue"] : (0, import_eslint_merge_processors2.mergeProcessors)([
1331
+ pluginVue.processors[".vue"],
1332
+ processorVueBlocks({
1333
+ ...sfcBlocks,
1334
+ blocks: {
1335
+ styles: true,
1336
+ ...sfcBlocks.blocks
1337
+ }
1338
+ })
1339
+ ]),
1241
1340
  rules: {
1242
1341
  ...pluginVue.configs.base.rules,
1243
1342
  ...pluginVue.configs["vue3-essential"].rules,
@@ -1346,6 +1445,28 @@ async function vue(options = {}) {
1346
1445
  "vue/space-in-parens": ["error", "never"],
1347
1446
  "vue/template-curly-spacing": "error"
1348
1447
  } : {},
1448
+ ...a11y ? {
1449
+ "vue-a11y/alt-text": "error",
1450
+ "vue-a11y/anchor-has-content": "error",
1451
+ "vue-a11y/aria-props": "error",
1452
+ "vue-a11y/aria-role": "error",
1453
+ "vue-a11y/aria-unsupported-elements": "error",
1454
+ "vue-a11y/click-events-have-key-events": "error",
1455
+ "vue-a11y/form-control-has-label": "error",
1456
+ "vue-a11y/heading-has-content": "error",
1457
+ "vue-a11y/iframe-has-title": "error",
1458
+ "vue-a11y/interactive-supports-focus": "error",
1459
+ "vue-a11y/label-has-for": "error",
1460
+ "vue-a11y/media-has-caption": "error",
1461
+ "vue-a11y/mouse-events-have-key-events": "error",
1462
+ "vue-a11y/no-access-key": "error",
1463
+ "vue-a11y/no-autofocus": "error",
1464
+ "vue-a11y/no-distracting-elements": "error",
1465
+ "vue-a11y/no-redundant-roles": "error",
1466
+ "vue-a11y/no-static-element-interactions": "error",
1467
+ "vue-a11y/role-has-required-aria-props": "error",
1468
+ "vue-a11y/tabindex-no-positive": "error"
1469
+ } : {},
1349
1470
  ...overrides
1350
1471
  }
1351
1472
  }
@@ -1354,7 +1475,11 @@ async function vue(options = {}) {
1354
1475
 
1355
1476
  // src/configs/yaml.ts
1356
1477
  async function yaml(options = {}) {
1357
- const { overrides = {}, stylistic: stylistic2 = true } = options;
1478
+ const {
1479
+ files = [GLOB_YAML],
1480
+ overrides = {},
1481
+ stylistic: stylistic2 = true
1482
+ } = options;
1358
1483
  const [
1359
1484
  pluginYaml,
1360
1485
  parserYaml
@@ -1374,16 +1499,17 @@ async function yaml(options = {}) {
1374
1499
  }
1375
1500
  },
1376
1501
  {
1377
- files: [GLOB_YAML],
1502
+ name: "luxass:yaml:rules",
1503
+ files,
1378
1504
  languageOptions: {
1379
1505
  parser: parserYaml
1380
1506
  },
1381
- name: "luxass:yaml:rules",
1382
1507
  rules: {
1383
1508
  "style/spaced-comment": "off",
1384
1509
  "yaml/block-mapping": "error",
1385
1510
  "yaml/block-sequence": "error",
1386
1511
  "yaml/no-empty-key": "error",
1512
+ "yaml/no-empty-mapping-value": "error",
1387
1513
  "yaml/no-empty-sequence-entry": "error",
1388
1514
  "yaml/no-irregular-whitespace": "error",
1389
1515
  "yaml/plain-scalar": "error",
@@ -1406,19 +1532,121 @@ async function yaml(options = {}) {
1406
1532
  } : {},
1407
1533
  ...overrides
1408
1534
  }
1535
+ },
1536
+ {
1537
+ name: "luxass:yaml:github-actions",
1538
+ files: ["**/.github/workflows/*.{yml,yaml}"],
1539
+ rules: {
1540
+ // GitHub Actions supports empty values to enable features
1541
+ "yaml/no-empty-mapping-value": "off"
1542
+ }
1409
1543
  }
1410
1544
  ];
1411
1545
  }
1412
1546
 
1547
+ // src/custom-rules/utils.ts
1548
+ var import_utils8 = require("@typescript-eslint/utils");
1549
+ var createRule = import_utils8.ESLintUtils.RuleCreator((ruleName) => `https://github.com/luxass/eslint-config/blob/main/src/custom-rules/${ruleName}/README.md`);
1550
+
1551
+ // src/custom-rules/no-only-tests/index.ts
1552
+ var DEFAULT_OPTIONS = {
1553
+ blocks: ["describe", "it", "test"],
1554
+ focus: ["only"]
1555
+ };
1556
+ function getPath(node2, path = []) {
1557
+ if (node2) {
1558
+ const nodeName = node2.name || node2.property && node2.property.name;
1559
+ if (node2.object) {
1560
+ return getPath(node2.object, [
1561
+ nodeName,
1562
+ ...path
1563
+ ]);
1564
+ }
1565
+ if (node2.callee)
1566
+ return getPath(node2.callee, path);
1567
+ return [nodeName, ...path];
1568
+ }
1569
+ return path;
1570
+ }
1571
+ var noOnlyTests = createRule({
1572
+ name: "no-only-tests",
1573
+ create: (context, [options]) => {
1574
+ const {
1575
+ blocks = DEFAULT_OPTIONS.blocks,
1576
+ focus = DEFAULT_OPTIONS.focus
1577
+ } = options;
1578
+ const handler = {
1579
+ Identifier(node2) {
1580
+ const parent = node2.parent?.object;
1581
+ if (!parent)
1582
+ return;
1583
+ if (!focus.includes(node2.name))
1584
+ return;
1585
+ const callPath = getPath(node2.parent).join(".");
1586
+ const found = blocks.find((block) => {
1587
+ if (block.endsWith("*"))
1588
+ return callPath.startsWith(block.replace(/\*$/, ""));
1589
+ return callPath.startsWith(`${block}.`);
1590
+ });
1591
+ if (found) {
1592
+ context.report({
1593
+ data: { block: callPath.split(".")[0], focus: node2.name },
1594
+ messageId: "notPermitted",
1595
+ node: node2
1596
+ });
1597
+ }
1598
+ }
1599
+ };
1600
+ return handler;
1601
+ },
1602
+ defaultOptions: [{
1603
+ blocks: ["describe", "it", "test"],
1604
+ focus: ["only"]
1605
+ }],
1606
+ meta: {
1607
+ docs: {
1608
+ description: "disallow .only blocks in tests",
1609
+ recommended: "recommended"
1610
+ },
1611
+ messages: {
1612
+ notPermitted: "{{ block }}.{{ focus }} not permitted"
1613
+ },
1614
+ schema: [{
1615
+ additionalProperties: false,
1616
+ properties: {
1617
+ blocks: {
1618
+ items: {
1619
+ type: "string"
1620
+ },
1621
+ type: "array",
1622
+ uniqueItems: true
1623
+ },
1624
+ focus: {
1625
+ items: {
1626
+ type: "string"
1627
+ },
1628
+ type: "array",
1629
+ uniqueItems: true
1630
+ }
1631
+ },
1632
+ type: "object"
1633
+ }],
1634
+ type: "layout"
1635
+ }
1636
+ // i need to have this here, otherwise typechecking fails.
1637
+ });
1638
+
1413
1639
  // src/configs/test.ts
1414
1640
  async function test(options = {}) {
1415
- const { isEditor = false, overrides = {} } = options;
1641
+ const {
1642
+ editor = false,
1643
+ files = GLOB_TESTS,
1644
+ overrides = {}
1645
+ } = options;
1416
1646
  const [
1417
- pluginVitest,
1418
- pluginNoOnlyTests
1647
+ pluginVitest
1419
1648
  ] = await Promise.all([
1420
- interop(import("eslint-plugin-vitest")),
1421
- interop(import("eslint-plugin-no-only-tests"))
1649
+ interop(import("eslint-plugin-vitest"))
1422
1650
  ]);
1423
1651
  return [
1424
1652
  {
@@ -1428,21 +1656,21 @@ async function test(options = {}) {
1428
1656
  ...pluginVitest,
1429
1657
  rules: {
1430
1658
  ...pluginVitest.rules,
1431
- ...pluginNoOnlyTests.rules
1659
+ "no-only-tests": noOnlyTests
1432
1660
  }
1433
1661
  }
1434
1662
  }
1435
1663
  },
1436
1664
  {
1437
- files: GLOB_TESTS,
1438
1665
  name: "luxass:test:rules",
1666
+ files,
1439
1667
  rules: {
1440
1668
  "test/consistent-test-it": [
1441
1669
  "error",
1442
1670
  { fn: "it", withinDescribe: "it" }
1443
1671
  ],
1444
1672
  "test/no-identical-title": "error",
1445
- "test/no-only-tests": isEditor ? "off" : "error",
1673
+ "test/no-only-tests": editor ? "off" : "error",
1446
1674
  "test/prefer-hooks-in-order": "error",
1447
1675
  "test/prefer-lowercase-title": "error",
1448
1676
  ...overrides
@@ -1451,107 +1679,38 @@ async function test(options = {}) {
1451
1679
  ];
1452
1680
  }
1453
1681
 
1454
- // src/configs/perfectionist.ts
1455
- async function perfectionist(options = {}) {
1456
- const { enableAllRules = false } = options;
1457
- return [
1458
- {
1459
- name: "luxass:perfectionist",
1460
- plugins: {
1461
- perfectionist: import_eslint_plugin_perfectionist.default
1462
- },
1463
- rules: {
1464
- ...enableAllRules ? {
1465
- ...import_eslint_plugin_perfectionist.default.configs["recommended-natural"].rules,
1466
- "perfectionist/sort-imports": "off",
1467
- // TODO: This rule should probably be enabled in favor of import/order?
1468
- "perfectionist/sort-vue-attributes": "off"
1469
- } : {}
1470
- }
1471
- }
1472
- ];
1473
- }
1474
-
1475
1682
  // src/configs/unocss.ts
1476
- async function unocss(options) {
1477
- const pluginUnoCSS = await interop(import("@unocss/eslint-plugin"));
1478
- const {
1479
- attributify = false,
1480
- overrides = {}
1481
- } = options;
1482
- return [
1483
- {
1484
- files: [
1485
- GLOB_SRC
1486
- ],
1487
- name: "luxass:unocss",
1488
- plugins: {
1489
- "@unocss": pluginUnoCSS
1490
- },
1491
- rules: {
1492
- "unocss/order": "error",
1493
- ...attributify && { "unocss/attributify": "error" },
1494
- "unocss/blocklist": "error",
1495
- // overrides
1496
- ...overrides
1497
- }
1498
- }
1499
- ];
1500
- }
1501
-
1502
- // src/configs/tailwindcss.ts
1503
- var DEFAULT_TAILWIND_CALLEES = ["classnames", "clsx", "cx", "cn"];
1504
- var DEFAULT_CLASS_REGEX = "^class(Name)?$";
1505
- async function tailwindcss(options = {}) {
1683
+ async function unocss(options = {}) {
1506
1684
  const {
1507
- callees = DEFAULT_TAILWIND_CALLEES,
1508
- classRegex = DEFAULT_CLASS_REGEX,
1509
- config = void 0,
1510
- nextjs: nextjs2,
1685
+ attributify = true,
1686
+ files = [GLOB_SRC],
1511
1687
  overrides,
1512
- removeDuplicates = true
1688
+ strict = false
1513
1689
  } = options;
1514
1690
  await ensure([
1515
- "eslint-plugin-tailwindcss"
1691
+ "@unocss/eslint-plugin"
1692
+ ]);
1693
+ const [
1694
+ pluginUnoCSS
1695
+ ] = await Promise.all([
1696
+ interop(import("@unocss/eslint-plugin"))
1516
1697
  ]);
1517
- const pluginTailwindCSS = await interop(import("eslint-plugin-tailwindcss"));
1518
- const tailwindCSSCallee = callees ?? DEFAULT_TAILWIND_CALLEES;
1519
1698
  return [
1520
1699
  {
1521
- name: "luxass:tailwindcss",
1700
+ name: "luxass:unocss",
1701
+ files,
1522
1702
  plugins: {
1523
- tailwindcss: pluginTailwindCSS
1524
- }
1525
- },
1526
- {
1527
- files: [GLOB_SRC, GLOB_HTML],
1528
- name: "luxass:tailwindcss:rules",
1529
- rules: {
1530
- "tailwindcss/classnames-order": ["error"],
1531
- "tailwindcss/enforces-negative-arbitrary-values": ["warn"],
1532
- "tailwindcss/enforces-shorthand": ["warn"],
1533
- "tailwindcss/migration-from-tailwind-2": ["warn"],
1534
- "tailwindcss/no-arbitrary-value": ["off"],
1535
- "tailwindcss/no-contradicting-classname": ["error"],
1536
- "tailwindcss/no-custom-classname": ["warn"],
1537
- // overrides
1538
- ...overrides
1703
+ unocss: pluginUnoCSS
1539
1704
  },
1540
- settings: {
1541
- tailwindcss: {
1542
- callees: tailwindCSSCallee,
1543
- classRegex: nextjs2 ? "^(class(Name)?|tw)$" : classRegex,
1544
- config,
1545
- removeDuplicates
1546
- }
1547
- }
1548
- },
1549
- {
1550
- files: ["**/tailwind.config.?([cm])[jt]s"],
1551
- name: "luxass:tailwindcss:sort-keys-override",
1552
1705
  rules: {
1553
- "sort-keys": "off",
1554
- "sort-keys/sort-keys-fix": "off"
1706
+ "unocss/order": "warn",
1707
+ ...attributify ? {
1708
+ "unocss/order-attributify": "warn"
1709
+ } : {},
1710
+ ...strict ? {
1711
+ "unocss/blocklist": "error"
1712
+ } : {},
1713
+ ...overrides
1555
1714
  }
1556
1715
  }
1557
1716
  ];
@@ -1559,7 +1718,11 @@ async function tailwindcss(options = {}) {
1559
1718
 
1560
1719
  // src/configs/nextjs.ts
1561
1720
  async function nextjs(options = {}) {
1562
- const { overrides, rootDir } = options;
1721
+ const {
1722
+ files = [GLOB_SRC],
1723
+ overrides,
1724
+ rootDir
1725
+ } = options;
1563
1726
  await ensure([
1564
1727
  "@next/eslint-plugin-next"
1565
1728
  ]);
@@ -1572,8 +1735,8 @@ async function nextjs(options = {}) {
1572
1735
  }
1573
1736
  },
1574
1737
  {
1575
- files: [GLOB_SRC],
1576
1738
  name: "luxass:nextjs:rules",
1739
+ files,
1577
1740
  rules: {
1578
1741
  ...pluginNextjs.configs.recommended.rules,
1579
1742
  ...pluginNextjs.configs["core-web-vitals"].rules,
@@ -1612,16 +1775,16 @@ async function nextjs(options = {}) {
1612
1775
  }
1613
1776
  },
1614
1777
  {
1615
- files: GLOB_NEXTJS_ROUTES,
1616
1778
  name: "luxass:nextjs:default-export-override",
1779
+ files: GLOB_NEXTJS_ROUTES,
1617
1780
  rules: {
1618
1781
  "import/prefer-default-export": "error",
1619
1782
  "react-refresh/only-export-components": "off"
1620
1783
  }
1621
1784
  },
1622
1785
  {
1623
- files: GLOB_NEXTJS_OG,
1624
1786
  name: "luxass:nextjs:og-override",
1787
+ files: GLOB_NEXTJS_OG,
1625
1788
  rules: {
1626
1789
  "@next/next/no-img-element": "off",
1627
1790
  "react/no-unknown-property": ["error", {
@@ -1629,244 +1792,242 @@ async function nextjs(options = {}) {
1629
1792
  }]
1630
1793
  }
1631
1794
  }
1632
- ];
1633
- }
1634
-
1635
- // src/configs/react.ts
1636
- async function react(options) {
1637
- const {
1638
- a11y = false,
1639
- overrides = {},
1640
- typescript: typescript2 = true
1641
- } = options;
1642
- await ensure([
1643
- "eslint-plugin-react",
1644
- "eslint-plugin-react-hooks",
1645
- "eslint-plugin-react-refresh",
1646
- ...options.a11y ? ["eslint-plugin-jsx-a11y"] : []
1647
- ]);
1648
- const [
1649
- pluginReact,
1650
- pluginReactHooks,
1651
- pluginReactRefresh,
1652
- pluginA11y
1653
- ] = await Promise.all([
1654
- interop(import("eslint-plugin-react")),
1655
- interop(import("eslint-plugin-react-hooks")),
1656
- interop(import("eslint-plugin-react-refresh")),
1657
- ...options.a11y ? [interop(import("eslint-plugin-jsx-a11y"))] : []
1658
- ]);
1659
- return [
1660
- {
1661
- name: "luxass:react:setup",
1662
- plugins: {
1663
- "react": pluginReact,
1664
- "react-hooks": pluginReactHooks,
1665
- "react-refresh": pluginReactRefresh,
1666
- ...a11y ? { "jsx-a11y": pluginA11y } : {}
1667
- }
1668
- },
1669
- {
1670
- files: [GLOB_JSX],
1671
- languageOptions: {
1672
- parserOptions: {
1673
- ecmaFeatures: {
1674
- jsx: true
1675
- }
1676
- }
1677
- },
1678
- name: "luxass:react:rules",
1679
- rules: {
1680
- // recommended rules for jsx-a11y
1681
- "jsx-a11y/alt-text": "error",
1682
- "jsx-a11y/anchor-ambiguous-text": "off",
1683
- "jsx-a11y/anchor-has-content": "error",
1684
- "jsx-a11y/anchor-is-valid": "error",
1685
- "jsx-a11y/aria-activedescendant-has-tabindex": "error",
1686
- "jsx-a11y/aria-props": "error",
1687
- "jsx-a11y/aria-proptypes": "error",
1688
- "jsx-a11y/aria-role": "error",
1689
- "jsx-a11y/aria-unsupported-elements": "error",
1690
- "jsx-a11y/autocomplete-valid": "error",
1691
- "jsx-a11y/click-events-have-key-events": "error",
1692
- "jsx-a11y/control-has-associated-label": [
1693
- "off",
1694
- {
1695
- ignoreElements: [
1696
- "audio",
1697
- "canvas",
1698
- "embed",
1699
- "input",
1700
- "textarea",
1701
- "tr",
1702
- "video"
1703
- ],
1704
- ignoreRoles: [
1705
- "grid",
1706
- "listbox",
1707
- "menu",
1708
- "menubar",
1709
- "radiogroup",
1710
- "row",
1711
- "tablist",
1712
- "toolbar",
1713
- "tree",
1714
- "treegrid"
1715
- ],
1716
- includeRoles: [
1717
- "alert",
1718
- "dialog"
1719
- ]
1720
- }
1721
- ],
1722
- "jsx-a11y/heading-has-content": "error",
1723
- "jsx-a11y/html-has-lang": "error",
1724
- "jsx-a11y/iframe-has-title": "error",
1725
- "jsx-a11y/img-redundant-alt": "error",
1726
- "jsx-a11y/interactive-supports-focus": [
1727
- "error",
1728
- {
1729
- tabbable: [
1730
- "button",
1731
- "checkbox",
1732
- "link",
1733
- "searchbox",
1734
- "spinbutton",
1735
- "switch",
1736
- "textbox"
1737
- ]
1738
- }
1739
- ],
1740
- "jsx-a11y/label-has-associated-control": "error",
1741
- "jsx-a11y/label-has-for": "off",
1742
- "jsx-a11y/media-has-caption": "error",
1743
- "jsx-a11y/mouse-events-have-key-events": "error",
1744
- "jsx-a11y/no-access-key": "error",
1745
- "jsx-a11y/no-autofocus": "error",
1746
- "jsx-a11y/no-distracting-elements": "error",
1747
- "jsx-a11y/no-interactive-element-to-noninteractive-role": [
1748
- "error",
1749
- {
1750
- canvas: [
1751
- "img"
1752
- ],
1753
- tr: [
1754
- "none",
1755
- "presentation"
1756
- ]
1757
- }
1758
- ],
1759
- "jsx-a11y/no-noninteractive-element-interactions": [
1760
- "error",
1761
- {
1762
- alert: [
1763
- "onKeyUp",
1764
- "onKeyDown",
1765
- "onKeyPress"
1766
- ],
1767
- body: [
1768
- "onError",
1769
- "onLoad"
1770
- ],
1771
- dialog: [
1772
- "onKeyUp",
1773
- "onKeyDown",
1774
- "onKeyPress"
1775
- ],
1776
- handlers: [
1777
- "onClick",
1778
- "onError",
1779
- "onLoad",
1780
- "onMouseDown",
1781
- "onMouseUp",
1782
- "onKeyPress",
1783
- "onKeyDown",
1784
- "onKeyUp"
1785
- ],
1786
- iframe: [
1787
- "onError",
1788
- "onLoad"
1789
- ],
1790
- img: [
1791
- "onError",
1792
- "onLoad"
1793
- ]
1794
- }
1795
- ],
1796
- "jsx-a11y/no-noninteractive-element-to-interactive-role": [
1797
- "error",
1798
- {
1799
- fieldset: [
1800
- "radiogroup",
1801
- "presentation"
1802
- ],
1803
- li: [
1804
- "menuitem",
1805
- "option",
1806
- "row",
1807
- "tab",
1808
- "treeitem"
1809
- ],
1810
- ol: [
1811
- "listbox",
1812
- "menu",
1813
- "menubar",
1814
- "radiogroup",
1815
- "tablist",
1816
- "tree",
1817
- "treegrid"
1818
- ],
1819
- table: [
1820
- "grid"
1821
- ],
1822
- td: [
1823
- "gridcell"
1824
- ],
1825
- ul: [
1826
- "listbox",
1827
- "menu",
1828
- "menubar",
1829
- "radiogroup",
1830
- "tablist",
1831
- "tree",
1832
- "treegrid"
1833
- ]
1834
- }
1835
- ],
1836
- "jsx-a11y/no-noninteractive-tabindex": [
1837
- "error",
1838
- {
1839
- allowExpressionValues: true,
1840
- roles: [
1841
- "tabpanel"
1842
- ],
1843
- tags: []
1844
- }
1845
- ],
1846
- "jsx-a11y/no-redundant-roles": "error",
1847
- "jsx-a11y/no-static-element-interactions": [
1848
- "error",
1849
- {
1850
- allowExpressionValues: true,
1851
- handlers: [
1852
- "onClick",
1853
- "onMouseDown",
1854
- "onMouseUp",
1855
- "onKeyPress",
1856
- "onKeyDown",
1857
- "onKeyUp"
1858
- ]
1795
+ ];
1796
+ }
1797
+
1798
+ // src/configs/react.ts
1799
+ async function react(options = {}) {
1800
+ const {
1801
+ a11y = false,
1802
+ files = [GLOB_JSX, GLOB_TSX],
1803
+ overrides = {},
1804
+ typescript: typescript2 = true
1805
+ } = options;
1806
+ await ensure([
1807
+ "eslint-plugin-react",
1808
+ "eslint-plugin-react-hooks",
1809
+ "eslint-plugin-react-refresh",
1810
+ ...options.a11y ? ["eslint-plugin-jsx-a11y"] : []
1811
+ ]);
1812
+ const [
1813
+ pluginReact,
1814
+ pluginReactHooks,
1815
+ pluginReactRefresh,
1816
+ pluginA11y
1817
+ ] = await Promise.all([
1818
+ interop(import("eslint-plugin-react")),
1819
+ interop(import("eslint-plugin-react-hooks")),
1820
+ interop(import("eslint-plugin-react-refresh")),
1821
+ ...a11y ? [interop(import("eslint-plugin-jsx-a11y"))] : []
1822
+ ]);
1823
+ return [
1824
+ {
1825
+ name: "luxass:react:setup",
1826
+ plugins: {
1827
+ "react": pluginReact,
1828
+ "react-hooks": pluginReactHooks,
1829
+ "react-refresh": pluginReactRefresh,
1830
+ ...a11y ? { "jsx-a11y": pluginA11y } : {}
1831
+ }
1832
+ },
1833
+ {
1834
+ name: "luxass:react:rules",
1835
+ files,
1836
+ languageOptions: {
1837
+ parserOptions: {
1838
+ ecmaFeatures: {
1839
+ jsx: true
1859
1840
  }
1860
- ],
1861
- "jsx-a11y/role-has-required-aria-props": "error",
1862
- "jsx-a11y/role-supports-aria-props": "error",
1863
- "jsx-a11y/scope": "error",
1864
- "jsx-a11y/tabindex-no-positive": "error",
1865
- // recommended rules react-hooks
1866
- "react-hooks/exhaustive-deps": "warn",
1867
- "react-hooks/rules-of-hooks": "error",
1868
- // react refresh
1869
- "react-refresh/only-export-components": ["warn", { allowConstantExport: true }],
1841
+ }
1842
+ },
1843
+ rules: {
1844
+ ...a11y ? {
1845
+ // recommended rules for jsx-a11y
1846
+ "jsx-a11y/alt-text": "error",
1847
+ "jsx-a11y/anchor-ambiguous-text": "off",
1848
+ "jsx-a11y/anchor-has-content": "error",
1849
+ "jsx-a11y/anchor-is-valid": "error",
1850
+ "jsx-a11y/aria-activedescendant-has-tabindex": "error",
1851
+ "jsx-a11y/aria-props": "error",
1852
+ "jsx-a11y/aria-proptypes": "error",
1853
+ "jsx-a11y/aria-role": "error",
1854
+ "jsx-a11y/aria-unsupported-elements": "error",
1855
+ "jsx-a11y/autocomplete-valid": "error",
1856
+ "jsx-a11y/click-events-have-key-events": "error",
1857
+ "jsx-a11y/control-has-associated-label": [
1858
+ "off",
1859
+ {
1860
+ ignoreElements: [
1861
+ "audio",
1862
+ "canvas",
1863
+ "embed",
1864
+ "input",
1865
+ "textarea",
1866
+ "tr",
1867
+ "video"
1868
+ ],
1869
+ ignoreRoles: [
1870
+ "grid",
1871
+ "listbox",
1872
+ "menu",
1873
+ "menubar",
1874
+ "radiogroup",
1875
+ "row",
1876
+ "tablist",
1877
+ "toolbar",
1878
+ "tree",
1879
+ "treegrid"
1880
+ ],
1881
+ includeRoles: [
1882
+ "alert",
1883
+ "dialog"
1884
+ ]
1885
+ }
1886
+ ],
1887
+ "jsx-a11y/heading-has-content": "error",
1888
+ "jsx-a11y/html-has-lang": "error",
1889
+ "jsx-a11y/iframe-has-title": "error",
1890
+ "jsx-a11y/img-redundant-alt": "error",
1891
+ "jsx-a11y/interactive-supports-focus": [
1892
+ "error",
1893
+ {
1894
+ tabbable: [
1895
+ "button",
1896
+ "checkbox",
1897
+ "link",
1898
+ "searchbox",
1899
+ "spinbutton",
1900
+ "switch",
1901
+ "textbox"
1902
+ ]
1903
+ }
1904
+ ],
1905
+ "jsx-a11y/label-has-associated-control": "error",
1906
+ "jsx-a11y/label-has-for": "off",
1907
+ "jsx-a11y/media-has-caption": "error",
1908
+ "jsx-a11y/mouse-events-have-key-events": "error",
1909
+ "jsx-a11y/no-access-key": "error",
1910
+ "jsx-a11y/no-autofocus": "error",
1911
+ "jsx-a11y/no-distracting-elements": "error",
1912
+ "jsx-a11y/no-interactive-element-to-noninteractive-role": [
1913
+ "error",
1914
+ {
1915
+ canvas: [
1916
+ "img"
1917
+ ],
1918
+ tr: [
1919
+ "none",
1920
+ "presentation"
1921
+ ]
1922
+ }
1923
+ ],
1924
+ "jsx-a11y/no-noninteractive-element-interactions": [
1925
+ "error",
1926
+ {
1927
+ alert: [
1928
+ "onKeyUp",
1929
+ "onKeyDown",
1930
+ "onKeyPress"
1931
+ ],
1932
+ body: [
1933
+ "onError",
1934
+ "onLoad"
1935
+ ],
1936
+ dialog: [
1937
+ "onKeyUp",
1938
+ "onKeyDown",
1939
+ "onKeyPress"
1940
+ ],
1941
+ handlers: [
1942
+ "onClick",
1943
+ "onError",
1944
+ "onLoad",
1945
+ "onMouseDown",
1946
+ "onMouseUp",
1947
+ "onKeyPress",
1948
+ "onKeyDown",
1949
+ "onKeyUp"
1950
+ ],
1951
+ iframe: [
1952
+ "onError",
1953
+ "onLoad"
1954
+ ],
1955
+ img: [
1956
+ "onError",
1957
+ "onLoad"
1958
+ ]
1959
+ }
1960
+ ],
1961
+ "jsx-a11y/no-noninteractive-element-to-interactive-role": [
1962
+ "error",
1963
+ {
1964
+ fieldset: [
1965
+ "radiogroup",
1966
+ "presentation"
1967
+ ],
1968
+ li: [
1969
+ "menuitem",
1970
+ "option",
1971
+ "row",
1972
+ "tab",
1973
+ "treeitem"
1974
+ ],
1975
+ ol: [
1976
+ "listbox",
1977
+ "menu",
1978
+ "menubar",
1979
+ "radiogroup",
1980
+ "tablist",
1981
+ "tree",
1982
+ "treegrid"
1983
+ ],
1984
+ table: [
1985
+ "grid"
1986
+ ],
1987
+ td: [
1988
+ "gridcell"
1989
+ ],
1990
+ ul: [
1991
+ "listbox",
1992
+ "menu",
1993
+ "menubar",
1994
+ "radiogroup",
1995
+ "tablist",
1996
+ "tree",
1997
+ "treegrid"
1998
+ ]
1999
+ }
2000
+ ],
2001
+ "jsx-a11y/no-noninteractive-tabindex": [
2002
+ "error",
2003
+ {
2004
+ allowExpressionValues: true,
2005
+ roles: [
2006
+ "tabpanel"
2007
+ ],
2008
+ tags: []
2009
+ }
2010
+ ],
2011
+ "jsx-a11y/no-redundant-roles": "error",
2012
+ "jsx-a11y/no-static-element-interactions": [
2013
+ "error",
2014
+ {
2015
+ allowExpressionValues: true,
2016
+ handlers: [
2017
+ "onClick",
2018
+ "onMouseDown",
2019
+ "onMouseUp",
2020
+ "onKeyPress",
2021
+ "onKeyDown",
2022
+ "onKeyUp"
2023
+ ]
2024
+ }
2025
+ ],
2026
+ "jsx-a11y/role-has-required-aria-props": "error",
2027
+ "jsx-a11y/role-supports-aria-props": "error",
2028
+ "jsx-a11y/scope": "error",
2029
+ "jsx-a11y/tabindex-no-positive": "error"
2030
+ } : {},
1870
2031
  // recommended rules react
1871
2032
  "react/display-name": "error",
1872
2033
  "react/jsx-key": "error",
@@ -1890,6 +2051,11 @@ async function react(options) {
1890
2051
  "react/prop-types": "error",
1891
2052
  "react/react-in-jsx-scope": "off",
1892
2053
  "react/require-render-return": "error",
2054
+ // recommended rules react-hooks
2055
+ "react-hooks/exhaustive-deps": "warn",
2056
+ "react-hooks/rules-of-hooks": "error",
2057
+ // react refresh
2058
+ "react-refresh/only-export-components": ["warn", { allowConstantExport: true }],
1893
2059
  ...typescript2 ? {
1894
2060
  "react/prop-type": "off"
1895
2061
  } : {},
@@ -1909,14 +2075,10 @@ async function react(options) {
1909
2075
  async function astro(options) {
1910
2076
  const {
1911
2077
  a11y = false,
1912
- overrides = {}
1913
- // typescript = true,
2078
+ files = [GLOB_ASTRO],
2079
+ overrides = {},
2080
+ typescript: typescript2 = true
1914
2081
  } = options;
1915
- await interop([
1916
- "eslint-plugin-astro",
1917
- "astro-eslint-parser",
1918
- ...options.a11y ? ["eslint-plugin-jsx-a11y"] : []
1919
- ]);
1920
2082
  const [
1921
2083
  pluginAstro,
1922
2084
  parserAstro,
@@ -1924,7 +2086,7 @@ async function astro(options) {
1924
2086
  ] = await Promise.all([
1925
2087
  interop(import("eslint-plugin-astro")),
1926
2088
  interop(import("astro-eslint-parser")),
1927
- ...options.a11y ? [interop(import("eslint-plugin-jsx-a11y"))] : []
2089
+ ...a11y ? [interop(import("eslint-plugin-jsx-a11y"))] : []
1928
2090
  ]);
1929
2091
  return [
1930
2092
  {
@@ -1935,7 +2097,8 @@ async function astro(options) {
1935
2097
  }
1936
2098
  },
1937
2099
  {
1938
- files: [GLOB_ASTRO],
2100
+ name: "luxass:astro:rules",
2101
+ files,
1939
2102
  languageOptions: {
1940
2103
  // @ts-expect-error hmmm
1941
2104
  globals: {
@@ -1944,21 +2107,22 @@ async function astro(options) {
1944
2107
  parser: parserAstro,
1945
2108
  parserOptions: {
1946
2109
  extraFileExtensions: [".astro"],
1947
- parser: options.typescript ? await interop(import("@typescript-eslint/parser")) : null,
2110
+ parser: typescript2 ? await interop(import("@typescript-eslint/parser")) : null,
1948
2111
  sourceType: "module"
1949
2112
  }
1950
2113
  },
1951
- name: "luxass:astro:rules",
1952
2114
  // @ts-expect-error hmmm
1953
2115
  rules: {
1954
2116
  "style/jsx-closing-tag-location": "off",
1955
2117
  "style/jsx-indent": "off",
1956
2118
  "style/jsx-one-expression-per-line": "off",
1957
2119
  ...pluginAstro.configs.all.rules,
2120
+ "style/multiline-ternary": ["error", "never"],
1958
2121
  ...overrides
1959
2122
  }
1960
2123
  },
1961
2124
  {
2125
+ name: "luxass:astro:rules:scripts",
1962
2126
  files: [
1963
2127
  "**/*.astro/*.js",
1964
2128
  "*.astro/*.js"
@@ -1971,20 +2135,230 @@ async function astro(options) {
1971
2135
  parserOptions: {
1972
2136
  sourceType: "module"
1973
2137
  }
2138
+ }
2139
+ }
2140
+ ];
2141
+ }
2142
+
2143
+ // src/configs/tailwindcss.ts
2144
+ async function tailwindcss(options = {}) {
2145
+ const {
2146
+ files = [GLOB_SRC],
2147
+ overrides
2148
+ } = options;
2149
+ await ensure([
2150
+ "eslint-plugin-tailwindcss"
2151
+ ]);
2152
+ const [
2153
+ pluginTailwindCSS
2154
+ ] = await Promise.all([
2155
+ interop(import("eslint-plugin-tailwindcss"))
2156
+ ]);
2157
+ return [
2158
+ {
2159
+ name: "luxass:tailwindcss:setup",
2160
+ languageOptions: {
2161
+ parserOptions: {
2162
+ ecmaFeatures: {
2163
+ jsx: true
2164
+ }
2165
+ }
1974
2166
  },
1975
- name: "luxass:astro:rules:scripts"
2167
+ plugins: {
2168
+ tailwind: pluginTailwindCSS
2169
+ }
2170
+ },
2171
+ {
2172
+ name: "luxass:tailwindcss:rules",
2173
+ files,
2174
+ rules: {
2175
+ // https://github.com/francoismassart/eslint-plugin-tailwindcss/blob/master/docs/rules/classnames-order.md
2176
+ "tailwind/classnames-order": "warn",
2177
+ // https://github.com/francoismassart/eslint-plugin-tailwindcss/blob/master/docs/rules/enforces-negative-arbitrary-values.md
2178
+ "tailwind/enforces-negative-arbitrary-values": "warn",
2179
+ // https://github.com/francoismassart/eslint-plugin-tailwindcss/blob/master/docs/rules/enforces-shorthand.md
2180
+ "tailwind/enforces-shorthand": "warn",
2181
+ // https://github.com/francoismassart/eslint-plugin-tailwindcss/blob/master/docs/rules/migration-from-tailwind-2.md
2182
+ "tailwind/migration-from-tailwind-2": "warn",
2183
+ // https://github.com/francoismassart/eslint-plugin-tailwindcss/blob/master/docs/rules/no-arbitrary-value.md
2184
+ "tailwind/no-arbitrary-value": "off",
2185
+ // https://github.com/francoismassart/eslint-plugin-tailwindcss/blob/master/docs/rules/no-contradicting-classname.md
2186
+ "tailwind/no-contradicting-classname": "error",
2187
+ // https://github.com/francoismassart/eslint-plugin-tailwindcss/blob/master/docs/rules/no-custom-classname.md
2188
+ "tailwind/no-custom-classname": "warn",
2189
+ ...overrides
2190
+ }
1976
2191
  }
1977
2192
  ];
1978
2193
  }
1979
2194
 
1980
- // src/factory.ts
1981
- var import_node_process3 = __toESM(require("process"), 1);
1982
- var import_node_fs = require("fs");
1983
- var import_local_pkg2 = require("local-pkg");
2195
+ // src/configs/formatters.ts
2196
+ var parserPlain2 = __toESM(require("eslint-parser-plain"), 1);
2197
+ async function formatters(options = {}, stylistic2 = {}) {
2198
+ await ensure([
2199
+ "eslint-plugin-format"
2200
+ ]);
2201
+ if (options === true) {
2202
+ options = {
2203
+ css: true,
2204
+ graphql: true,
2205
+ html: true,
2206
+ markdown: true
2207
+ };
2208
+ }
2209
+ const {
2210
+ indent,
2211
+ quotes,
2212
+ semi
2213
+ } = {
2214
+ ...StylisticConfigDefaults,
2215
+ ...stylistic2
2216
+ };
2217
+ const prettierOptions = Object.assign(
2218
+ {
2219
+ endOfLine: "auto",
2220
+ semi,
2221
+ singleQuote: quotes === "single",
2222
+ tabWidth: typeof indent === "number" ? indent : 2,
2223
+ trailingComma: "all",
2224
+ useTabs: indent === "tab"
2225
+ },
2226
+ options.prettierOptions || {}
2227
+ );
2228
+ const dprintOptions = Object.assign(
2229
+ {
2230
+ indentWidth: typeof indent === "number" ? indent : 2,
2231
+ quoteStyle: quotes === "single" ? "preferSingle" : "preferDouble",
2232
+ useTabs: indent === "tab"
2233
+ },
2234
+ options.dprintOptions || {}
2235
+ );
2236
+ const pluginFormat = await interop(import("eslint-plugin-format"));
2237
+ const configs = [
2238
+ {
2239
+ name: "luxass:formatters:setup",
2240
+ plugins: {
2241
+ format: pluginFormat
2242
+ }
2243
+ }
2244
+ ];
2245
+ if (options.css) {
2246
+ configs.push(
2247
+ {
2248
+ name: "luxass:formatter:css",
2249
+ files: [GLOB_CSS, GLOB_POSTCSS],
2250
+ languageOptions: {
2251
+ parser: parserPlain2
2252
+ },
2253
+ rules: {
2254
+ "format/prettier": [
2255
+ "error",
2256
+ {
2257
+ ...prettierOptions,
2258
+ parser: "css"
2259
+ }
2260
+ ]
2261
+ }
2262
+ },
2263
+ {
2264
+ name: "luxass:formatter:scss",
2265
+ files: [GLOB_SCSS],
2266
+ languageOptions: {
2267
+ parser: parserPlain2
2268
+ },
2269
+ rules: {
2270
+ "format/prettier": [
2271
+ "error",
2272
+ {
2273
+ ...prettierOptions,
2274
+ parser: "scss"
2275
+ }
2276
+ ]
2277
+ }
2278
+ },
2279
+ {
2280
+ name: "luxass:formatter:less",
2281
+ files: [GLOB_LESS],
2282
+ languageOptions: {
2283
+ parser: parserPlain2
2284
+ },
2285
+ rules: {
2286
+ "format/prettier": [
2287
+ "error",
2288
+ {
2289
+ ...prettierOptions,
2290
+ parser: "less"
2291
+ }
2292
+ ]
2293
+ }
2294
+ }
2295
+ );
2296
+ }
2297
+ if (options.html) {
2298
+ configs.push({
2299
+ name: "luxass:formatter:html",
2300
+ files: ["**/*.html"],
2301
+ languageOptions: {
2302
+ parser: parserPlain2
2303
+ },
2304
+ rules: {
2305
+ "format/prettier": [
2306
+ "error",
2307
+ {
2308
+ ...prettierOptions,
2309
+ parser: "html"
2310
+ }
2311
+ ]
2312
+ }
2313
+ });
2314
+ }
2315
+ if (options.markdown) {
2316
+ const formater = options.markdown === true ? "prettier" : options.markdown;
2317
+ configs.push({
2318
+ name: "luxass:formatter:markdown",
2319
+ files: [GLOB_MARKDOWN],
2320
+ languageOptions: {
2321
+ parser: parserPlain2
2322
+ },
2323
+ rules: {
2324
+ [`format/${formater}`]: [
2325
+ "error",
2326
+ formater === "prettier" ? {
2327
+ printWidth: 120,
2328
+ ...prettierOptions,
2329
+ embeddedLanguageFormatting: "off",
2330
+ parser: "markdown"
2331
+ } : {
2332
+ ...dprintOptions,
2333
+ language: "markdown"
2334
+ }
2335
+ ]
2336
+ }
2337
+ });
2338
+ }
2339
+ if (options.graphql) {
2340
+ configs.push({
2341
+ name: "luxass:formatter:graphql",
2342
+ files: ["**/*.graphql"],
2343
+ languageOptions: {
2344
+ parser: parserPlain2
2345
+ },
2346
+ rules: {
2347
+ "format/prettier": [
2348
+ "error",
2349
+ {
2350
+ ...prettierOptions,
2351
+ parser: "graphql"
2352
+ }
2353
+ ]
2354
+ }
2355
+ });
2356
+ }
2357
+ return configs;
2358
+ }
1984
2359
 
1985
2360
  // src/constants.ts
1986
2361
  var VUE_PACKAGES = ["vue", "nuxt", "vitepress", "@slidev/cli"];
1987
- var UNO_PACKAGES = ["unocss", "@unocss/webpack", "@unocss/nuxt"];
1988
2362
  var FLAT_CONFIG_PROPS = [
1989
2363
  "files",
1990
2364
  "ignores",
@@ -1996,20 +2370,77 @@ var FLAT_CONFIG_PROPS = [
1996
2370
  "settings"
1997
2371
  ];
1998
2372
 
2373
+ // src/configs/toml.ts
2374
+ async function toml(options = {}) {
2375
+ const {
2376
+ files = [GLOB_TOML],
2377
+ overrides = {},
2378
+ stylistic: stylistic2 = true
2379
+ } = options;
2380
+ const {
2381
+ indent = 2
2382
+ } = typeof stylistic2 === "boolean" ? {} : stylistic2;
2383
+ const [
2384
+ pluginToml,
2385
+ parserToml
2386
+ ] = await Promise.all([
2387
+ interop(import("eslint-plugin-toml")),
2388
+ interop(import("toml-eslint-parser"))
2389
+ ]);
2390
+ return [
2391
+ {
2392
+ name: "luxass:toml:setup",
2393
+ plugins: {
2394
+ toml: pluginToml
2395
+ }
2396
+ },
2397
+ {
2398
+ name: "luxass:toml:rules",
2399
+ files,
2400
+ languageOptions: {
2401
+ parser: parserToml
2402
+ },
2403
+ rules: {
2404
+ "style/spaced-comment": "off",
2405
+ "toml/comma-style": "error",
2406
+ "toml/keys-order": "error",
2407
+ "toml/no-space-dots": "error",
2408
+ "toml/no-unreadable-number-separator": "error",
2409
+ "toml/precision-of-fractional-seconds": "error",
2410
+ "toml/precision-of-integer": "error",
2411
+ "toml/tables-order": "error",
2412
+ "toml/vue-custom-block/no-parsing-error": "error",
2413
+ ...stylistic2 ? {
2414
+ "toml/array-bracket-newline": "error",
2415
+ "toml/array-bracket-spacing": "error",
2416
+ "toml/array-element-newline": "error",
2417
+ "toml/indent": ["error", indent === "tab" ? 2 : indent],
2418
+ "toml/inline-table-curly-spacing": "error",
2419
+ "toml/key-spacing": "error",
2420
+ "toml/padding-line-between-pairs": "error",
2421
+ "toml/padding-line-between-tables": "error",
2422
+ "toml/quoted-keys": "error",
2423
+ "toml/spaced-comment": "error",
2424
+ "toml/table-bracket-spacing": "error"
2425
+ } : {},
2426
+ ...overrides
2427
+ }
2428
+ }
2429
+ ];
2430
+ }
2431
+
1999
2432
  // src/factory.ts
2000
2433
  async function luxass(options = {}, ...userConfigs) {
2001
2434
  const {
2002
2435
  astro: enableAstro = (0, import_local_pkg2.isPackageExists)("astro"),
2003
- componentExts = [],
2436
+ editor = !!((import_node_process3.default.env.VSCODE_PID || import_node_process3.default.env.JETBRAINS_IDE || import_node_process3.default.env.VIM) && !import_node_process3.default.env.CI),
2437
+ exts = [],
2004
2438
  gitignore: enableGitignore = true,
2005
- isEditor = !!((import_node_process3.default.env.VSCODE_PID || import_node_process3.default.env.JETBRAINS_IDE) && !import_node_process3.default.env.CI),
2006
2439
  nextjs: enableNextJS = false,
2007
- overrides = {},
2008
- perfectionist: enablePerfectionistRules = false,
2009
2440
  react: enableReact = false,
2010
2441
  tailwindcss: enableTailwindCSS = false,
2011
2442
  typescript: enableTypeScript = (0, import_local_pkg2.isPackageExists)("typescript"),
2012
- unocss: enableUnoCSS = UNO_PACKAGES.some((i) => (0, import_local_pkg2.isPackageExists)(i)),
2443
+ unocss: enableUnoCSS = false,
2013
2444
  vue: enableVue = VUE_PACKAGES.some((i) => (0, import_local_pkg2.isPackageExists)(i))
2014
2445
  } = options;
2015
2446
  const stylisticOptions = options.stylistic === false ? false : typeof options.stylistic === "object" ? options.stylistic : {};
@@ -2029,8 +2460,8 @@ async function luxass(options = {}, ...userConfigs) {
2029
2460
  configs.push(
2030
2461
  ignores(),
2031
2462
  javascript({
2032
- isEditor,
2033
- overrides: overrides.javascript
2463
+ editor,
2464
+ overrides: getOverrides(options, "javascript")
2034
2465
  }),
2035
2466
  comments(),
2036
2467
  node(),
@@ -2041,54 +2472,46 @@ async function luxass(options = {}, ...userConfigs) {
2041
2472
  stylistic: stylisticOptions
2042
2473
  }),
2043
2474
  unicorn(),
2044
- perfectionist({
2045
- enableAllRules: enablePerfectionistRules
2046
- })
2475
+ perfectionist()
2047
2476
  );
2048
2477
  if (enableVue) {
2049
- componentExts.push("vue");
2478
+ exts.push("vue");
2050
2479
  }
2051
2480
  if (enableTypeScript) {
2052
- configs.push(
2053
- typescript({
2054
- ...typeof enableTypeScript !== "boolean" ? enableTypeScript : {},
2055
- componentExts,
2056
- overrides: overrides.typescript
2057
- })
2058
- );
2481
+ configs.push(typescript({
2482
+ ...resolveSubOptions(options, "typescript"),
2483
+ exts
2484
+ }));
2059
2485
  }
2060
2486
  if (stylisticOptions) {
2061
- configs.push(stylistic(stylisticOptions));
2487
+ configs.push(stylistic({
2488
+ ...stylisticOptions,
2489
+ overrides: getOverrides(options, "stylistic")
2490
+ }));
2062
2491
  }
2063
2492
  if (options.test ?? true) {
2064
- configs.push(
2065
- test({
2066
- isEditor,
2067
- overrides: overrides.test
2068
- })
2069
- );
2493
+ configs.push(test({
2494
+ editor,
2495
+ overrides: getOverrides(options, "test")
2496
+ }));
2070
2497
  }
2071
- if (enableReact || enableNextJS) {
2072
- configs.push(
2073
- react({
2074
- ...typeof enableReact !== "boolean" ? enableReact : {},
2075
- overrides: overrides.react,
2076
- typescript: !!enableTypeScript
2077
- })
2078
- );
2498
+ if (enableReact) {
2499
+ configs.push(react({
2500
+ overrides: getOverrides(options, "react"),
2501
+ typescript: !!enableTypeScript
2502
+ }));
2079
2503
  }
2080
2504
  if (enableNextJS) {
2081
2505
  configs.push(
2082
2506
  nextjs({
2083
- ...typeof enableNextJS !== "boolean" ? enableNextJS : {},
2084
- overrides: overrides.nextjs
2507
+ ...resolveSubOptions(options, "nextjs")
2085
2508
  })
2086
2509
  );
2087
2510
  }
2088
2511
  if (enableVue) {
2089
2512
  configs.push(
2090
2513
  vue({
2091
- overrides: overrides.vue,
2514
+ ...resolveSubOptions(options, "vue"),
2092
2515
  stylistic: stylisticOptions,
2093
2516
  typescript: !!enableTypeScript
2094
2517
  })
@@ -2097,34 +2520,27 @@ async function luxass(options = {}, ...userConfigs) {
2097
2520
  if (enableAstro) {
2098
2521
  configs.push(
2099
2522
  astro({
2100
- ...typeof enableAstro !== "boolean" ? enableAstro : {},
2101
- overrides: overrides.astro,
2523
+ ...resolveSubOptions(options, "astro"),
2102
2524
  typescript: !!enableTypeScript
2103
2525
  })
2104
2526
  );
2105
2527
  }
2106
2528
  if (enableUnoCSS) {
2107
- configs.push(
2108
- unocss({
2109
- ...typeof enableUnoCSS !== "boolean" ? enableUnoCSS : {},
2110
- overrides: overrides.unocss
2111
- })
2112
- );
2529
+ configs.push(unocss({
2530
+ ...resolveSubOptions(options, "unocss"),
2531
+ overrides: getOverrides(options, "unocss")
2532
+ }));
2113
2533
  }
2114
2534
  if (enableTailwindCSS) {
2115
2535
  configs.push(tailwindcss({
2116
- callees: typeof enableTailwindCSS === "object" ? enableTailwindCSS.callees : ["classnames", "clsx", "cx", "cn"],
2117
- classRegex: typeof enableTailwindCSS === "object" ? enableTailwindCSS.classRegex : "^class(Name)?$",
2118
- config: typeof enableTailwindCSS === "object" ? enableTailwindCSS.config : void 0,
2119
- nextjs: typeof enableNextJS === "object" ? true : enableNextJS,
2120
- overrides: overrides.tailwindCSS,
2121
- removeDuplicates: typeof enableTailwindCSS === "object" ? enableTailwindCSS.removeDuplicates : true
2536
+ ...resolveSubOptions(options, "tailwindcss"),
2537
+ overrides: getOverrides(options, "tailwindcss")
2122
2538
  }));
2123
2539
  }
2124
2540
  if (options.jsonc ?? true) {
2125
2541
  configs.push(
2126
2542
  jsonc({
2127
- overrides: overrides.jsonc,
2543
+ overrides: getOverrides(options, "jsonc"),
2128
2544
  stylistic: stylisticOptions
2129
2545
  }),
2130
2546
  sortPackageJson(),
@@ -2132,21 +2548,33 @@ async function luxass(options = {}, ...userConfigs) {
2132
2548
  );
2133
2549
  }
2134
2550
  if (options.yaml ?? true) {
2135
- configs.push(
2136
- yaml({
2137
- overrides: overrides.yaml,
2138
- stylistic: stylisticOptions
2139
- })
2140
- );
2551
+ configs.push(yaml({
2552
+ overrides: getOverrides(options, "yaml"),
2553
+ stylistic: stylisticOptions
2554
+ }));
2555
+ }
2556
+ if (options.toml ?? true) {
2557
+ configs.push(toml({
2558
+ overrides: getOverrides(options, "toml"),
2559
+ stylistic: stylisticOptions
2560
+ }));
2141
2561
  }
2142
2562
  if (options.markdown ?? true) {
2143
2563
  configs.push(
2144
- markdown({
2145
- componentExts,
2146
- overrides: overrides.markdown
2147
- })
2564
+ markdown(
2565
+ {
2566
+ exts,
2567
+ overrides: getOverrides(options, "markdown")
2568
+ }
2569
+ )
2148
2570
  );
2149
2571
  }
2572
+ if (options.formatters) {
2573
+ configs.push(formatters(
2574
+ options.formatters,
2575
+ typeof stylisticOptions === "boolean" ? {} : stylisticOptions
2576
+ ));
2577
+ }
2150
2578
  const fusedConfig = FLAT_CONFIG_PROPS.reduce((acc, key) => {
2151
2579
  if (key in options) {
2152
2580
  acc[key] = options[key];
@@ -2159,33 +2587,14 @@ async function luxass(options = {}, ...userConfigs) {
2159
2587
  const merged = combine(...configs, ...userConfigs);
2160
2588
  return merged;
2161
2589
  }
2590
+
2591
+ // src/index.ts
2592
+ var src_default = luxass;
2162
2593
  // Annotate the CommonJS export names for ESM import in node:
2163
2594
  0 && (module.exports = {
2164
- GLOB_ASTRO,
2165
- GLOB_CSS,
2166
- GLOB_EXCLUDE,
2167
- GLOB_HTML,
2168
- GLOB_JS,
2169
- GLOB_JSON,
2170
- GLOB_JSON5,
2171
- GLOB_JSONC,
2172
- GLOB_JSX,
2173
- GLOB_JSX_EXT,
2174
- GLOB_LESS,
2175
- GLOB_MARKDOWN,
2176
- GLOB_MARKDOWN_CODE,
2177
- GLOB_NEXTJS_OG,
2178
- GLOB_NEXTJS_ROUTES,
2179
- GLOB_SCSS,
2180
- GLOB_SRC,
2181
- GLOB_SRC_EXT,
2182
- GLOB_STYLE,
2183
- GLOB_TESTS,
2184
- GLOB_TS,
2185
- GLOB_VUE,
2186
- GLOB_YAML,
2187
2595
  astro,
2188
2596
  comments,
2597
+ formatters,
2189
2598
  ignores,
2190
2599
  imports,
2191
2600
  javascript,