@luxass/eslint-config 4.0.0-beta.9 → 4.0.1

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-SPQZTV4E.mjs → chunk-7R4FYLS2.mjs} +19 -14
  7. package/dist/{chunk-ADP4MYOS.mjs → chunk-ANUYBAYV.mjs} +1 -1
  8. package/dist/{chunk-R4NSLRAE.mjs → chunk-ATRL3UZP.mjs} +14 -8
  9. package/dist/{chunk-P3N5WLFL.mjs → chunk-BXBN56WI.mjs} +11 -7
  10. package/dist/chunk-CJ3ZUYUJ.mjs +183 -0
  11. package/dist/chunk-DAJA5AV3.mjs +29 -0
  12. package/dist/{chunk-FK567E7G.mjs → chunk-DVQQVCGF.mjs} +7 -3
  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-QZTI72NS.mjs → chunk-PYS26PF3.mjs} +13 -9
  17. package/dist/chunk-Q57BF3CR.mjs +63 -0
  18. package/dist/{chunk-3QHLEAXK.mjs → chunk-RDZJT36Z.mjs} +22 -8
  19. package/dist/chunk-RNFKNSHW.mjs +293 -0
  20. package/dist/{chunk-HE56XDG6.mjs → chunk-RVSUTDCE.mjs} +15 -5
  21. package/dist/chunk-UMUUVFB7.mjs +69 -0
  22. package/dist/{chunk-NUG6FLHN.mjs → chunk-VZ2YFMWH.mjs} +54 -11
  23. package/dist/chunk-WDSV2EFG.mjs +7 -0
  24. package/dist/{chunk-M5WNLLBT.mjs → chunk-WOYZWHPM.mjs} +20 -7
  25. package/dist/chunk-WRURTO5T.mjs +144 -0
  26. package/dist/{chunk-BAKUP7QM.mjs → chunk-Z7F6QSYQ.mjs} +44 -34
  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 +1487 -1074
  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 +16 -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 +206 -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 +39 -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 +1267 -839
  132. package/dist/index.d.cts +10 -44
  133. package/dist/index.d.ts +10 -44
  134. package/dist/index.mjs +106 -146
  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_pkg3 = 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,15 @@ 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}`],
772
+ rules: {
773
+ "no-console": "off"
774
+ }
775
+ },
776
+ {
777
+ name: "luxass:playground-overrides",
778
+ files: [`**/playground.${GLOB_SRC_EXT}`],
474
779
  rules: {
475
780
  "no-console": "off"
476
781
  }
@@ -515,8 +820,8 @@ async function ensure(packages) {
515
820
  const { default: prompts } = await import("prompts");
516
821
  const { result } = await prompts([
517
822
  {
518
- message: `${nonExistingPackages.length === 1 ? "Package is" : "Packages are"} required for this config: ${nonExistingPackages.join(", ")}. Do you want to install them?`,
519
823
  name: "result",
824
+ message: `${nonExistingPackages.length === 1 ? "Package is" : "Packages are"} required for this config: ${nonExistingPackages.join(", ")}. Do you want to install them?`,
520
825
  type: "confirm"
521
826
  }
522
827
  ]);
@@ -527,10 +832,22 @@ async function ensure(packages) {
527
832
  }
528
833
  ;
529
834
  }
835
+ function resolveSubOptions(options, key) {
836
+ return typeof options[key] === "boolean" ? {} : options[key] || {};
837
+ }
838
+ function getOverrides(options, key) {
839
+ const sub = resolveSubOptions(options, key);
840
+ return {
841
+ ..."overrides" in sub ? sub.overrides : {}
842
+ };
843
+ }
530
844
 
531
845
  // src/configs/jsdoc.ts
532
846
  async function jsdoc(options = {}) {
533
- const { stylistic: stylistic2 = true } = options;
847
+ const {
848
+ overrides,
849
+ stylistic: stylistic2 = true
850
+ } = options;
534
851
  return [
535
852
  {
536
853
  name: "luxass:jsdoc",
@@ -556,7 +873,8 @@ async function jsdoc(options = {}) {
556
873
  ...stylistic2 ? {
557
874
  "jsdoc/check-alignment": "warn",
558
875
  "jsdoc/multiline-blocks": "warn"
559
- } : {}
876
+ } : {},
877
+ ...overrides
560
878
  }
561
879
  }
562
880
  ];
@@ -564,7 +882,11 @@ async function jsdoc(options = {}) {
564
882
 
565
883
  // src/configs/jsonc.ts
566
884
  async function jsonc(options = {}) {
567
- const { overrides = {}, stylistic: stylistic2 = true } = options;
885
+ const {
886
+ files = [GLOB_JSON, GLOB_JSON5, GLOB_JSONC],
887
+ overrides = {},
888
+ stylistic: stylistic2 = true
889
+ } = options;
568
890
  const [
569
891
  pluginJsonc,
570
892
  parserJsonc
@@ -580,11 +902,11 @@ async function jsonc(options = {}) {
580
902
  }
581
903
  },
582
904
  {
583
- files: [GLOB_JSON, GLOB_JSON5, GLOB_JSONC],
905
+ name: "luxass:jsonc:rules",
906
+ files,
584
907
  languageOptions: {
585
908
  parser: parserJsonc
586
909
  },
587
- name: "luxass:jsonc:rules",
588
910
  rules: {
589
911
  "jsonc/no-bigint-literals": "error",
590
912
  "jsonc/no-binary-expression": "error",
@@ -640,24 +962,46 @@ async function jsonc(options = {}) {
640
962
  }
641
963
 
642
964
  // src/configs/markdown.ts
965
+ var parserPlain = __toESM(require("eslint-parser-plain"), 1);
966
+ var import_eslint_merge_processors = require("eslint-merge-processors");
643
967
  async function markdown(options = {}) {
644
- const { componentExts = [], overrides = {} } = options;
968
+ const {
969
+ exts = [],
970
+ files = [GLOB_MARKDOWN],
971
+ overrides = {}
972
+ } = options;
973
+ const markdown2 = await interop(import("eslint-plugin-markdown"));
645
974
  return [
646
975
  {
647
976
  name: "luxass:markdown:setup",
648
977
  plugins: {
649
- markdown: await interop(import("eslint-plugin-markdown"))
978
+ markdown: markdown2
650
979
  }
651
980
  },
652
981
  {
653
- files: [GLOB_MARKDOWN],
654
982
  name: "luxass:markdown:processor",
655
- processor: "markdown/markdown"
983
+ files,
984
+ ignores: [GLOB_MARKDOWN_IN_MARKDOWN],
985
+ // `eslint-plugin-markdown` only creates virtual files for code blocks,
986
+ // but not the markdown file itself. We use `eslint-merge-processors` to
987
+ // add a pass-through processor for the markdown file itself.
988
+ processor: (0, import_eslint_merge_processors.mergeProcessors)([
989
+ markdown2.processors.markdown,
990
+ import_eslint_merge_processors.processorPassThrough
991
+ ])
992
+ },
993
+ {
994
+ name: "luxass:markdown:parser",
995
+ files,
996
+ languageOptions: {
997
+ parser: parserPlain
998
+ }
656
999
  },
657
1000
  {
1001
+ name: "luxass:markdown:disables",
658
1002
  files: [
659
1003
  GLOB_MARKDOWN_CODE,
660
- ...componentExts.map((ext) => `${GLOB_MARKDOWN}/**/*.${ext}`)
1004
+ ...exts.map((ext) => `${GLOB_MARKDOWN}/**/*.${ext}`)
661
1005
  ],
662
1006
  languageOptions: {
663
1007
  parserOptions: {
@@ -666,10 +1010,7 @@ async function markdown(options = {}) {
666
1010
  }
667
1011
  }
668
1012
  },
669
- name: "luxass:markdown:rules",
670
1013
  rules: {
671
- "antfu/no-cjs-exports": "off",
672
- "antfu/no-ts-export-equal": "off",
673
1014
  "import/newline-after-import": "off",
674
1015
  "no-alert": "off",
675
1016
  "no-console": "off",
@@ -679,277 +1020,58 @@ async function markdown(options = {}) {
679
1020
  "node/prefer-global/process": "off",
680
1021
  "style/comma-dangle": "off",
681
1022
  "style/eol-last": "off",
1023
+ // Type aware rules
1024
+ "ts/await-thenable": "off",
682
1025
  "ts/consistent-type-imports": "off",
1026
+ "ts/dot-notation": "off",
1027
+ "ts/no-floating-promises": "off",
1028
+ "ts/no-for-in-array": "off",
1029
+ "ts/no-implied-eval": "off",
1030
+ "ts/no-misused-promises": "off",
683
1031
  "ts/no-namespace": "off",
684
1032
  "ts/no-redeclare": "off",
685
1033
  "ts/no-require-imports": "off",
1034
+ "ts/no-throw-literal": "off",
1035
+ "ts/no-unnecessary-type-assertion": "off",
1036
+ "ts/no-unsafe-argument": "off",
1037
+ "ts/no-unsafe-assignment": "off",
1038
+ "ts/no-unsafe-call": "off",
1039
+ "ts/no-unsafe-member-access": "off",
1040
+ "ts/no-unsafe-return": "off",
686
1041
  "ts/no-unused-vars": "off",
687
1042
  "ts/no-use-before-define": "off",
688
1043
  "ts/no-var-requires": "off",
1044
+ "ts/restrict-plus-operands": "off",
1045
+ "ts/restrict-template-expressions": "off",
1046
+ "ts/unbound-method": "off",
689
1047
  "unicode-bom": "off",
690
1048
  "unused-imports/no-unused-imports": "off",
691
1049
  "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
1050
  ...overrides
712
1051
  }
713
1052
  }
714
1053
  ];
715
1054
  }
716
1055
 
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
1056
  // src/configs/stylistic.ts
1057
+ var import_eslint_plugin_antfu3 = __toESM(require("eslint-plugin-antfu"), 1);
1058
+ var StylisticConfigDefaults = {
1059
+ indent: 2,
1060
+ jsx: true,
1061
+ quotes: "double",
1062
+ semi: true
1063
+ };
951
1064
  async function stylistic(options = {}) {
952
- const { indent = 2, jsx = true, quotes = "double", semi = true } = options;
1065
+ const {
1066
+ indent,
1067
+ jsx,
1068
+ overrides = {},
1069
+ quotes,
1070
+ semi
1071
+ } = {
1072
+ ...StylisticConfigDefaults,
1073
+ ...options
1074
+ };
953
1075
  const pluginStylistic = await interop(import("@stylistic/eslint-plugin"));
954
1076
  const config = pluginStylistic.configs.customize({
955
1077
  flat: true,
@@ -963,18 +1085,18 @@ async function stylistic(options = {}) {
963
1085
  {
964
1086
  name: "luxass:stylistic",
965
1087
  plugins: {
966
- antfu: import_eslint_plugin_antfu.default,
1088
+ antfu: import_eslint_plugin_antfu3.default,
967
1089
  style: pluginStylistic
968
1090
  },
969
1091
  rules: {
970
1092
  ...config.rules,
971
1093
  "antfu/consistent-list-newline": "error",
972
1094
  "antfu/if-newline": "off",
973
- "antfu/indent-binary-ops": ["error", { indent }],
974
1095
  "antfu/top-level-function": "error",
975
1096
  "curly": ["error", "multi-line", "consistent"],
976
1097
  "style/arrow-parens": ["error", "always", { requireForBlockBody: true }],
977
- "style/brace-style": ["error", "1tbs", { allowSingleLine: true }]
1098
+ "style/brace-style": ["error", "1tbs", { allowSingleLine: true }],
1099
+ ...overrides
978
1100
  }
979
1101
  }
980
1102
  ];
@@ -982,9 +1104,10 @@ async function stylistic(options = {}) {
982
1104
 
983
1105
  // src/configs/typescript.ts
984
1106
  var import_node_process2 = __toESM(require("process"), 1);
985
- async function typescript(options) {
1107
+ var import_eslint_plugin_antfu4 = __toESM(require("eslint-plugin-antfu"), 1);
1108
+ async function typescript(options = {}) {
986
1109
  const {
987
- componentExts = [],
1110
+ exts = [],
988
1111
  overrides = {},
989
1112
  parserOptions = {}
990
1113
  } = options ?? {};
@@ -1009,6 +1132,11 @@ async function typescript(options) {
1009
1132
  "ts/restrict-template-expressions": "error",
1010
1133
  "ts/unbound-method": "error"
1011
1134
  };
1135
+ const files = options.files ?? [
1136
+ GLOB_SRC,
1137
+ ...exts.map((ext) => `**/*.${ext}`)
1138
+ ];
1139
+ const filesTypeAware = options.typeAwareFileS ?? [GLOB_TS, GLOB_TSX];
1012
1140
  const tsconfigPath = options?.tsconfigPath ? toArray(options.tsconfigPath) : void 0;
1013
1141
  const [
1014
1142
  pluginTs,
@@ -1022,16 +1150,17 @@ async function typescript(options) {
1022
1150
  // Install the plugins without globs, so they can be configured separately.
1023
1151
  name: "luxass:typescript:setup",
1024
1152
  plugins: {
1025
- antfu: import_eslint_plugin_antfu.default,
1153
+ antfu: import_eslint_plugin_antfu4.default,
1026
1154
  ts: pluginTs
1027
1155
  }
1028
1156
  },
1029
1157
  {
1030
- files: [GLOB_SRC, ...componentExts.map((ext) => `**/*.${ext}`)],
1158
+ name: "luxass:typescript:rules",
1159
+ files,
1031
1160
  languageOptions: {
1032
1161
  parser: parserTs,
1033
1162
  parserOptions: {
1034
- extraFileExtensions: componentExts.map((ext) => `.${ext}`),
1163
+ extraFileExtensions: exts.map((ext) => `.${ext}`),
1035
1164
  sourceType: "module",
1036
1165
  ...tsconfigPath ? {
1037
1166
  project: tsconfigPath,
@@ -1040,7 +1169,6 @@ async function typescript(options) {
1040
1169
  ...parserOptions
1041
1170
  }
1042
1171
  },
1043
- name: "luxass:typescript:rules",
1044
1172
  rules: {
1045
1173
  ...renameRules(
1046
1174
  pluginTs.configs["eslint-recommended"].overrides[0].rules,
@@ -1052,9 +1180,6 @@ async function typescript(options) {
1052
1180
  "@typescript-eslint/",
1053
1181
  "ts/"
1054
1182
  ),
1055
- "antfu/generic-spacing": "error",
1056
- "antfu/named-tuple-spacing": "error",
1057
- "antfu/no-cjs-exports": "error",
1058
1183
  "no-dupe-class-members": "off",
1059
1184
  "no-invalid-this": "off",
1060
1185
  "no-loss-of-precision": "off",
@@ -1068,41 +1193,34 @@ async function typescript(options) {
1068
1193
  "ts/ban-types": ["error", {
1069
1194
  extendDefaults: false,
1070
1195
  types: {
1071
- "BigInt": {
1196
+ BigInt: {
1072
1197
  fixWith: "bigint",
1073
1198
  message: "Use `bigint` instead."
1074
1199
  },
1075
- "Boolean": {
1200
+ Boolean: {
1076
1201
  fixWith: "boolean",
1077
1202
  message: "Use `boolean` instead."
1078
1203
  },
1079
- "Function": "Use a specific function type instead, like `() => void`.",
1080
- "Number": {
1204
+ Function: "Use a specific function type instead, like `() => void`.",
1205
+ Number: {
1081
1206
  fixWith: "number",
1082
1207
  message: "Use `number` instead."
1083
1208
  },
1084
- "Object": {
1209
+ Object: {
1085
1210
  fixWith: "Record<string, unknown>",
1086
1211
  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
1212
  },
1088
- "String": {
1213
+ String: {
1089
1214
  fixWith: "string",
1090
1215
  message: "Use `string` instead."
1091
1216
  },
1092
- "Symbol": {
1217
+ Symbol: {
1093
1218
  fixWith: "symbol",
1094
1219
  message: "Use `symbol` instead."
1095
1220
  },
1096
- "[]": {
1097
- message: "Don't use the empty array type `[]`. It only allows empty arrays. Use `SomeType[]` instead."
1098
- },
1099
- "object": {
1221
+ object: {
1100
1222
  fixWith: "Record<string, unknown>",
1101
1223
  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
1224
  }
1107
1225
  }
1108
1226
  }],
@@ -1131,13 +1249,20 @@ async function typescript(options) {
1131
1249
  "ts/prefer-ts-expect-error": "error",
1132
1250
  "ts/triple-slash-reference": "off",
1133
1251
  "ts/unified-signatures": "off",
1252
+ ...overrides
1253
+ }
1254
+ },
1255
+ {
1256
+ name: "luxass:typescript:rules-type-aware",
1257
+ files: filesTypeAware,
1258
+ rules: {
1134
1259
  ...tsconfigPath ? typeAwareRules : {},
1135
1260
  ...overrides
1136
1261
  }
1137
1262
  },
1138
1263
  {
1139
- files: ["**/*.d.ts"],
1140
1264
  name: "luxass:typescript:dts-overrides",
1265
+ files: ["**/*.d.ts"],
1141
1266
  rules: {
1142
1267
  "eslint-comments/no-unlimited-disable": "off",
1143
1268
  "import/no-duplicates": "off",
@@ -1146,73 +1271,51 @@ async function typescript(options) {
1146
1271
  }
1147
1272
  },
1148
1273
  {
1149
- files: ["**/*.{test,spec}.ts?(x)"],
1150
1274
  name: "luxass:typescript:tests-overrides",
1275
+ files: ["**/*.{test,spec}.ts?(x)"],
1151
1276
  rules: {
1152
1277
  "no-unused-expressions": "off"
1153
1278
  }
1154
1279
  },
1155
1280
  {
1156
- files: ["**/*.js", "**/*.cjs"],
1157
- name: "luxass:typescript:javascript-overrides",
1281
+ name: "luxass:typescript:playground-overrides",
1282
+ files: [`**/playground.${GLOB_SRC_EXT}`],
1158
1283
  rules: {
1159
- "ts/no-require-imports": "off",
1160
- "ts/no-var-requires": "off"
1284
+ "no-console": "off"
1161
1285
  }
1162
- }
1163
- ];
1164
- }
1165
-
1166
- // src/configs/unicorn.ts
1167
- function unicorn() {
1168
- return [
1286
+ },
1169
1287
  {
1170
- name: "luxass:unicorn",
1171
- plugins: {
1172
- unicorn: import_eslint_plugin_unicorn.default
1173
- },
1288
+ name: "luxass:typescript:javascript-overrides",
1289
+ files: ["**/*.js", "**/*.cjs"],
1174
1290
  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"
1291
+ "ts/no-require-imports": "off",
1292
+ "ts/no-var-requires": "off"
1201
1293
  }
1202
1294
  }
1203
1295
  ];
1204
1296
  }
1205
1297
 
1206
1298
  // src/configs/vue.ts
1299
+ var import_eslint_merge_processors2 = require("eslint-merge-processors");
1207
1300
  async function vue(options = {}) {
1208
- const { overrides = {}, stylistic: stylistic2 = true } = options;
1301
+ const {
1302
+ a11y = true,
1303
+ files = [GLOB_VUE],
1304
+ overrides = {},
1305
+ stylistic: stylistic2 = true
1306
+ } = options;
1209
1307
  const [
1210
1308
  pluginVue,
1211
- parserVue
1309
+ parserVue,
1310
+ processorVueBlocks,
1311
+ pluginA11y
1212
1312
  ] = await Promise.all([
1213
1313
  interop(import("eslint-plugin-vue")),
1214
- interop(import("vue-eslint-parser"))
1314
+ interop(import("vue-eslint-parser")),
1315
+ interop(import("eslint-processor-vue-blocks")),
1316
+ ...a11y ? [interop(import("eslint-plugin-vuejs-accessibility"))] : []
1215
1317
  ]);
1318
+ const sfcBlocks = options.sfcBlocks === true ? {} : options.sfcBlocks ?? {};
1216
1319
  const {
1217
1320
  indent = 2
1218
1321
  } = typeof stylistic2 === "boolean" ? {} : stylistic2;
@@ -1220,11 +1323,13 @@ async function vue(options = {}) {
1220
1323
  {
1221
1324
  name: "luxass:vue:setup",
1222
1325
  plugins: {
1223
- vue: pluginVue
1326
+ vue: pluginVue,
1327
+ ...a11y ? { "vue-a11y": pluginA11y } : {}
1224
1328
  }
1225
1329
  },
1226
1330
  {
1227
- files: [GLOB_VUE],
1331
+ name: "luxass:vue:rules",
1332
+ files,
1228
1333
  languageOptions: {
1229
1334
  parser: parserVue,
1230
1335
  parserOptions: {
@@ -1236,8 +1341,16 @@ async function vue(options = {}) {
1236
1341
  sourceType: "module"
1237
1342
  }
1238
1343
  },
1239
- name: "luxass:vue:rules",
1240
- processor: pluginVue.processors[".vue"],
1344
+ processor: sfcBlocks === false ? pluginVue.processors[".vue"] : (0, import_eslint_merge_processors2.mergeProcessors)([
1345
+ pluginVue.processors[".vue"],
1346
+ processorVueBlocks({
1347
+ ...sfcBlocks,
1348
+ blocks: {
1349
+ styles: true,
1350
+ ...sfcBlocks.blocks
1351
+ }
1352
+ })
1353
+ ]),
1241
1354
  rules: {
1242
1355
  ...pluginVue.configs.base.rules,
1243
1356
  ...pluginVue.configs["vue3-essential"].rules,
@@ -1346,6 +1459,28 @@ async function vue(options = {}) {
1346
1459
  "vue/space-in-parens": ["error", "never"],
1347
1460
  "vue/template-curly-spacing": "error"
1348
1461
  } : {},
1462
+ ...a11y ? {
1463
+ "vue-a11y/alt-text": "error",
1464
+ "vue-a11y/anchor-has-content": "error",
1465
+ "vue-a11y/aria-props": "error",
1466
+ "vue-a11y/aria-role": "error",
1467
+ "vue-a11y/aria-unsupported-elements": "error",
1468
+ "vue-a11y/click-events-have-key-events": "error",
1469
+ "vue-a11y/form-control-has-label": "error",
1470
+ "vue-a11y/heading-has-content": "error",
1471
+ "vue-a11y/iframe-has-title": "error",
1472
+ "vue-a11y/interactive-supports-focus": "error",
1473
+ "vue-a11y/label-has-for": "error",
1474
+ "vue-a11y/media-has-caption": "error",
1475
+ "vue-a11y/mouse-events-have-key-events": "error",
1476
+ "vue-a11y/no-access-key": "error",
1477
+ "vue-a11y/no-autofocus": "error",
1478
+ "vue-a11y/no-distracting-elements": "error",
1479
+ "vue-a11y/no-redundant-roles": "error",
1480
+ "vue-a11y/no-static-element-interactions": "error",
1481
+ "vue-a11y/role-has-required-aria-props": "error",
1482
+ "vue-a11y/tabindex-no-positive": "error"
1483
+ } : {},
1349
1484
  ...overrides
1350
1485
  }
1351
1486
  }
@@ -1354,7 +1489,11 @@ async function vue(options = {}) {
1354
1489
 
1355
1490
  // src/configs/yaml.ts
1356
1491
  async function yaml(options = {}) {
1357
- const { overrides = {}, stylistic: stylistic2 = true } = options;
1492
+ const {
1493
+ files = [GLOB_YAML],
1494
+ overrides = {},
1495
+ stylistic: stylistic2 = true
1496
+ } = options;
1358
1497
  const [
1359
1498
  pluginYaml,
1360
1499
  parserYaml
@@ -1374,16 +1513,17 @@ async function yaml(options = {}) {
1374
1513
  }
1375
1514
  },
1376
1515
  {
1377
- files: [GLOB_YAML],
1516
+ name: "luxass:yaml:rules",
1517
+ files,
1378
1518
  languageOptions: {
1379
1519
  parser: parserYaml
1380
1520
  },
1381
- name: "luxass:yaml:rules",
1382
1521
  rules: {
1383
1522
  "style/spaced-comment": "off",
1384
1523
  "yaml/block-mapping": "error",
1385
1524
  "yaml/block-sequence": "error",
1386
1525
  "yaml/no-empty-key": "error",
1526
+ "yaml/no-empty-mapping-value": "error",
1387
1527
  "yaml/no-empty-sequence-entry": "error",
1388
1528
  "yaml/no-irregular-whitespace": "error",
1389
1529
  "yaml/plain-scalar": "error",
@@ -1406,19 +1546,121 @@ async function yaml(options = {}) {
1406
1546
  } : {},
1407
1547
  ...overrides
1408
1548
  }
1549
+ },
1550
+ {
1551
+ name: "luxass:yaml:github-actions",
1552
+ files: ["**/.github/workflows/*.{yml,yaml}"],
1553
+ rules: {
1554
+ // GitHub Actions supports empty values to enable features
1555
+ "yaml/no-empty-mapping-value": "off"
1556
+ }
1409
1557
  }
1410
1558
  ];
1411
1559
  }
1412
1560
 
1561
+ // src/custom-rules/utils.ts
1562
+ var import_utils8 = require("@typescript-eslint/utils");
1563
+ var createRule = import_utils8.ESLintUtils.RuleCreator((ruleName) => `https://github.com/luxass/eslint-config/blob/main/src/custom-rules/${ruleName}/README.md`);
1564
+
1565
+ // src/custom-rules/no-only-tests/index.ts
1566
+ var DEFAULT_OPTIONS = {
1567
+ blocks: ["describe", "it", "test"],
1568
+ focus: ["only"]
1569
+ };
1570
+ function getPath(node2, path = []) {
1571
+ if (node2) {
1572
+ const nodeName = node2.name || node2.property && node2.property.name;
1573
+ if (node2.object) {
1574
+ return getPath(node2.object, [
1575
+ nodeName,
1576
+ ...path
1577
+ ]);
1578
+ }
1579
+ if (node2.callee)
1580
+ return getPath(node2.callee, path);
1581
+ return [nodeName, ...path];
1582
+ }
1583
+ return path;
1584
+ }
1585
+ var noOnlyTests = createRule({
1586
+ name: "no-only-tests",
1587
+ create: (context, [options]) => {
1588
+ const {
1589
+ blocks = DEFAULT_OPTIONS.blocks,
1590
+ focus = DEFAULT_OPTIONS.focus
1591
+ } = options;
1592
+ const handler = {
1593
+ Identifier(node2) {
1594
+ const parent = node2.parent?.object;
1595
+ if (!parent)
1596
+ return;
1597
+ if (!focus.includes(node2.name))
1598
+ return;
1599
+ const callPath = getPath(node2.parent).join(".");
1600
+ const found = blocks.find((block) => {
1601
+ if (block.endsWith("*"))
1602
+ return callPath.startsWith(block.replace(/\*$/, ""));
1603
+ return callPath.startsWith(`${block}.`);
1604
+ });
1605
+ if (found) {
1606
+ context.report({
1607
+ data: { block: callPath.split(".")[0], focus: node2.name },
1608
+ messageId: "notPermitted",
1609
+ node: node2
1610
+ });
1611
+ }
1612
+ }
1613
+ };
1614
+ return handler;
1615
+ },
1616
+ defaultOptions: [{
1617
+ blocks: ["describe", "it", "test"],
1618
+ focus: ["only"]
1619
+ }],
1620
+ meta: {
1621
+ docs: {
1622
+ description: "disallow .only blocks in tests",
1623
+ recommended: "recommended"
1624
+ },
1625
+ messages: {
1626
+ notPermitted: "{{ block }}.{{ focus }} not permitted"
1627
+ },
1628
+ schema: [{
1629
+ additionalProperties: false,
1630
+ properties: {
1631
+ blocks: {
1632
+ items: {
1633
+ type: "string"
1634
+ },
1635
+ type: "array",
1636
+ uniqueItems: true
1637
+ },
1638
+ focus: {
1639
+ items: {
1640
+ type: "string"
1641
+ },
1642
+ type: "array",
1643
+ uniqueItems: true
1644
+ }
1645
+ },
1646
+ type: "object"
1647
+ }],
1648
+ type: "layout"
1649
+ }
1650
+ // i need to have this here, otherwise typechecking fails.
1651
+ });
1652
+
1413
1653
  // src/configs/test.ts
1414
1654
  async function test(options = {}) {
1415
- const { isEditor = false, overrides = {} } = options;
1655
+ const {
1656
+ editor = false,
1657
+ files = GLOB_TESTS,
1658
+ overrides = {}
1659
+ } = options;
1416
1660
  const [
1417
- pluginVitest,
1418
- pluginNoOnlyTests
1661
+ pluginVitest
1419
1662
  ] = await Promise.all([
1420
- interop(import("eslint-plugin-vitest")),
1421
- interop(import("eslint-plugin-no-only-tests"))
1663
+ interop(import("eslint-plugin-vitest"))
1422
1664
  ]);
1423
1665
  return [
1424
1666
  {
@@ -1428,21 +1670,21 @@ async function test(options = {}) {
1428
1670
  ...pluginVitest,
1429
1671
  rules: {
1430
1672
  ...pluginVitest.rules,
1431
- ...pluginNoOnlyTests.rules
1673
+ "no-only-tests": noOnlyTests
1432
1674
  }
1433
1675
  }
1434
1676
  }
1435
1677
  },
1436
1678
  {
1437
- files: GLOB_TESTS,
1438
1679
  name: "luxass:test:rules",
1680
+ files,
1439
1681
  rules: {
1440
1682
  "test/consistent-test-it": [
1441
1683
  "error",
1442
1684
  { fn: "it", withinDescribe: "it" }
1443
1685
  ],
1444
1686
  "test/no-identical-title": "error",
1445
- "test/no-only-tests": isEditor ? "off" : "error",
1687
+ "test/no-only-tests": editor ? "off" : "error",
1446
1688
  "test/prefer-hooks-in-order": "error",
1447
1689
  "test/prefer-lowercase-title": "error",
1448
1690
  ...overrides
@@ -1451,107 +1693,38 @@ async function test(options = {}) {
1451
1693
  ];
1452
1694
  }
1453
1695
 
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
1696
  // 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 = {}) {
1697
+ async function unocss(options = {}) {
1506
1698
  const {
1507
- callees = DEFAULT_TAILWIND_CALLEES,
1508
- classRegex = DEFAULT_CLASS_REGEX,
1509
- config = void 0,
1510
- nextjs: nextjs2,
1699
+ attributify = true,
1700
+ files = [GLOB_SRC],
1511
1701
  overrides,
1512
- removeDuplicates = true
1702
+ strict = false
1513
1703
  } = options;
1514
1704
  await ensure([
1515
- "eslint-plugin-tailwindcss"
1705
+ "@unocss/eslint-plugin"
1706
+ ]);
1707
+ const [
1708
+ pluginUnoCSS
1709
+ ] = await Promise.all([
1710
+ interop(import("@unocss/eslint-plugin"))
1516
1711
  ]);
1517
- const pluginTailwindCSS = await interop(import("eslint-plugin-tailwindcss"));
1518
- const tailwindCSSCallee = callees ?? DEFAULT_TAILWIND_CALLEES;
1519
1712
  return [
1520
1713
  {
1521
- name: "luxass:tailwindcss",
1714
+ name: "luxass:unocss",
1715
+ files,
1522
1716
  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
1717
+ unocss: pluginUnoCSS
1539
1718
  },
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
1719
  rules: {
1553
- "sort-keys": "off",
1554
- "sort-keys/sort-keys-fix": "off"
1720
+ "unocss/order": "warn",
1721
+ ...attributify ? {
1722
+ "unocss/order-attributify": "warn"
1723
+ } : {},
1724
+ ...strict ? {
1725
+ "unocss/blocklist": "error"
1726
+ } : {},
1727
+ ...overrides
1555
1728
  }
1556
1729
  }
1557
1730
  ];
@@ -1559,7 +1732,11 @@ async function tailwindcss(options = {}) {
1559
1732
 
1560
1733
  // src/configs/nextjs.ts
1561
1734
  async function nextjs(options = {}) {
1562
- const { overrides, rootDir } = options;
1735
+ const {
1736
+ files = [GLOB_SRC],
1737
+ overrides,
1738
+ rootDir
1739
+ } = options;
1563
1740
  await ensure([
1564
1741
  "@next/eslint-plugin-next"
1565
1742
  ]);
@@ -1572,8 +1749,8 @@ async function nextjs(options = {}) {
1572
1749
  }
1573
1750
  },
1574
1751
  {
1575
- files: [GLOB_SRC],
1576
1752
  name: "luxass:nextjs:rules",
1753
+ files,
1577
1754
  rules: {
1578
1755
  ...pluginNextjs.configs.recommended.rules,
1579
1756
  ...pluginNextjs.configs["core-web-vitals"].rules,
@@ -1612,16 +1789,16 @@ async function nextjs(options = {}) {
1612
1789
  }
1613
1790
  },
1614
1791
  {
1615
- files: GLOB_NEXTJS_ROUTES,
1616
1792
  name: "luxass:nextjs:default-export-override",
1793
+ files: GLOB_NEXTJS_ROUTES,
1617
1794
  rules: {
1618
1795
  "import/prefer-default-export": "error",
1619
1796
  "react-refresh/only-export-components": "off"
1620
1797
  }
1621
1798
  },
1622
1799
  {
1623
- files: GLOB_NEXTJS_OG,
1624
1800
  name: "luxass:nextjs:og-override",
1801
+ files: GLOB_NEXTJS_OG,
1625
1802
  rules: {
1626
1803
  "@next/next/no-img-element": "off",
1627
1804
  "react/no-unknown-property": ["error", {
@@ -1629,244 +1806,246 @@ async function nextjs(options = {}) {
1629
1806
  }]
1630
1807
  }
1631
1808
  }
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
- ]
1809
+ ];
1810
+ }
1811
+
1812
+ // src/configs/react.ts
1813
+ var import_local_pkg2 = require("local-pkg");
1814
+ async function react(options = {}) {
1815
+ const {
1816
+ a11y = false,
1817
+ files = [GLOB_JSX, GLOB_TSX],
1818
+ overrides = {},
1819
+ typescript: typescript2 = true
1820
+ } = options;
1821
+ await ensure([
1822
+ "eslint-plugin-react",
1823
+ "eslint-plugin-react-hooks",
1824
+ "eslint-plugin-react-refresh",
1825
+ ...options.a11y ? ["eslint-plugin-jsx-a11y"] : []
1826
+ ]);
1827
+ const [
1828
+ pluginReact,
1829
+ pluginReactHooks,
1830
+ pluginReactRefresh,
1831
+ pluginA11y
1832
+ ] = await Promise.all([
1833
+ interop(import("eslint-plugin-react")),
1834
+ interop(import("eslint-plugin-react-hooks")),
1835
+ interop(import("eslint-plugin-react-refresh")),
1836
+ ...a11y ? [interop(import("eslint-plugin-jsx-a11y"))] : []
1837
+ ]);
1838
+ const isAllowConstantExport = ["vite"].some(
1839
+ (i) => (0, import_local_pkg2.isPackageExists)(i)
1840
+ );
1841
+ return [
1842
+ {
1843
+ name: "luxass:react:setup",
1844
+ plugins: {
1845
+ "react": pluginReact,
1846
+ "react-hooks": pluginReactHooks,
1847
+ "react-refresh": pluginReactRefresh,
1848
+ ...a11y ? { "jsx-a11y": pluginA11y } : {}
1849
+ }
1850
+ },
1851
+ {
1852
+ name: "luxass:react:rules",
1853
+ files,
1854
+ languageOptions: {
1855
+ parserOptions: {
1856
+ ecmaFeatures: {
1857
+ jsx: true
1859
1858
  }
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 }],
1859
+ }
1860
+ },
1861
+ rules: {
1862
+ ...a11y ? {
1863
+ // recommended rules for jsx-a11y
1864
+ "jsx-a11y/alt-text": "error",
1865
+ "jsx-a11y/anchor-ambiguous-text": "off",
1866
+ "jsx-a11y/anchor-has-content": "error",
1867
+ "jsx-a11y/anchor-is-valid": "error",
1868
+ "jsx-a11y/aria-activedescendant-has-tabindex": "error",
1869
+ "jsx-a11y/aria-props": "error",
1870
+ "jsx-a11y/aria-proptypes": "error",
1871
+ "jsx-a11y/aria-role": "error",
1872
+ "jsx-a11y/aria-unsupported-elements": "error",
1873
+ "jsx-a11y/autocomplete-valid": "error",
1874
+ "jsx-a11y/click-events-have-key-events": "error",
1875
+ "jsx-a11y/control-has-associated-label": [
1876
+ "off",
1877
+ {
1878
+ ignoreElements: [
1879
+ "audio",
1880
+ "canvas",
1881
+ "embed",
1882
+ "input",
1883
+ "textarea",
1884
+ "tr",
1885
+ "video"
1886
+ ],
1887
+ ignoreRoles: [
1888
+ "grid",
1889
+ "listbox",
1890
+ "menu",
1891
+ "menubar",
1892
+ "radiogroup",
1893
+ "row",
1894
+ "tablist",
1895
+ "toolbar",
1896
+ "tree",
1897
+ "treegrid"
1898
+ ],
1899
+ includeRoles: [
1900
+ "alert",
1901
+ "dialog"
1902
+ ]
1903
+ }
1904
+ ],
1905
+ "jsx-a11y/heading-has-content": "error",
1906
+ "jsx-a11y/html-has-lang": "error",
1907
+ "jsx-a11y/iframe-has-title": "error",
1908
+ "jsx-a11y/img-redundant-alt": "error",
1909
+ "jsx-a11y/interactive-supports-focus": [
1910
+ "error",
1911
+ {
1912
+ tabbable: [
1913
+ "button",
1914
+ "checkbox",
1915
+ "link",
1916
+ "searchbox",
1917
+ "spinbutton",
1918
+ "switch",
1919
+ "textbox"
1920
+ ]
1921
+ }
1922
+ ],
1923
+ "jsx-a11y/label-has-associated-control": "error",
1924
+ "jsx-a11y/label-has-for": "off",
1925
+ "jsx-a11y/media-has-caption": "error",
1926
+ "jsx-a11y/mouse-events-have-key-events": "error",
1927
+ "jsx-a11y/no-access-key": "error",
1928
+ "jsx-a11y/no-autofocus": "error",
1929
+ "jsx-a11y/no-distracting-elements": "error",
1930
+ "jsx-a11y/no-interactive-element-to-noninteractive-role": [
1931
+ "error",
1932
+ {
1933
+ canvas: [
1934
+ "img"
1935
+ ],
1936
+ tr: [
1937
+ "none",
1938
+ "presentation"
1939
+ ]
1940
+ }
1941
+ ],
1942
+ "jsx-a11y/no-noninteractive-element-interactions": [
1943
+ "error",
1944
+ {
1945
+ alert: [
1946
+ "onKeyUp",
1947
+ "onKeyDown",
1948
+ "onKeyPress"
1949
+ ],
1950
+ body: [
1951
+ "onError",
1952
+ "onLoad"
1953
+ ],
1954
+ dialog: [
1955
+ "onKeyUp",
1956
+ "onKeyDown",
1957
+ "onKeyPress"
1958
+ ],
1959
+ handlers: [
1960
+ "onClick",
1961
+ "onError",
1962
+ "onLoad",
1963
+ "onMouseDown",
1964
+ "onMouseUp",
1965
+ "onKeyPress",
1966
+ "onKeyDown",
1967
+ "onKeyUp"
1968
+ ],
1969
+ iframe: [
1970
+ "onError",
1971
+ "onLoad"
1972
+ ],
1973
+ img: [
1974
+ "onError",
1975
+ "onLoad"
1976
+ ]
1977
+ }
1978
+ ],
1979
+ "jsx-a11y/no-noninteractive-element-to-interactive-role": [
1980
+ "error",
1981
+ {
1982
+ fieldset: [
1983
+ "radiogroup",
1984
+ "presentation"
1985
+ ],
1986
+ li: [
1987
+ "menuitem",
1988
+ "option",
1989
+ "row",
1990
+ "tab",
1991
+ "treeitem"
1992
+ ],
1993
+ ol: [
1994
+ "listbox",
1995
+ "menu",
1996
+ "menubar",
1997
+ "radiogroup",
1998
+ "tablist",
1999
+ "tree",
2000
+ "treegrid"
2001
+ ],
2002
+ table: [
2003
+ "grid"
2004
+ ],
2005
+ td: [
2006
+ "gridcell"
2007
+ ],
2008
+ ul: [
2009
+ "listbox",
2010
+ "menu",
2011
+ "menubar",
2012
+ "radiogroup",
2013
+ "tablist",
2014
+ "tree",
2015
+ "treegrid"
2016
+ ]
2017
+ }
2018
+ ],
2019
+ "jsx-a11y/no-noninteractive-tabindex": [
2020
+ "error",
2021
+ {
2022
+ allowExpressionValues: true,
2023
+ roles: [
2024
+ "tabpanel"
2025
+ ],
2026
+ tags: []
2027
+ }
2028
+ ],
2029
+ "jsx-a11y/no-redundant-roles": "error",
2030
+ "jsx-a11y/no-static-element-interactions": [
2031
+ "error",
2032
+ {
2033
+ allowExpressionValues: true,
2034
+ handlers: [
2035
+ "onClick",
2036
+ "onMouseDown",
2037
+ "onMouseUp",
2038
+ "onKeyPress",
2039
+ "onKeyDown",
2040
+ "onKeyUp"
2041
+ ]
2042
+ }
2043
+ ],
2044
+ "jsx-a11y/role-has-required-aria-props": "error",
2045
+ "jsx-a11y/role-supports-aria-props": "error",
2046
+ "jsx-a11y/scope": "error",
2047
+ "jsx-a11y/tabindex-no-positive": "error"
2048
+ } : {},
1870
2049
  // recommended rules react
1871
2050
  "react/display-name": "error",
1872
2051
  "react/jsx-key": "error",
@@ -1890,7 +2069,13 @@ async function react(options) {
1890
2069
  "react/prop-types": "error",
1891
2070
  "react/react-in-jsx-scope": "off",
1892
2071
  "react/require-render-return": "error",
2072
+ // recommended rules react-hooks
2073
+ "react-hooks/exhaustive-deps": "warn",
2074
+ "react-hooks/rules-of-hooks": "error",
2075
+ // react refresh
2076
+ "react-refresh/only-export-components": ["warn", { allowConstantExport: isAllowConstantExport }],
1893
2077
  ...typescript2 ? {
2078
+ "react/jsx-no-undef": "off",
1894
2079
  "react/prop-type": "off"
1895
2080
  } : {},
1896
2081
  // overrides
@@ -1909,14 +2094,10 @@ async function react(options) {
1909
2094
  async function astro(options) {
1910
2095
  const {
1911
2096
  a11y = false,
1912
- overrides = {}
1913
- // typescript = true,
2097
+ files = [GLOB_ASTRO],
2098
+ overrides = {},
2099
+ typescript: typescript2 = true
1914
2100
  } = options;
1915
- await interop([
1916
- "eslint-plugin-astro",
1917
- "astro-eslint-parser",
1918
- ...options.a11y ? ["eslint-plugin-jsx-a11y"] : []
1919
- ]);
1920
2101
  const [
1921
2102
  pluginAstro,
1922
2103
  parserAstro,
@@ -1924,7 +2105,7 @@ async function astro(options) {
1924
2105
  ] = await Promise.all([
1925
2106
  interop(import("eslint-plugin-astro")),
1926
2107
  interop(import("astro-eslint-parser")),
1927
- ...options.a11y ? [interop(import("eslint-plugin-jsx-a11y"))] : []
2108
+ ...a11y ? [interop(import("eslint-plugin-jsx-a11y"))] : []
1928
2109
  ]);
1929
2110
  return [
1930
2111
  {
@@ -1935,7 +2116,8 @@ async function astro(options) {
1935
2116
  }
1936
2117
  },
1937
2118
  {
1938
- files: [GLOB_ASTRO],
2119
+ name: "luxass:astro:rules",
2120
+ files,
1939
2121
  languageOptions: {
1940
2122
  // @ts-expect-error hmmm
1941
2123
  globals: {
@@ -1944,21 +2126,22 @@ async function astro(options) {
1944
2126
  parser: parserAstro,
1945
2127
  parserOptions: {
1946
2128
  extraFileExtensions: [".astro"],
1947
- parser: options.typescript ? await interop(import("@typescript-eslint/parser")) : null,
2129
+ parser: typescript2 ? await interop(import("@typescript-eslint/parser")) : null,
1948
2130
  sourceType: "module"
1949
2131
  }
1950
2132
  },
1951
- name: "luxass:astro:rules",
1952
2133
  // @ts-expect-error hmmm
1953
2134
  rules: {
1954
2135
  "style/jsx-closing-tag-location": "off",
1955
2136
  "style/jsx-indent": "off",
1956
2137
  "style/jsx-one-expression-per-line": "off",
1957
2138
  ...pluginAstro.configs.all.rules,
2139
+ "style/multiline-ternary": ["error", "never"],
1958
2140
  ...overrides
1959
2141
  }
1960
2142
  },
1961
2143
  {
2144
+ name: "luxass:astro:rules:scripts",
1962
2145
  files: [
1963
2146
  "**/*.astro/*.js",
1964
2147
  "*.astro/*.js"
@@ -1971,20 +2154,230 @@ async function astro(options) {
1971
2154
  parserOptions: {
1972
2155
  sourceType: "module"
1973
2156
  }
2157
+ }
2158
+ }
2159
+ ];
2160
+ }
2161
+
2162
+ // src/configs/tailwindcss.ts
2163
+ async function tailwindcss(options = {}) {
2164
+ const {
2165
+ files = [GLOB_SRC],
2166
+ overrides
2167
+ } = options;
2168
+ await ensure([
2169
+ "eslint-plugin-tailwindcss"
2170
+ ]);
2171
+ const [
2172
+ pluginTailwindCSS
2173
+ ] = await Promise.all([
2174
+ interop(import("eslint-plugin-tailwindcss"))
2175
+ ]);
2176
+ return [
2177
+ {
2178
+ name: "luxass:tailwindcss:setup",
2179
+ languageOptions: {
2180
+ parserOptions: {
2181
+ ecmaFeatures: {
2182
+ jsx: true
2183
+ }
2184
+ }
1974
2185
  },
1975
- name: "luxass:astro:rules:scripts"
2186
+ plugins: {
2187
+ tailwind: pluginTailwindCSS
2188
+ }
2189
+ },
2190
+ {
2191
+ name: "luxass:tailwindcss:rules",
2192
+ files,
2193
+ rules: {
2194
+ // https://github.com/francoismassart/eslint-plugin-tailwindcss/blob/master/docs/rules/classnames-order.md
2195
+ "tailwind/classnames-order": "warn",
2196
+ // https://github.com/francoismassart/eslint-plugin-tailwindcss/blob/master/docs/rules/enforces-negative-arbitrary-values.md
2197
+ "tailwind/enforces-negative-arbitrary-values": "warn",
2198
+ // https://github.com/francoismassart/eslint-plugin-tailwindcss/blob/master/docs/rules/enforces-shorthand.md
2199
+ "tailwind/enforces-shorthand": "warn",
2200
+ // https://github.com/francoismassart/eslint-plugin-tailwindcss/blob/master/docs/rules/migration-from-tailwind-2.md
2201
+ "tailwind/migration-from-tailwind-2": "warn",
2202
+ // https://github.com/francoismassart/eslint-plugin-tailwindcss/blob/master/docs/rules/no-arbitrary-value.md
2203
+ "tailwind/no-arbitrary-value": "off",
2204
+ // https://github.com/francoismassart/eslint-plugin-tailwindcss/blob/master/docs/rules/no-contradicting-classname.md
2205
+ "tailwind/no-contradicting-classname": "error",
2206
+ // https://github.com/francoismassart/eslint-plugin-tailwindcss/blob/master/docs/rules/no-custom-classname.md
2207
+ "tailwind/no-custom-classname": "warn",
2208
+ ...overrides
2209
+ }
1976
2210
  }
1977
2211
  ];
1978
2212
  }
1979
2213
 
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");
2214
+ // src/configs/formatters.ts
2215
+ var parserPlain2 = __toESM(require("eslint-parser-plain"), 1);
2216
+ async function formatters(options = {}, stylistic2 = {}) {
2217
+ await ensure([
2218
+ "eslint-plugin-format"
2219
+ ]);
2220
+ if (options === true) {
2221
+ options = {
2222
+ css: true,
2223
+ graphql: true,
2224
+ html: true,
2225
+ markdown: true
2226
+ };
2227
+ }
2228
+ const {
2229
+ indent,
2230
+ quotes,
2231
+ semi
2232
+ } = {
2233
+ ...StylisticConfigDefaults,
2234
+ ...stylistic2
2235
+ };
2236
+ const prettierOptions = Object.assign(
2237
+ {
2238
+ endOfLine: "auto",
2239
+ semi,
2240
+ singleQuote: quotes === "single",
2241
+ tabWidth: typeof indent === "number" ? indent : 2,
2242
+ trailingComma: "all",
2243
+ useTabs: indent === "tab"
2244
+ },
2245
+ options.prettierOptions || {}
2246
+ );
2247
+ const dprintOptions = Object.assign(
2248
+ {
2249
+ indentWidth: typeof indent === "number" ? indent : 2,
2250
+ quoteStyle: quotes === "single" ? "preferSingle" : "preferDouble",
2251
+ useTabs: indent === "tab"
2252
+ },
2253
+ options.dprintOptions || {}
2254
+ );
2255
+ const pluginFormat = await interop(import("eslint-plugin-format"));
2256
+ const configs = [
2257
+ {
2258
+ name: "luxass:formatters:setup",
2259
+ plugins: {
2260
+ format: pluginFormat
2261
+ }
2262
+ }
2263
+ ];
2264
+ if (options.css) {
2265
+ configs.push(
2266
+ {
2267
+ name: "luxass:formatter:css",
2268
+ files: [GLOB_CSS, GLOB_POSTCSS],
2269
+ languageOptions: {
2270
+ parser: parserPlain2
2271
+ },
2272
+ rules: {
2273
+ "format/prettier": [
2274
+ "error",
2275
+ {
2276
+ ...prettierOptions,
2277
+ parser: "css"
2278
+ }
2279
+ ]
2280
+ }
2281
+ },
2282
+ {
2283
+ name: "luxass:formatter:scss",
2284
+ files: [GLOB_SCSS],
2285
+ languageOptions: {
2286
+ parser: parserPlain2
2287
+ },
2288
+ rules: {
2289
+ "format/prettier": [
2290
+ "error",
2291
+ {
2292
+ ...prettierOptions,
2293
+ parser: "scss"
2294
+ }
2295
+ ]
2296
+ }
2297
+ },
2298
+ {
2299
+ name: "luxass:formatter:less",
2300
+ files: [GLOB_LESS],
2301
+ languageOptions: {
2302
+ parser: parserPlain2
2303
+ },
2304
+ rules: {
2305
+ "format/prettier": [
2306
+ "error",
2307
+ {
2308
+ ...prettierOptions,
2309
+ parser: "less"
2310
+ }
2311
+ ]
2312
+ }
2313
+ }
2314
+ );
2315
+ }
2316
+ if (options.html) {
2317
+ configs.push({
2318
+ name: "luxass:formatter:html",
2319
+ files: ["**/*.html"],
2320
+ languageOptions: {
2321
+ parser: parserPlain2
2322
+ },
2323
+ rules: {
2324
+ "format/prettier": [
2325
+ "error",
2326
+ {
2327
+ ...prettierOptions,
2328
+ parser: "html"
2329
+ }
2330
+ ]
2331
+ }
2332
+ });
2333
+ }
2334
+ if (options.markdown) {
2335
+ const formater = options.markdown === true ? "prettier" : options.markdown;
2336
+ configs.push({
2337
+ name: "luxass:formatter:markdown",
2338
+ files: [GLOB_MARKDOWN],
2339
+ languageOptions: {
2340
+ parser: parserPlain2
2341
+ },
2342
+ rules: {
2343
+ [`format/${formater}`]: [
2344
+ "error",
2345
+ formater === "prettier" ? {
2346
+ printWidth: 120,
2347
+ ...prettierOptions,
2348
+ embeddedLanguageFormatting: "off",
2349
+ parser: "markdown"
2350
+ } : {
2351
+ ...dprintOptions,
2352
+ language: "markdown"
2353
+ }
2354
+ ]
2355
+ }
2356
+ });
2357
+ }
2358
+ if (options.graphql) {
2359
+ configs.push({
2360
+ name: "luxass:formatter:graphql",
2361
+ files: ["**/*.graphql"],
2362
+ languageOptions: {
2363
+ parser: parserPlain2
2364
+ },
2365
+ rules: {
2366
+ "format/prettier": [
2367
+ "error",
2368
+ {
2369
+ ...prettierOptions,
2370
+ parser: "graphql"
2371
+ }
2372
+ ]
2373
+ }
2374
+ });
2375
+ }
2376
+ return configs;
2377
+ }
1984
2378
 
1985
2379
  // src/constants.ts
1986
2380
  var VUE_PACKAGES = ["vue", "nuxt", "vitepress", "@slidev/cli"];
1987
- var UNO_PACKAGES = ["unocss", "@unocss/webpack", "@unocss/nuxt"];
1988
2381
  var FLAT_CONFIG_PROPS = [
1989
2382
  "files",
1990
2383
  "ignores",
@@ -1996,21 +2389,78 @@ var FLAT_CONFIG_PROPS = [
1996
2389
  "settings"
1997
2390
  ];
1998
2391
 
2392
+ // src/configs/toml.ts
2393
+ async function toml(options = {}) {
2394
+ const {
2395
+ files = [GLOB_TOML],
2396
+ overrides = {},
2397
+ stylistic: stylistic2 = true
2398
+ } = options;
2399
+ const {
2400
+ indent = 2
2401
+ } = typeof stylistic2 === "boolean" ? {} : stylistic2;
2402
+ const [
2403
+ pluginToml,
2404
+ parserToml
2405
+ ] = await Promise.all([
2406
+ interop(import("eslint-plugin-toml")),
2407
+ interop(import("toml-eslint-parser"))
2408
+ ]);
2409
+ return [
2410
+ {
2411
+ name: "luxass:toml:setup",
2412
+ plugins: {
2413
+ toml: pluginToml
2414
+ }
2415
+ },
2416
+ {
2417
+ name: "luxass:toml:rules",
2418
+ files,
2419
+ languageOptions: {
2420
+ parser: parserToml
2421
+ },
2422
+ rules: {
2423
+ "style/spaced-comment": "off",
2424
+ "toml/comma-style": "error",
2425
+ "toml/keys-order": "error",
2426
+ "toml/no-space-dots": "error",
2427
+ "toml/no-unreadable-number-separator": "error",
2428
+ "toml/precision-of-fractional-seconds": "error",
2429
+ "toml/precision-of-integer": "error",
2430
+ "toml/tables-order": "error",
2431
+ "toml/vue-custom-block/no-parsing-error": "error",
2432
+ ...stylistic2 ? {
2433
+ "toml/array-bracket-newline": "error",
2434
+ "toml/array-bracket-spacing": "error",
2435
+ "toml/array-element-newline": "error",
2436
+ "toml/indent": ["error", indent === "tab" ? 2 : indent],
2437
+ "toml/inline-table-curly-spacing": "error",
2438
+ "toml/key-spacing": "error",
2439
+ "toml/padding-line-between-pairs": "error",
2440
+ "toml/padding-line-between-tables": "error",
2441
+ "toml/quoted-keys": "error",
2442
+ "toml/spaced-comment": "error",
2443
+ "toml/table-bracket-spacing": "error"
2444
+ } : {},
2445
+ ...overrides
2446
+ }
2447
+ }
2448
+ ];
2449
+ }
2450
+
1999
2451
  // src/factory.ts
2000
2452
  async function luxass(options = {}, ...userConfigs) {
2001
2453
  const {
2002
- astro: enableAstro = (0, import_local_pkg2.isPackageExists)("astro"),
2003
- componentExts = [],
2454
+ astro: enableAstro = (0, import_local_pkg3.isPackageExists)("astro"),
2455
+ 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),
2456
+ exts = [],
2004
2457
  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
2458
  nextjs: enableNextJS = false,
2007
- overrides = {},
2008
- perfectionist: enablePerfectionistRules = false,
2009
2459
  react: enableReact = false,
2010
2460
  tailwindcss: enableTailwindCSS = false,
2011
- typescript: enableTypeScript = (0, import_local_pkg2.isPackageExists)("typescript"),
2012
- unocss: enableUnoCSS = UNO_PACKAGES.some((i) => (0, import_local_pkg2.isPackageExists)(i)),
2013
- vue: enableVue = VUE_PACKAGES.some((i) => (0, import_local_pkg2.isPackageExists)(i))
2461
+ typescript: enableTypeScript = (0, import_local_pkg3.isPackageExists)("typescript"),
2462
+ unocss: enableUnoCSS = false,
2463
+ vue: enableVue = VUE_PACKAGES.some((i) => (0, import_local_pkg3.isPackageExists)(i))
2014
2464
  } = options;
2015
2465
  const stylisticOptions = options.stylistic === false ? false : typeof options.stylistic === "object" ? options.stylistic : {};
2016
2466
  if (stylisticOptions && !("jsx" in stylisticOptions)) {
@@ -2029,8 +2479,8 @@ async function luxass(options = {}, ...userConfigs) {
2029
2479
  configs.push(
2030
2480
  ignores(),
2031
2481
  javascript({
2032
- isEditor,
2033
- overrides: overrides.javascript
2482
+ editor,
2483
+ overrides: getOverrides(options, "javascript")
2034
2484
  }),
2035
2485
  comments(),
2036
2486
  node(),
@@ -2041,54 +2491,46 @@ async function luxass(options = {}, ...userConfigs) {
2041
2491
  stylistic: stylisticOptions
2042
2492
  }),
2043
2493
  unicorn(),
2044
- perfectionist({
2045
- enableAllRules: enablePerfectionistRules
2046
- })
2494
+ perfectionist()
2047
2495
  );
2048
2496
  if (enableVue) {
2049
- componentExts.push("vue");
2497
+ exts.push("vue");
2050
2498
  }
2051
2499
  if (enableTypeScript) {
2052
- configs.push(
2053
- typescript({
2054
- ...typeof enableTypeScript !== "boolean" ? enableTypeScript : {},
2055
- componentExts,
2056
- overrides: overrides.typescript
2057
- })
2058
- );
2500
+ configs.push(typescript({
2501
+ ...resolveSubOptions(options, "typescript"),
2502
+ exts
2503
+ }));
2059
2504
  }
2060
2505
  if (stylisticOptions) {
2061
- configs.push(stylistic(stylisticOptions));
2506
+ configs.push(stylistic({
2507
+ ...stylisticOptions,
2508
+ overrides: getOverrides(options, "stylistic")
2509
+ }));
2062
2510
  }
2063
2511
  if (options.test ?? true) {
2064
- configs.push(
2065
- test({
2066
- isEditor,
2067
- overrides: overrides.test
2068
- })
2069
- );
2512
+ configs.push(test({
2513
+ editor,
2514
+ overrides: getOverrides(options, "test")
2515
+ }));
2070
2516
  }
2071
2517
  if (enableReact || enableNextJS) {
2072
- configs.push(
2073
- react({
2074
- ...typeof enableReact !== "boolean" ? enableReact : {},
2075
- overrides: overrides.react,
2076
- typescript: !!enableTypeScript
2077
- })
2078
- );
2518
+ configs.push(react({
2519
+ overrides: getOverrides(options, "react"),
2520
+ typescript: !!enableTypeScript
2521
+ }));
2079
2522
  }
2080
2523
  if (enableNextJS) {
2081
2524
  configs.push(
2082
2525
  nextjs({
2083
- ...typeof enableNextJS !== "boolean" ? enableNextJS : {},
2084
- overrides: overrides.nextjs
2526
+ ...resolveSubOptions(options, "nextjs")
2085
2527
  })
2086
2528
  );
2087
2529
  }
2088
2530
  if (enableVue) {
2089
2531
  configs.push(
2090
2532
  vue({
2091
- overrides: overrides.vue,
2533
+ ...resolveSubOptions(options, "vue"),
2092
2534
  stylistic: stylisticOptions,
2093
2535
  typescript: !!enableTypeScript
2094
2536
  })
@@ -2097,34 +2539,27 @@ async function luxass(options = {}, ...userConfigs) {
2097
2539
  if (enableAstro) {
2098
2540
  configs.push(
2099
2541
  astro({
2100
- ...typeof enableAstro !== "boolean" ? enableAstro : {},
2101
- overrides: overrides.astro,
2542
+ ...resolveSubOptions(options, "astro"),
2102
2543
  typescript: !!enableTypeScript
2103
2544
  })
2104
2545
  );
2105
2546
  }
2106
2547
  if (enableUnoCSS) {
2107
- configs.push(
2108
- unocss({
2109
- ...typeof enableUnoCSS !== "boolean" ? enableUnoCSS : {},
2110
- overrides: overrides.unocss
2111
- })
2112
- );
2548
+ configs.push(unocss({
2549
+ ...resolveSubOptions(options, "unocss"),
2550
+ overrides: getOverrides(options, "unocss")
2551
+ }));
2113
2552
  }
2114
2553
  if (enableTailwindCSS) {
2115
2554
  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
2555
+ ...resolveSubOptions(options, "tailwindcss"),
2556
+ overrides: getOverrides(options, "tailwindcss")
2122
2557
  }));
2123
2558
  }
2124
2559
  if (options.jsonc ?? true) {
2125
2560
  configs.push(
2126
2561
  jsonc({
2127
- overrides: overrides.jsonc,
2562
+ overrides: getOverrides(options, "jsonc"),
2128
2563
  stylistic: stylisticOptions
2129
2564
  }),
2130
2565
  sortPackageJson(),
@@ -2132,21 +2567,33 @@ async function luxass(options = {}, ...userConfigs) {
2132
2567
  );
2133
2568
  }
2134
2569
  if (options.yaml ?? true) {
2135
- configs.push(
2136
- yaml({
2137
- overrides: overrides.yaml,
2138
- stylistic: stylisticOptions
2139
- })
2140
- );
2570
+ configs.push(yaml({
2571
+ overrides: getOverrides(options, "yaml"),
2572
+ stylistic: stylisticOptions
2573
+ }));
2574
+ }
2575
+ if (options.toml ?? true) {
2576
+ configs.push(toml({
2577
+ overrides: getOverrides(options, "toml"),
2578
+ stylistic: stylisticOptions
2579
+ }));
2141
2580
  }
2142
2581
  if (options.markdown ?? true) {
2143
2582
  configs.push(
2144
- markdown({
2145
- componentExts,
2146
- overrides: overrides.markdown
2147
- })
2583
+ markdown(
2584
+ {
2585
+ exts,
2586
+ overrides: getOverrides(options, "markdown")
2587
+ }
2588
+ )
2148
2589
  );
2149
2590
  }
2591
+ if (options.formatters) {
2592
+ configs.push(formatters(
2593
+ options.formatters,
2594
+ typeof stylisticOptions === "boolean" ? {} : stylisticOptions
2595
+ ));
2596
+ }
2150
2597
  const fusedConfig = FLAT_CONFIG_PROPS.reduce((acc, key) => {
2151
2598
  if (key in options) {
2152
2599
  acc[key] = options[key];
@@ -2159,33 +2606,14 @@ async function luxass(options = {}, ...userConfigs) {
2159
2606
  const merged = combine(...configs, ...userConfigs);
2160
2607
  return merged;
2161
2608
  }
2609
+
2610
+ // src/index.ts
2611
+ var src_default = luxass;
2162
2612
  // Annotate the CommonJS export names for ESM import in node:
2163
2613
  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
2614
  astro,
2188
2615
  comments,
2616
+ formatters,
2189
2617
  ignores,
2190
2618
  imports,
2191
2619
  javascript,