@luxass/eslint-config 4.0.0-beta.8 → 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-I2ECCPNN.mjs → chunk-PYS26PF3.mjs} +15 -10
  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 +1116 -707
  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 +15 -12
  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 +34 -45
  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 +74 -4
  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 -2
  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 +1470 -1040
  132. package/dist/index.d.cts +10 -44
  133. package/dist/index.d.ts +10 -44
  134. package/dist/index.mjs +106 -140
  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-4JKENKIP.mjs +0 -67
  141. package/dist/chunk-C5VMTRKT.mjs +0 -18
  142. package/dist/chunk-CFSYEIE4.mjs +0 -23
  143. package/dist/chunk-ERFDRAGW.mjs +0 -86
  144. package/dist/chunk-HLDEUDLN.mjs +0 -28
  145. package/dist/chunk-UBPIYSHC.mjs +0 -284
  146. package/dist/types-fxhbVLKI.d.cts +0 -235
  147. package/dist/types-fxhbVLKI.d.ts +0 -235
  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,167 +229,428 @@ function ignores() {
192
229
  ];
193
230
  }
194
231
 
195
- // src/configs/imports.ts
196
- async function imports(options = {}) {
197
- const {
198
- stylistic: stylistic2 = true
199
- } = options;
232
+ // src/configs/node.ts
233
+ var import_eslint_plugin_n = __toESM(require("eslint-plugin-n"), 1);
234
+ function node() {
200
235
  return [
201
236
  {
202
- name: "luxass:imports",
237
+ name: "luxass:node",
203
238
  plugins: {
204
- antfu: import_eslint_plugin_antfu.default,
205
- import: pluginImport
239
+ node: import_eslint_plugin_n.default
206
240
  },
207
241
  rules: {
208
- "antfu/import-dedupe": "error",
209
- "antfu/no-import-node-modules-by-path": "error",
210
- "import/first": "error",
211
- "import/no-duplicates": "error",
212
- "import/no-mutable-exports": "error",
213
- "import/no-named-default": "error",
214
- "import/no-self-import": "error",
215
- "import/no-webpack-loader-syntax": "error",
216
- "import/order": "error",
217
- ...stylistic2 ? {
218
- "import/newline-after-import": ["error", { considerComments: true, count: 1 }]
219
- } : {}
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"
220
250
  }
221
251
  }
222
252
  ];
223
253
  }
224
254
 
225
- // src/configs/javascript.ts
226
- var import_globals = __toESM(require("globals"), 1);
227
- async function javascript(options = {}) {
228
- const { isEditor = false, overrides = {} } = options;
255
+ // src/configs/sort.ts
256
+ function sortPackageJson() {
229
257
  return [
230
258
  {
231
- languageOptions: {
232
- ecmaVersion: 2022,
233
- globals: {
234
- ...import_globals.default.browser,
235
- ...import_globals.default.es2021,
236
- ...import_globals.default.node,
237
- document: "readonly",
238
- navigator: "readonly",
239
- window: "readonly"
240
- },
241
- parserOptions: {
242
- ecmaFeatures: {
243
- jsx: true
244
- },
245
- ecmaVersion: 2022,
246
- sourceType: "module"
247
- },
248
- sourceType: "module"
249
- },
250
- linterOptions: {
251
- reportUnusedDisableDirectives: true
252
- },
253
- name: "luxass:javascript",
254
- plugins: {
255
- "antfu": import_eslint_plugin_antfu.default,
256
- "unused-imports": import_eslint_plugin_unused_imports.default
257
- },
259
+ name: "luxass:sort-package-json",
260
+ files: ["**/package.json"],
258
261
  rules: {
259
- "accessor-pairs": [
260
- "error",
261
- { enforceForClassMembers: true, setWithoutGet: true }
262
- ],
263
- "array-callback-return": "error",
264
- "block-scoped-var": "error",
265
- "constructor-super": "error",
266
- "default-case-last": "error",
267
- "dot-notation": ["error", { allowKeywords: true }],
268
- "eqeqeq": ["error", "smart"],
269
- "new-cap": [
270
- "error",
271
- { capIsNew: false, newIsCap: true, properties: true }
272
- ],
273
- "no-alert": "error",
274
- "no-array-constructor": "error",
275
- "no-async-promise-executor": "error",
276
- "no-caller": "error",
277
- "no-case-declarations": "error",
278
- "no-class-assign": "error",
279
- "no-compare-neg-zero": "error",
280
- "no-cond-assign": ["error", "always"],
281
- "no-console": [
282
- isEditor ? "off" : "error",
283
- { allow: ["warn", "error"] }
284
- ],
285
- "no-const-assign": "error",
286
- "no-control-regex": "error",
287
- "no-debugger": "error",
288
- "no-delete-var": "error",
289
- "no-dupe-args": "error",
290
- "no-dupe-class-members": "error",
291
- "no-dupe-keys": "error",
292
- "no-duplicate-case": "error",
293
- "no-empty": ["error", { allowEmptyCatch: true }],
294
- "no-empty-character-class": "error",
295
- "no-empty-pattern": "error",
296
- "no-eval": "error",
297
- "no-ex-assign": "error",
298
- "no-extend-native": "error",
299
- "no-extra-bind": "error",
300
- "no-extra-boolean-cast": "error",
301
- "no-fallthrough": "error",
302
- "no-func-assign": "error",
303
- "no-global-assign": "error",
304
- "no-implied-eval": "error",
305
- "no-import-assign": "error",
306
- "no-invalid-regexp": "error",
307
- "no-invalid-this": "error",
308
- "no-irregular-whitespace": "error",
309
- "no-iterator": "error",
310
- "no-labels": ["error", { allowLoop: false, allowSwitch: false }],
311
- "no-lone-blocks": "error",
312
- "no-loss-of-precision": "error",
313
- "no-misleading-character-class": "error",
314
- "no-multi-str": "error",
315
- "no-new": "error",
316
- "no-new-func": "error",
317
- "no-new-object": "error",
318
- "no-new-symbol": "error",
319
- "no-new-wrappers": "error",
320
- "no-obj-calls": "error",
321
- "no-octal": "error",
322
- "no-octal-escape": "error",
323
- "no-proto": "error",
324
- "no-prototype-builtins": "error",
325
- "no-redeclare": ["error", { builtinGlobals: false }],
326
- "no-regex-spaces": "error",
327
- "no-restricted-globals": [
262
+ "jsonc/sort-array-values": [
328
263
  "error",
329
- { message: "Use `globalThis` instead.", name: "global" },
330
- { message: "Use `globalThis` instead.", name: "self" }
264
+ {
265
+ order: { type: "asc" },
266
+ pathPattern: "^files$"
267
+ }
331
268
  ],
332
- "no-restricted-properties": [
269
+ "jsonc/sort-keys": [
333
270
  "error",
334
271
  {
335
- message: "Use `Object.getPrototypeOf` or `Object.setPrototypeOf` instead.",
336
- property: "__proto__"
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: "^$"
337
318
  },
338
319
  {
339
- message: "Use `Object.defineProperty` instead.",
340
- property: "__defineGetter__"
320
+ order: { type: "asc" },
321
+ pathPattern: "^(?:dev|peer|optional|bundled)?[Dd]ependencies$"
341
322
  },
342
323
  {
343
- message: "Use `Object.defineProperty` instead.",
344
- property: "__defineSetter__"
324
+ order: { type: "asc" },
325
+ pathPattern: "^resolutions$"
345
326
  },
346
327
  {
347
- message: "Use `Object.getOwnPropertyDescriptor` instead.",
348
- property: "__lookupGetter__"
328
+ order: { type: "asc" },
329
+ pathPattern: "^pnpm.overrides$"
349
330
  },
350
331
  {
351
- message: "Use `Object.getOwnPropertyDescriptor` instead.",
352
- property: "__lookupSetter__"
332
+ order: ["types", "import", "require", "default"],
333
+ pathPattern: "^exports.*$"
353
334
  }
354
- ],
355
- "no-restricted-syntax": [
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
+
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);
483
+ async function imports(options = {}) {
484
+ const {
485
+ stylistic: stylistic2 = true
486
+ } = options;
487
+ return [
488
+ {
489
+ name: "luxass:imports",
490
+ plugins: {
491
+ antfu: import_eslint_plugin_antfu.default,
492
+ import: import_eslint_plugin_i.default
493
+ },
494
+ rules: {
495
+ "antfu/import-dedupe": "error",
496
+ "antfu/no-import-dist": "error",
497
+ "antfu/no-import-node-modules-by-path": "error",
498
+ "import/first": "error",
499
+ "import/no-duplicates": "error",
500
+ "import/no-mutable-exports": "error",
501
+ "import/no-named-default": "error",
502
+ "import/no-self-import": "error",
503
+ "import/no-webpack-loader-syntax": "error",
504
+ "import/order": "error",
505
+ ...stylistic2 ? {
506
+ "import/newline-after-import": ["error", { considerComments: true, count: 1 }]
507
+ } : {}
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
+ }
517
+ }
518
+ ];
519
+ }
520
+
521
+ // src/configs/javascript.ts
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);
525
+ async function javascript(options = {}) {
526
+ const { editor = false, overrides = {} } = options;
527
+ return [
528
+ {
529
+ name: "luxass:javascript",
530
+ languageOptions: {
531
+ ecmaVersion: 2022,
532
+ globals: {
533
+ ...import_globals.default.browser,
534
+ ...import_globals.default.es2021,
535
+ ...import_globals.default.node,
536
+ document: "readonly",
537
+ navigator: "readonly",
538
+ window: "readonly"
539
+ },
540
+ parserOptions: {
541
+ ecmaFeatures: {
542
+ jsx: true
543
+ },
544
+ ecmaVersion: 2022,
545
+ sourceType: "module"
546
+ },
547
+ sourceType: "module"
548
+ },
549
+ linterOptions: {
550
+ reportUnusedDisableDirectives: true
551
+ },
552
+ plugins: {
553
+ "antfu": import_eslint_plugin_antfu2.default,
554
+ "unused-imports": import_eslint_plugin_unused_imports.default
555
+ },
556
+ rules: {
557
+ "accessor-pairs": [
558
+ "error",
559
+ { enforceForClassMembers: true, setWithoutGet: true }
560
+ ],
561
+ "array-callback-return": "error",
562
+ "block-scoped-var": "error",
563
+ "constructor-super": "error",
564
+ "default-case-last": "error",
565
+ "dot-notation": ["error", { allowKeywords: true }],
566
+ "eqeqeq": ["error", "smart"],
567
+ "new-cap": [
568
+ "error",
569
+ { capIsNew: false, newIsCap: true, properties: true }
570
+ ],
571
+ "no-alert": "error",
572
+ "no-array-constructor": "error",
573
+ "no-async-promise-executor": "error",
574
+ "no-caller": "error",
575
+ "no-case-declarations": "error",
576
+ "no-class-assign": "error",
577
+ "no-compare-neg-zero": "error",
578
+ "no-cond-assign": ["error", "always"],
579
+ "no-console": [
580
+ editor ? "off" : "error",
581
+ { allow: ["warn", "error"] }
582
+ ],
583
+ "no-const-assign": "error",
584
+ "no-control-regex": "error",
585
+ "no-debugger": "error",
586
+ "no-delete-var": "error",
587
+ "no-dupe-args": "error",
588
+ "no-dupe-class-members": "error",
589
+ "no-dupe-keys": "error",
590
+ "no-duplicate-case": "error",
591
+ "no-empty": ["error", { allowEmptyCatch: true }],
592
+ "no-empty-character-class": "error",
593
+ "no-empty-pattern": "error",
594
+ "no-eval": "error",
595
+ "no-ex-assign": "error",
596
+ "no-extend-native": "error",
597
+ "no-extra-bind": "error",
598
+ "no-extra-boolean-cast": "error",
599
+ "no-fallthrough": "error",
600
+ "no-func-assign": "error",
601
+ "no-global-assign": "error",
602
+ "no-implied-eval": "error",
603
+ "no-import-assign": "error",
604
+ "no-invalid-regexp": "error",
605
+ "no-invalid-this": "error",
606
+ "no-irregular-whitespace": "error",
607
+ "no-iterator": "error",
608
+ "no-labels": ["error", { allowLoop: false, allowSwitch: false }],
609
+ "no-lone-blocks": "error",
610
+ "no-loss-of-precision": "error",
611
+ "no-misleading-character-class": "error",
612
+ "no-multi-str": "error",
613
+ "no-new": "error",
614
+ "no-new-func": "error",
615
+ "no-new-object": "error",
616
+ "no-new-symbol": "error",
617
+ "no-new-wrappers": "error",
618
+ "no-obj-calls": "error",
619
+ "no-octal": "error",
620
+ "no-octal-escape": "error",
621
+ "no-proto": "error",
622
+ "no-prototype-builtins": "error",
623
+ "no-redeclare": ["error", { builtinGlobals: false }],
624
+ "no-regex-spaces": "error",
625
+ "no-restricted-globals": [
626
+ "error",
627
+ { name: "global", message: "Use `globalThis` instead." },
628
+ { name: "self", message: "Use `globalThis` instead." }
629
+ ],
630
+ "no-restricted-properties": [
631
+ "error",
632
+ {
633
+ message: "Use `Object.getPrototypeOf` or `Object.setPrototypeOf` instead.",
634
+ property: "__proto__"
635
+ },
636
+ {
637
+ message: "Use `Object.defineProperty` instead.",
638
+ property: "__defineGetter__"
639
+ },
640
+ {
641
+ message: "Use `Object.defineProperty` instead.",
642
+ property: "__defineSetter__"
643
+ },
644
+ {
645
+ message: "Use `Object.getOwnPropertyDescriptor` instead.",
646
+ property: "__lookupGetter__"
647
+ },
648
+ {
649
+ message: "Use `Object.getOwnPropertyDescriptor` instead.",
650
+ property: "__lookupSetter__"
651
+ }
652
+ ],
653
+ "no-restricted-syntax": [
356
654
  "error",
357
655
  "DebuggerStatement",
358
656
  "LabeledStatement",
@@ -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,429 +825,246 @@ async function ensure(packages) {
527
825
  }
528
826
  ;
529
827
  }
530
-
531
- // src/configs/jsdoc.ts
532
- async function jsdoc(options = {}) {
533
- const { stylistic: stylistic2 = true } = options;
534
- return [
535
- {
536
- name: "luxass:jsdoc",
537
- plugins: {
538
- jsdoc: await interop(import("eslint-plugin-jsdoc"))
539
- },
540
- rules: {
541
- "jsdoc/check-access": "warn",
542
- "jsdoc/check-param-names": "warn",
543
- "jsdoc/check-property-names": "warn",
544
- "jsdoc/check-types": "warn",
545
- "jsdoc/empty-tags": "warn",
546
- "jsdoc/implements-on-classes": "warn",
547
- "jsdoc/no-defaults": "warn",
548
- "jsdoc/no-multi-asterisks": "warn",
549
- "jsdoc/require-param-name": "warn",
550
- "jsdoc/require-property": "warn",
551
- "jsdoc/require-property-description": "warn",
552
- "jsdoc/require-property-name": "warn",
553
- "jsdoc/require-returns-check": "warn",
554
- "jsdoc/require-returns-description": "warn",
555
- "jsdoc/require-yields-check": "warn",
556
- ...stylistic2 ? {
557
- "jsdoc/check-alignment": "warn",
558
- "jsdoc/multiline-blocks": "warn"
559
- } : {}
560
- }
561
- }
562
- ];
563
- }
564
-
565
- // src/configs/jsonc.ts
566
- async function jsonc(options = {}) {
567
- const { overrides = {}, stylistic: stylistic2 = true } = options;
568
- const [
569
- pluginJsonc,
570
- parserJsonc
571
- ] = await Promise.all([
572
- interop(import("eslint-plugin-jsonc")),
573
- interop(import("jsonc-eslint-parser"))
574
- ]);
575
- return [
576
- {
577
- name: "luxass:jsonc:setup",
578
- plugins: {
579
- jsonc: pluginJsonc
580
- }
581
- },
582
- {
583
- files: [GLOB_JSON, GLOB_JSON5, GLOB_JSONC],
584
- languageOptions: {
585
- parser: parserJsonc
586
- },
587
- name: "luxass:jsonc:rules",
588
- rules: {
589
- "jsonc/no-bigint-literals": "error",
590
- "jsonc/no-binary-expression": "error",
591
- "jsonc/no-binary-numeric-literals": "error",
592
- "jsonc/no-dupe-keys": "error",
593
- "jsonc/no-escape-sequence-in-identifier": "error",
594
- "jsonc/no-floating-decimal": "error",
595
- "jsonc/no-hexadecimal-numeric-literals": "error",
596
- "jsonc/no-infinity": "error",
597
- "jsonc/no-multi-str": "error",
598
- "jsonc/no-nan": "error",
599
- "jsonc/no-number-props": "error",
600
- "jsonc/no-numeric-separators": "error",
601
- "jsonc/no-octal": "error",
602
- "jsonc/no-octal-escape": "error",
603
- "jsonc/no-octal-numeric-literals": "error",
604
- "jsonc/no-parenthesized": "error",
605
- "jsonc/no-plus-sign": "error",
606
- "jsonc/no-regexp-literals": "error",
607
- "jsonc/no-sparse-arrays": "error",
608
- "jsonc/no-template-literals": "error",
609
- "jsonc/no-undefined-value": "error",
610
- "jsonc/no-unicode-codepoint-escapes": "error",
611
- "jsonc/no-useless-escape": "error",
612
- "jsonc/space-unary-ops": "error",
613
- "jsonc/valid-json-number": "error",
614
- "jsonc/vue-custom-block/no-parsing-error": "error",
615
- ...stylistic2 ? {
616
- "jsonc/array-bracket-spacing": ["error", "never"],
617
- "jsonc/comma-dangle": ["error", "never"],
618
- "jsonc/comma-style": ["error", "last"],
619
- "jsonc/indent": ["error", 2],
620
- "jsonc/key-spacing": [
621
- "error",
622
- { afterColon: true, beforeColon: false }
623
- ],
624
- "jsonc/object-curly-newline": [
625
- "error",
626
- { consistent: true, multiline: true }
627
- ],
628
- "jsonc/object-curly-spacing": ["error", "always"],
629
- "jsonc/object-property-newline": [
630
- "error",
631
- { allowMultiplePropertiesPerLine: true }
632
- ],
633
- "jsonc/quote-props": "error",
634
- "jsonc/quotes": "error"
635
- } : {},
636
- ...overrides
637
- }
638
- }
639
- ];
640
- }
641
-
642
- // src/configs/markdown.ts
643
- async function markdown(options = {}) {
644
- const { componentExts = [], overrides = {} } = options;
645
- return [
646
- {
647
- name: "luxass:markdown:setup",
648
- plugins: {
649
- markdown: await interop(import("eslint-plugin-markdown"))
650
- }
651
- },
652
- {
653
- files: [GLOB_MARKDOWN],
654
- name: "luxass:markdown:processor",
655
- processor: "markdown/markdown"
656
- },
657
- {
658
- files: [
659
- GLOB_MARKDOWN_CODE,
660
- ...componentExts.map((ext) => `${GLOB_MARKDOWN}/**/*.${ext}`)
661
- ],
662
- languageOptions: {
663
- parserOptions: {
664
- ecmaFeatures: {
665
- impliedStrict: true
666
- }
667
- }
668
- },
669
- name: "luxass:markdown:rules",
670
- rules: {
671
- "antfu/no-cjs-exports": "off",
672
- "antfu/no-ts-export-equal": "off",
673
- "import/newline-after-import": "off",
674
- "no-alert": "off",
675
- "no-console": "off",
676
- "no-undef": "off",
677
- "no-unused-expressions": "off",
678
- "no-unused-vars": "off",
679
- "node/prefer-global/process": "off",
680
- "style/comma-dangle": "off",
681
- "style/eol-last": "off",
682
- "ts/consistent-type-imports": "off",
683
- "ts/no-namespace": "off",
684
- "ts/no-redeclare": "off",
685
- "ts/no-require-imports": "off",
686
- "ts/no-unused-vars": "off",
687
- "ts/no-use-before-define": "off",
688
- "ts/no-var-requires": "off",
689
- "unicode-bom": "off",
690
- "unused-imports/no-unused-imports": "off",
691
- "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
- ...overrides
712
- }
713
- }
714
- ];
715
- }
716
-
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
- ];
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
+ };
737
836
  }
738
837
 
739
- // src/configs/sort.ts
740
- function sortPackageJson() {
838
+ // src/configs/jsdoc.ts
839
+ async function jsdoc(options = {}) {
840
+ const {
841
+ overrides,
842
+ stylistic: stylistic2 = true
843
+ } = options;
741
844
  return [
742
845
  {
743
- files: ["**/package.json"],
744
- name: "luxass:sort-package-json",
846
+ name: "luxass:jsdoc",
847
+ plugins: {
848
+ jsdoc: await interop(import("eslint-plugin-jsdoc"))
849
+ },
745
850
  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
- ]
851
+ "jsdoc/check-access": "warn",
852
+ "jsdoc/check-param-names": "warn",
853
+ "jsdoc/check-property-names": "warn",
854
+ "jsdoc/check-types": "warn",
855
+ "jsdoc/empty-tags": "warn",
856
+ "jsdoc/implements-on-classes": "warn",
857
+ "jsdoc/no-defaults": "warn",
858
+ "jsdoc/no-multi-asterisks": "warn",
859
+ "jsdoc/require-param-name": "warn",
860
+ "jsdoc/require-property": "warn",
861
+ "jsdoc/require-property-description": "warn",
862
+ "jsdoc/require-property-name": "warn",
863
+ "jsdoc/require-returns-check": "warn",
864
+ "jsdoc/require-returns-description": "warn",
865
+ "jsdoc/require-yields-check": "warn",
866
+ ...stylistic2 ? {
867
+ "jsdoc/check-alignment": "warn",
868
+ "jsdoc/multiline-blocks": "warn"
869
+ } : {},
870
+ ...overrides
820
871
  }
821
872
  }
822
873
  ];
823
874
  }
824
- function sortTsconfig() {
875
+
876
+ // src/configs/jsonc.ts
877
+ async function jsonc(options = {}) {
878
+ const {
879
+ files = [GLOB_JSON, GLOB_JSON5, GLOB_JSONC],
880
+ overrides = {},
881
+ stylistic: stylistic2 = true
882
+ } = options;
883
+ const [
884
+ pluginJsonc,
885
+ parserJsonc
886
+ ] = await Promise.all([
887
+ interop(import("eslint-plugin-jsonc")),
888
+ interop(import("jsonc-eslint-parser"))
889
+ ]);
825
890
  return [
826
891
  {
827
- files: ["**/tsconfig.json", "**/tsconfig.*.json"],
828
- name: "luxass:sort-tsconfig",
892
+ name: "luxass:jsonc:setup",
893
+ plugins: {
894
+ jsonc: pluginJsonc
895
+ }
896
+ },
897
+ {
898
+ name: "luxass:jsonc:rules",
899
+ files,
900
+ languageOptions: {
901
+ parser: parserJsonc
902
+ },
829
903
  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$"
904
+ "jsonc/no-bigint-literals": "error",
905
+ "jsonc/no-binary-expression": "error",
906
+ "jsonc/no-binary-numeric-literals": "error",
907
+ "jsonc/no-dupe-keys": "error",
908
+ "jsonc/no-escape-sequence-in-identifier": "error",
909
+ "jsonc/no-floating-decimal": "error",
910
+ "jsonc/no-hexadecimal-numeric-literals": "error",
911
+ "jsonc/no-infinity": "error",
912
+ "jsonc/no-multi-str": "error",
913
+ "jsonc/no-nan": "error",
914
+ "jsonc/no-number-props": "error",
915
+ "jsonc/no-numeric-separators": "error",
916
+ "jsonc/no-octal": "error",
917
+ "jsonc/no-octal-escape": "error",
918
+ "jsonc/no-octal-numeric-literals": "error",
919
+ "jsonc/no-parenthesized": "error",
920
+ "jsonc/no-plus-sign": "error",
921
+ "jsonc/no-regexp-literals": "error",
922
+ "jsonc/no-sparse-arrays": "error",
923
+ "jsonc/no-template-literals": "error",
924
+ "jsonc/no-undefined-value": "error",
925
+ "jsonc/no-unicode-codepoint-escapes": "error",
926
+ "jsonc/no-useless-escape": "error",
927
+ "jsonc/space-unary-ops": "error",
928
+ "jsonc/valid-json-number": "error",
929
+ "jsonc/vue-custom-block/no-parsing-error": "error",
930
+ ...stylistic2 ? {
931
+ "jsonc/array-bracket-spacing": ["error", "never"],
932
+ "jsonc/comma-dangle": ["error", "never"],
933
+ "jsonc/comma-style": ["error", "last"],
934
+ "jsonc/indent": ["error", 2],
935
+ "jsonc/key-spacing": [
936
+ "error",
937
+ { afterColon: true, beforeColon: false }
938
+ ],
939
+ "jsonc/object-curly-newline": [
940
+ "error",
941
+ { consistent: true, multiline: true }
942
+ ],
943
+ "jsonc/object-curly-spacing": ["error", "always"],
944
+ "jsonc/object-property-newline": [
945
+ "error",
946
+ { allowMultiplePropertiesPerLine: true }
947
+ ],
948
+ "jsonc/quote-props": "error",
949
+ "jsonc/quotes": "error"
950
+ } : {},
951
+ ...overrides
952
+ }
953
+ }
954
+ ];
955
+ }
956
+
957
+ // src/configs/markdown.ts
958
+ var parserPlain = __toESM(require("eslint-parser-plain"), 1);
959
+ var import_eslint_merge_processors = require("eslint-merge-processors");
960
+ async function markdown(options = {}) {
961
+ const {
962
+ exts = [],
963
+ files = [GLOB_MARKDOWN],
964
+ overrides = {}
965
+ } = options;
966
+ const markdown2 = await interop(import("eslint-plugin-markdown"));
967
+ return [
968
+ {
969
+ name: "luxass:markdown:setup",
970
+ plugins: {
971
+ markdown: markdown2
972
+ }
973
+ },
974
+ {
975
+ name: "luxass:markdown:processor",
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
+ }
992
+ },
993
+ {
994
+ name: "luxass:markdown:disables",
995
+ files: [
996
+ GLOB_MARKDOWN_CODE,
997
+ ...exts.map((ext) => `${GLOB_MARKDOWN}/**/*.${ext}`)
998
+ ],
999
+ languageOptions: {
1000
+ parserOptions: {
1001
+ ecmaFeatures: {
1002
+ impliedStrict: true
943
1003
  }
944
- ]
1004
+ }
1005
+ },
1006
+ rules: {
1007
+ "import/newline-after-import": "off",
1008
+ "no-alert": "off",
1009
+ "no-console": "off",
1010
+ "no-undef": "off",
1011
+ "no-unused-expressions": "off",
1012
+ "no-unused-vars": "off",
1013
+ "node/prefer-global/process": "off",
1014
+ "style/comma-dangle": "off",
1015
+ "style/eol-last": "off",
1016
+ // Type aware rules
1017
+ "ts/await-thenable": "off",
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",
1024
+ "ts/no-namespace": "off",
1025
+ "ts/no-redeclare": "off",
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",
1034
+ "ts/no-unused-vars": "off",
1035
+ "ts/no-use-before-define": "off",
1036
+ "ts/no-var-requires": "off",
1037
+ "ts/restrict-plus-operands": "off",
1038
+ "ts/restrict-template-expressions": "off",
1039
+ "ts/unbound-method": "off",
1040
+ "unicode-bom": "off",
1041
+ "unused-imports/no-unused-imports": "off",
1042
+ "unused-imports/no-unused-vars": "off",
1043
+ ...overrides
945
1044
  }
946
1045
  }
947
1046
  ];
948
1047
  }
949
1048
 
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,93 +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() {
1477
- const pluginUnoCSS = await interop(import("@unocss/eslint-plugin"));
1478
- return [
1479
- {
1480
- name: "luxass:unocss",
1481
- plugins: {
1482
- "@unocss": pluginUnoCSS
1483
- },
1484
- rules: {
1485
- ...pluginUnoCSS.configs.recommended.rules
1486
- }
1487
- }
1488
- ];
1489
- }
1490
-
1491
- // src/configs/tailwindcss.ts
1492
- var DEFAULT_TAILWIND_CALLEES = ["classnames", "clsx", "cx", "cn"];
1493
- var DEFAULT_CLASS_REGEX = "^class(Name)?$";
1494
- async function tailwindcss(options = {}) {
1683
+ async function unocss(options = {}) {
1495
1684
  const {
1496
- callees = DEFAULT_TAILWIND_CALLEES,
1497
- classRegex = DEFAULT_CLASS_REGEX,
1498
- config = void 0,
1499
- nextjs: nextjs2,
1500
- removeDuplicates = true
1685
+ attributify = true,
1686
+ files = [GLOB_SRC],
1687
+ overrides,
1688
+ strict = false
1501
1689
  } = options;
1502
1690
  await ensure([
1503
- "eslint-plugin-tailwindcss"
1691
+ "@unocss/eslint-plugin"
1692
+ ]);
1693
+ const [
1694
+ pluginUnoCSS
1695
+ ] = await Promise.all([
1696
+ interop(import("@unocss/eslint-plugin"))
1504
1697
  ]);
1505
- const pluginTailwindCSS = await interop(import("eslint-plugin-tailwindcss"));
1506
- const tailwindCSSCallee = callees ?? DEFAULT_TAILWIND_CALLEES;
1507
1698
  return [
1508
1699
  {
1509
- name: "luxass:tailwindcss",
1700
+ name: "luxass:unocss",
1701
+ files,
1510
1702
  plugins: {
1511
- tailwindcss: pluginTailwindCSS
1512
- }
1513
- },
1514
- {
1515
- files: [GLOB_SRC, GLOB_HTML],
1516
- name: "luxass:tailwindcss:rules",
1517
- rules: {
1518
- "tailwindcss/classnames-order": ["error"],
1519
- "tailwindcss/enforces-negative-arbitrary-values": ["warn"],
1520
- "tailwindcss/enforces-shorthand": ["warn"],
1521
- "tailwindcss/migration-from-tailwind-2": ["warn"],
1522
- "tailwindcss/no-arbitrary-value": ["off"],
1523
- "tailwindcss/no-contradicting-classname": ["error"],
1524
- "tailwindcss/no-custom-classname": ["warn"]
1703
+ unocss: pluginUnoCSS
1525
1704
  },
1526
- settings: {
1527
- tailwindcss: {
1528
- callees: tailwindCSSCallee,
1529
- classRegex: nextjs2 ? "^(class(Name)?|tw)$" : classRegex,
1530
- config,
1531
- removeDuplicates
1532
- }
1533
- }
1534
- },
1535
- {
1536
- files: ["**/tailwind.config.?([cm])[jt]s"],
1537
- name: "luxass:tailwindcss:sort-keys-override",
1538
1705
  rules: {
1539
- "sort-keys": "off",
1540
- "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
1541
1714
  }
1542
1715
  }
1543
1716
  ];
@@ -1545,7 +1718,11 @@ async function tailwindcss(options = {}) {
1545
1718
 
1546
1719
  // src/configs/nextjs.ts
1547
1720
  async function nextjs(options = {}) {
1548
- const { overrides, rootDir } = options;
1721
+ const {
1722
+ files = [GLOB_SRC],
1723
+ overrides,
1724
+ rootDir
1725
+ } = options;
1549
1726
  await ensure([
1550
1727
  "@next/eslint-plugin-next"
1551
1728
  ]);
@@ -1558,8 +1735,8 @@ async function nextjs(options = {}) {
1558
1735
  }
1559
1736
  },
1560
1737
  {
1561
- files: [GLOB_SRC],
1562
1738
  name: "luxass:nextjs:rules",
1739
+ files,
1563
1740
  rules: {
1564
1741
  ...pluginNextjs.configs.recommended.rules,
1565
1742
  ...pluginNextjs.configs["core-web-vitals"].rules,
@@ -1598,15 +1775,16 @@ async function nextjs(options = {}) {
1598
1775
  }
1599
1776
  },
1600
1777
  {
1601
- files: GLOB_NEXTJS_ROUTES,
1602
1778
  name: "luxass:nextjs:default-export-override",
1779
+ files: GLOB_NEXTJS_ROUTES,
1603
1780
  rules: {
1604
- "import/prefer-default-export": "error"
1781
+ "import/prefer-default-export": "error",
1782
+ "react-refresh/only-export-components": "off"
1605
1783
  }
1606
1784
  },
1607
1785
  {
1608
- files: GLOB_NEXTJS_OG,
1609
1786
  name: "luxass:nextjs:og-override",
1787
+ files: GLOB_NEXTJS_OG,
1610
1788
  rules: {
1611
1789
  "@next/next/no-img-element": "off",
1612
1790
  "react/no-unknown-property": ["error", {
@@ -1618,9 +1796,10 @@ async function nextjs(options = {}) {
1618
1796
  }
1619
1797
 
1620
1798
  // src/configs/react.ts
1621
- async function react(options) {
1799
+ async function react(options = {}) {
1622
1800
  const {
1623
1801
  a11y = false,
1802
+ files = [GLOB_JSX, GLOB_TSX],
1624
1803
  overrides = {},
1625
1804
  typescript: typescript2 = true
1626
1805
  } = options;
@@ -1639,7 +1818,7 @@ async function react(options) {
1639
1818
  interop(import("eslint-plugin-react")),
1640
1819
  interop(import("eslint-plugin-react-hooks")),
1641
1820
  interop(import("eslint-plugin-react-refresh")),
1642
- ...options.a11y ? [interop(import("eslint-plugin-jsx-a11y"))] : []
1821
+ ...a11y ? [interop(import("eslint-plugin-jsx-a11y"))] : []
1643
1822
  ]);
1644
1823
  return [
1645
1824
  {
@@ -1652,7 +1831,8 @@ async function react(options) {
1652
1831
  }
1653
1832
  },
1654
1833
  {
1655
- files: [GLOB_JSX],
1834
+ name: "luxass:react:rules",
1835
+ files,
1656
1836
  languageOptions: {
1657
1837
  parserOptions: {
1658
1838
  ecmaFeatures: {
@@ -1660,198 +1840,194 @@ async function react(options) {
1660
1840
  }
1661
1841
  }
1662
1842
  },
1663
- name: "luxass:react:rules",
1664
1843
  rules: {
1665
- // recommended rules for jsx-a11y
1666
- "jsx-a11y/alt-text": "error",
1667
- "jsx-a11y/anchor-ambiguous-text": "off",
1668
- "jsx-a11y/anchor-has-content": "error",
1669
- "jsx-a11y/anchor-is-valid": "error",
1670
- "jsx-a11y/aria-activedescendant-has-tabindex": "error",
1671
- "jsx-a11y/aria-props": "error",
1672
- "jsx-a11y/aria-proptypes": "error",
1673
- "jsx-a11y/aria-role": "error",
1674
- "jsx-a11y/aria-unsupported-elements": "error",
1675
- "jsx-a11y/autocomplete-valid": "error",
1676
- "jsx-a11y/click-events-have-key-events": "error",
1677
- "jsx-a11y/control-has-associated-label": [
1678
- "off",
1679
- {
1680
- ignoreElements: [
1681
- "audio",
1682
- "canvas",
1683
- "embed",
1684
- "input",
1685
- "textarea",
1686
- "tr",
1687
- "video"
1688
- ],
1689
- ignoreRoles: [
1690
- "grid",
1691
- "listbox",
1692
- "menu",
1693
- "menubar",
1694
- "radiogroup",
1695
- "row",
1696
- "tablist",
1697
- "toolbar",
1698
- "tree",
1699
- "treegrid"
1700
- ],
1701
- includeRoles: [
1702
- "alert",
1703
- "dialog"
1704
- ]
1705
- }
1706
- ],
1707
- "jsx-a11y/heading-has-content": "error",
1708
- "jsx-a11y/html-has-lang": "error",
1709
- "jsx-a11y/iframe-has-title": "error",
1710
- "jsx-a11y/img-redundant-alt": "error",
1711
- "jsx-a11y/interactive-supports-focus": [
1712
- "error",
1713
- {
1714
- tabbable: [
1715
- "button",
1716
- "checkbox",
1717
- "link",
1718
- "searchbox",
1719
- "spinbutton",
1720
- "switch",
1721
- "textbox"
1722
- ]
1723
- }
1724
- ],
1725
- "jsx-a11y/label-has-associated-control": "error",
1726
- "jsx-a11y/label-has-for": "off",
1727
- "jsx-a11y/media-has-caption": "error",
1728
- "jsx-a11y/mouse-events-have-key-events": "error",
1729
- "jsx-a11y/no-access-key": "error",
1730
- "jsx-a11y/no-autofocus": "error",
1731
- "jsx-a11y/no-distracting-elements": "error",
1732
- "jsx-a11y/no-interactive-element-to-noninteractive-role": [
1733
- "error",
1734
- {
1735
- canvas: [
1736
- "img"
1737
- ],
1738
- tr: [
1739
- "none",
1740
- "presentation"
1741
- ]
1742
- }
1743
- ],
1744
- "jsx-a11y/no-noninteractive-element-interactions": [
1745
- "error",
1746
- {
1747
- alert: [
1748
- "onKeyUp",
1749
- "onKeyDown",
1750
- "onKeyPress"
1751
- ],
1752
- body: [
1753
- "onError",
1754
- "onLoad"
1755
- ],
1756
- dialog: [
1757
- "onKeyUp",
1758
- "onKeyDown",
1759
- "onKeyPress"
1760
- ],
1761
- handlers: [
1762
- "onClick",
1763
- "onError",
1764
- "onLoad",
1765
- "onMouseDown",
1766
- "onMouseUp",
1767
- "onKeyPress",
1768
- "onKeyDown",
1769
- "onKeyUp"
1770
- ],
1771
- iframe: [
1772
- "onError",
1773
- "onLoad"
1774
- ],
1775
- img: [
1776
- "onError",
1777
- "onLoad"
1778
- ]
1779
- }
1780
- ],
1781
- "jsx-a11y/no-noninteractive-element-to-interactive-role": [
1782
- "error",
1783
- {
1784
- fieldset: [
1785
- "radiogroup",
1786
- "presentation"
1787
- ],
1788
- li: [
1789
- "menuitem",
1790
- "option",
1791
- "row",
1792
- "tab",
1793
- "treeitem"
1794
- ],
1795
- ol: [
1796
- "listbox",
1797
- "menu",
1798
- "menubar",
1799
- "radiogroup",
1800
- "tablist",
1801
- "tree",
1802
- "treegrid"
1803
- ],
1804
- table: [
1805
- "grid"
1806
- ],
1807
- td: [
1808
- "gridcell"
1809
- ],
1810
- ul: [
1811
- "listbox",
1812
- "menu",
1813
- "menubar",
1814
- "radiogroup",
1815
- "tablist",
1816
- "tree",
1817
- "treegrid"
1818
- ]
1819
- }
1820
- ],
1821
- "jsx-a11y/no-noninteractive-tabindex": [
1822
- "error",
1823
- {
1824
- allowExpressionValues: true,
1825
- roles: [
1826
- "tabpanel"
1827
- ],
1828
- tags: []
1829
- }
1830
- ],
1831
- "jsx-a11y/no-redundant-roles": "error",
1832
- "jsx-a11y/no-static-element-interactions": [
1833
- "error",
1834
- {
1835
- allowExpressionValues: true,
1836
- handlers: [
1837
- "onClick",
1838
- "onMouseDown",
1839
- "onMouseUp",
1840
- "onKeyPress",
1841
- "onKeyDown",
1842
- "onKeyUp"
1843
- ]
1844
- }
1845
- ],
1846
- "jsx-a11y/role-has-required-aria-props": "error",
1847
- "jsx-a11y/role-supports-aria-props": "error",
1848
- "jsx-a11y/scope": "error",
1849
- "jsx-a11y/tabindex-no-positive": "error",
1850
- // recommended rules react-hooks
1851
- "react-hooks/exhaustive-deps": "warn",
1852
- "react-hooks/rules-of-hooks": "error",
1853
- // react refresh
1854
- "react-refresh/only-export-components": ["warn", { allowConstantExport: true }],
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
+ } : {},
1855
2031
  // recommended rules react
1856
2032
  "react/display-name": "error",
1857
2033
  "react/jsx-key": "error",
@@ -1875,6 +2051,11 @@ async function react(options) {
1875
2051
  "react/prop-types": "error",
1876
2052
  "react/react-in-jsx-scope": "off",
1877
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 }],
1878
2059
  ...typescript2 ? {
1879
2060
  "react/prop-type": "off"
1880
2061
  } : {},
@@ -1894,14 +2075,10 @@ async function react(options) {
1894
2075
  async function astro(options) {
1895
2076
  const {
1896
2077
  a11y = false,
1897
- overrides = {}
1898
- // typescript = true,
2078
+ files = [GLOB_ASTRO],
2079
+ overrides = {},
2080
+ typescript: typescript2 = true
1899
2081
  } = options;
1900
- await interop([
1901
- "eslint-plugin-astro",
1902
- "astro-eslint-parser",
1903
- ...options.a11y ? ["eslint-plugin-jsx-a11y"] : []
1904
- ]);
1905
2082
  const [
1906
2083
  pluginAstro,
1907
2084
  parserAstro,
@@ -1909,7 +2086,7 @@ async function astro(options) {
1909
2086
  ] = await Promise.all([
1910
2087
  interop(import("eslint-plugin-astro")),
1911
2088
  interop(import("astro-eslint-parser")),
1912
- ...options.a11y ? [interop(import("eslint-plugin-jsx-a11y"))] : []
2089
+ ...a11y ? [interop(import("eslint-plugin-jsx-a11y"))] : []
1913
2090
  ]);
1914
2091
  return [
1915
2092
  {
@@ -1920,7 +2097,8 @@ async function astro(options) {
1920
2097
  }
1921
2098
  },
1922
2099
  {
1923
- files: [GLOB_ASTRO],
2100
+ name: "luxass:astro:rules",
2101
+ files,
1924
2102
  languageOptions: {
1925
2103
  // @ts-expect-error hmmm
1926
2104
  globals: {
@@ -1929,21 +2107,22 @@ async function astro(options) {
1929
2107
  parser: parserAstro,
1930
2108
  parserOptions: {
1931
2109
  extraFileExtensions: [".astro"],
1932
- parser: options.typescript ? await interop(import("@typescript-eslint/parser")) : null,
2110
+ parser: typescript2 ? await interop(import("@typescript-eslint/parser")) : null,
1933
2111
  sourceType: "module"
1934
2112
  }
1935
2113
  },
1936
- name: "luxass:astro:rules",
1937
2114
  // @ts-expect-error hmmm
1938
2115
  rules: {
1939
2116
  "style/jsx-closing-tag-location": "off",
1940
2117
  "style/jsx-indent": "off",
1941
2118
  "style/jsx-one-expression-per-line": "off",
1942
2119
  ...pluginAstro.configs.all.rules,
2120
+ "style/multiline-ternary": ["error", "never"],
1943
2121
  ...overrides
1944
2122
  }
1945
2123
  },
1946
2124
  {
2125
+ name: "luxass:astro:rules:scripts",
1947
2126
  files: [
1948
2127
  "**/*.astro/*.js",
1949
2128
  "*.astro/*.js"
@@ -1956,20 +2135,230 @@ async function astro(options) {
1956
2135
  parserOptions: {
1957
2136
  sourceType: "module"
1958
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
+ }
1959
2166
  },
1960
- 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
+ }
1961
2191
  }
1962
2192
  ];
1963
2193
  }
1964
2194
 
1965
- // src/factory.ts
1966
- var import_node_process3 = __toESM(require("process"), 1);
1967
- var import_node_fs = require("fs");
1968
- 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
+ }
1969
2359
 
1970
2360
  // src/constants.ts
1971
2361
  var VUE_PACKAGES = ["vue", "nuxt", "vitepress", "@slidev/cli"];
1972
- var UNO_PACKAGES = ["unocss", "@unocss/webpack", "@unocss/nuxt"];
1973
2362
  var FLAT_CONFIG_PROPS = [
1974
2363
  "files",
1975
2364
  "ignores",
@@ -1981,20 +2370,77 @@ var FLAT_CONFIG_PROPS = [
1981
2370
  "settings"
1982
2371
  ];
1983
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
+
1984
2432
  // src/factory.ts
1985
2433
  async function luxass(options = {}, ...userConfigs) {
1986
2434
  const {
1987
2435
  astro: enableAstro = (0, import_local_pkg2.isPackageExists)("astro"),
1988
- 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 = [],
1989
2438
  gitignore: enableGitignore = true,
1990
- isEditor = !!((import_node_process3.default.env.VSCODE_PID || import_node_process3.default.env.JETBRAINS_IDE) && !import_node_process3.default.env.CI),
1991
2439
  nextjs: enableNextJS = false,
1992
- overrides = {},
1993
- perfectionist: enablePerfectionistRules = false,
1994
2440
  react: enableReact = false,
1995
2441
  tailwindcss: enableTailwindCSS = false,
1996
2442
  typescript: enableTypeScript = (0, import_local_pkg2.isPackageExists)("typescript"),
1997
- unocss: enableUnoCSS = UNO_PACKAGES.some((i) => (0, import_local_pkg2.isPackageExists)(i)),
2443
+ unocss: enableUnoCSS = false,
1998
2444
  vue: enableVue = VUE_PACKAGES.some((i) => (0, import_local_pkg2.isPackageExists)(i))
1999
2445
  } = options;
2000
2446
  const stylisticOptions = options.stylistic === false ? false : typeof options.stylistic === "object" ? options.stylistic : {};
@@ -2014,8 +2460,8 @@ async function luxass(options = {}, ...userConfigs) {
2014
2460
  configs.push(
2015
2461
  ignores(),
2016
2462
  javascript({
2017
- isEditor,
2018
- overrides: overrides.javascript
2463
+ editor,
2464
+ overrides: getOverrides(options, "javascript")
2019
2465
  }),
2020
2466
  comments(),
2021
2467
  node(),
@@ -2026,54 +2472,46 @@ async function luxass(options = {}, ...userConfigs) {
2026
2472
  stylistic: stylisticOptions
2027
2473
  }),
2028
2474
  unicorn(),
2029
- perfectionist({
2030
- enableAllRules: enablePerfectionistRules
2031
- })
2475
+ perfectionist()
2032
2476
  );
2033
2477
  if (enableVue) {
2034
- componentExts.push("vue");
2478
+ exts.push("vue");
2035
2479
  }
2036
2480
  if (enableTypeScript) {
2037
- configs.push(
2038
- typescript({
2039
- ...typeof enableTypeScript !== "boolean" ? enableTypeScript : {},
2040
- componentExts,
2041
- overrides: overrides.typescript
2042
- })
2043
- );
2481
+ configs.push(typescript({
2482
+ ...resolveSubOptions(options, "typescript"),
2483
+ exts
2484
+ }));
2044
2485
  }
2045
2486
  if (stylisticOptions) {
2046
- configs.push(stylistic(stylisticOptions));
2487
+ configs.push(stylistic({
2488
+ ...stylisticOptions,
2489
+ overrides: getOverrides(options, "stylistic")
2490
+ }));
2047
2491
  }
2048
2492
  if (options.test ?? true) {
2049
- configs.push(
2050
- test({
2051
- isEditor,
2052
- overrides: overrides.test
2053
- })
2054
- );
2493
+ configs.push(test({
2494
+ editor,
2495
+ overrides: getOverrides(options, "test")
2496
+ }));
2055
2497
  }
2056
2498
  if (enableReact) {
2057
- configs.push(
2058
- react({
2059
- ...typeof enableReact !== "boolean" ? enableReact : {},
2060
- overrides: overrides.react,
2061
- typescript: !!enableTypeScript
2062
- })
2063
- );
2499
+ configs.push(react({
2500
+ overrides: getOverrides(options, "react"),
2501
+ typescript: !!enableTypeScript
2502
+ }));
2064
2503
  }
2065
2504
  if (enableNextJS) {
2066
2505
  configs.push(
2067
2506
  nextjs({
2068
- ...typeof enableNextJS !== "boolean" ? enableNextJS : {},
2069
- overrides: overrides.nextjs
2507
+ ...resolveSubOptions(options, "nextjs")
2070
2508
  })
2071
2509
  );
2072
2510
  }
2073
2511
  if (enableVue) {
2074
2512
  configs.push(
2075
2513
  vue({
2076
- overrides: overrides.vue,
2514
+ ...resolveSubOptions(options, "vue"),
2077
2515
  stylistic: stylisticOptions,
2078
2516
  typescript: !!enableTypeScript
2079
2517
  })
@@ -2082,28 +2520,27 @@ async function luxass(options = {}, ...userConfigs) {
2082
2520
  if (enableAstro) {
2083
2521
  configs.push(
2084
2522
  astro({
2085
- ...typeof enableAstro !== "boolean" ? enableAstro : {},
2086
- overrides: overrides.astro,
2523
+ ...resolveSubOptions(options, "astro"),
2087
2524
  typescript: !!enableTypeScript
2088
2525
  })
2089
2526
  );
2090
2527
  }
2091
2528
  if (enableUnoCSS) {
2092
- configs.push(unocss());
2529
+ configs.push(unocss({
2530
+ ...resolveSubOptions(options, "unocss"),
2531
+ overrides: getOverrides(options, "unocss")
2532
+ }));
2093
2533
  }
2094
2534
  if (enableTailwindCSS) {
2095
2535
  configs.push(tailwindcss({
2096
- callees: typeof enableTailwindCSS === "object" ? enableTailwindCSS.callees : ["classnames", "clsx", "cx", "cn"],
2097
- classRegex: typeof enableTailwindCSS === "object" ? enableTailwindCSS.classRegex : "^class(Name)?$",
2098
- config: typeof enableTailwindCSS === "object" ? enableTailwindCSS.config : void 0,
2099
- nextjs: typeof enableNextJS === "object" ? true : enableNextJS,
2100
- removeDuplicates: typeof enableTailwindCSS === "object" ? enableTailwindCSS.removeDuplicates : true
2536
+ ...resolveSubOptions(options, "tailwindcss"),
2537
+ overrides: getOverrides(options, "tailwindcss")
2101
2538
  }));
2102
2539
  }
2103
2540
  if (options.jsonc ?? true) {
2104
2541
  configs.push(
2105
2542
  jsonc({
2106
- overrides: overrides.jsonc,
2543
+ overrides: getOverrides(options, "jsonc"),
2107
2544
  stylistic: stylisticOptions
2108
2545
  }),
2109
2546
  sortPackageJson(),
@@ -2111,21 +2548,33 @@ async function luxass(options = {}, ...userConfigs) {
2111
2548
  );
2112
2549
  }
2113
2550
  if (options.yaml ?? true) {
2114
- configs.push(
2115
- yaml({
2116
- overrides: overrides.yaml,
2117
- stylistic: stylisticOptions
2118
- })
2119
- );
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
+ }));
2120
2561
  }
2121
2562
  if (options.markdown ?? true) {
2122
2563
  configs.push(
2123
- markdown({
2124
- componentExts,
2125
- overrides: overrides.markdown
2126
- })
2564
+ markdown(
2565
+ {
2566
+ exts,
2567
+ overrides: getOverrides(options, "markdown")
2568
+ }
2569
+ )
2127
2570
  );
2128
2571
  }
2572
+ if (options.formatters) {
2573
+ configs.push(formatters(
2574
+ options.formatters,
2575
+ typeof stylisticOptions === "boolean" ? {} : stylisticOptions
2576
+ ));
2577
+ }
2129
2578
  const fusedConfig = FLAT_CONFIG_PROPS.reduce((acc, key) => {
2130
2579
  if (key in options) {
2131
2580
  acc[key] = options[key];
@@ -2138,33 +2587,14 @@ async function luxass(options = {}, ...userConfigs) {
2138
2587
  const merged = combine(...configs, ...userConfigs);
2139
2588
  return merged;
2140
2589
  }
2590
+
2591
+ // src/index.ts
2592
+ var src_default = luxass;
2141
2593
  // Annotate the CommonJS export names for ESM import in node:
2142
2594
  0 && (module.exports = {
2143
- GLOB_ASTRO,
2144
- GLOB_CSS,
2145
- GLOB_EXCLUDE,
2146
- GLOB_HTML,
2147
- GLOB_JS,
2148
- GLOB_JSON,
2149
- GLOB_JSON5,
2150
- GLOB_JSONC,
2151
- GLOB_JSX,
2152
- GLOB_JSX_EXT,
2153
- GLOB_LESS,
2154
- GLOB_MARKDOWN,
2155
- GLOB_MARKDOWN_CODE,
2156
- GLOB_NEXTJS_OG,
2157
- GLOB_NEXTJS_ROUTES,
2158
- GLOB_SCSS,
2159
- GLOB_SRC,
2160
- GLOB_SRC_EXT,
2161
- GLOB_STYLE,
2162
- GLOB_TESTS,
2163
- GLOB_TS,
2164
- GLOB_VUE,
2165
- GLOB_YAML,
2166
2595
  astro,
2167
2596
  comments,
2597
+ formatters,
2168
2598
  ignores,
2169
2599
  imports,
2170
2600
  javascript,