@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
@@ -34,12 +34,13 @@ __export(typescript_exports, {
34
34
  });
35
35
  module.exports = __toCommonJS(typescript_exports);
36
36
  var import_node_process2 = __toESM(require("process"), 1);
37
+ var import_eslint_plugin_antfu = __toESM(require("eslint-plugin-antfu"), 1);
37
38
 
38
39
  // src/globs.ts
39
40
  var GLOB_SRC_EXT = "?([cm])[jt]s?(x)";
40
- var GLOB_SRC = "**/*.?([cm])[jt]s?(x)";
41
- var GLOB_JSX_EXT = "[jt]sx";
42
- var GLOB_JSX = `**/*.${GLOB_JSX_EXT}`;
41
+ var GLOB_SRC = `**/*.${GLOB_SRC_EXT}`;
42
+ var GLOB_TS = "**/*.?([cm])ts";
43
+ var GLOB_TSX = "**/*.?([cm])tsx";
43
44
  var GLOB_MARKDOWN = "**/*.md";
44
45
  var GLOB_MARKDOWN_CODE = `${GLOB_MARKDOWN}/${GLOB_SRC}`;
45
46
  var GLOB_TESTS = [
@@ -49,11 +50,6 @@ var GLOB_TESTS = [
49
50
  `**/*.bench.${GLOB_SRC_EXT}`,
50
51
  `**/*.benchmark.${GLOB_SRC_EXT}`
51
52
  ];
52
- var GLOB_NEXTJS_OG = [
53
- `**/app/**/opengraph-image.${GLOB_JSX_EXT}`,
54
- `**/app/**/twitter-image.${GLOB_JSX_EXT}`,
55
- `**/app/**/route.${GLOB_JSX_EXT}`
56
- ];
57
53
  var GLOB_NEXTJS_ROUTES = [
58
54
  `**/app/**/page.${GLOB_SRC_EXT}`,
59
55
  `**/app/**/layout.${GLOB_SRC_EXT}`,
@@ -66,15 +62,6 @@ var GLOB_NEXTJS_ROUTES = [
66
62
  `**/pages/**/*.${GLOB_SRC_EXT}`
67
63
  ];
68
64
 
69
- // src/plugins.ts
70
- var import_eslint_plugin_antfu = __toESM(require("eslint-plugin-antfu"), 1);
71
- var import_eslint_plugin_eslint_comments = __toESM(require("eslint-plugin-eslint-comments"), 1);
72
- var pluginImport = __toESM(require("eslint-plugin-i"), 1);
73
- var import_eslint_plugin_n = __toESM(require("eslint-plugin-n"), 1);
74
- var import_eslint_plugin_unicorn = __toESM(require("eslint-plugin-unicorn"), 1);
75
- var import_eslint_plugin_unused_imports = __toESM(require("eslint-plugin-unused-imports"), 1);
76
- var import_eslint_plugin_perfectionist = __toESM(require("eslint-plugin-perfectionist"), 1);
77
-
78
65
  // src/utils.ts
79
66
  var import_node_process = __toESM(require("process"), 1);
80
67
  var import_local_pkg = require("local-pkg");
@@ -97,9 +84,9 @@ async function interop(m) {
97
84
  }
98
85
 
99
86
  // src/configs/typescript.ts
100
- async function typescript(options) {
87
+ async function typescript(options = {}) {
101
88
  const {
102
- componentExts = [],
89
+ exts = [],
103
90
  overrides = {},
104
91
  parserOptions = {}
105
92
  } = options ?? {};
@@ -124,6 +111,11 @@ async function typescript(options) {
124
111
  "ts/restrict-template-expressions": "error",
125
112
  "ts/unbound-method": "error"
126
113
  };
114
+ const files = options.files ?? [
115
+ GLOB_SRC,
116
+ ...exts.map((ext) => `**/*.${ext}`)
117
+ ];
118
+ const filesTypeAware = options.typeAwareFileS ?? [GLOB_TS, GLOB_TSX];
127
119
  const tsconfigPath = options?.tsconfigPath ? toArray(options.tsconfigPath) : void 0;
128
120
  const [
129
121
  pluginTs,
@@ -142,11 +134,12 @@ async function typescript(options) {
142
134
  }
143
135
  },
144
136
  {
145
- files: [GLOB_SRC, ...componentExts.map((ext) => `**/*.${ext}`)],
137
+ name: "luxass:typescript:rules",
138
+ files,
146
139
  languageOptions: {
147
140
  parser: parserTs,
148
141
  parserOptions: {
149
- extraFileExtensions: componentExts.map((ext) => `.${ext}`),
142
+ extraFileExtensions: exts.map((ext) => `.${ext}`),
150
143
  sourceType: "module",
151
144
  ...tsconfigPath ? {
152
145
  project: tsconfigPath,
@@ -155,7 +148,6 @@ async function typescript(options) {
155
148
  ...parserOptions
156
149
  }
157
150
  },
158
- name: "luxass:typescript:rules",
159
151
  rules: {
160
152
  ...renameRules(
161
153
  pluginTs.configs["eslint-recommended"].overrides[0].rules,
@@ -167,9 +159,6 @@ async function typescript(options) {
167
159
  "@typescript-eslint/",
168
160
  "ts/"
169
161
  ),
170
- "antfu/generic-spacing": "error",
171
- "antfu/named-tuple-spacing": "error",
172
- "antfu/no-cjs-exports": "error",
173
162
  "no-dupe-class-members": "off",
174
163
  "no-invalid-this": "off",
175
164
  "no-loss-of-precision": "off",
@@ -183,41 +172,34 @@ async function typescript(options) {
183
172
  "ts/ban-types": ["error", {
184
173
  extendDefaults: false,
185
174
  types: {
186
- "BigInt": {
175
+ BigInt: {
187
176
  fixWith: "bigint",
188
177
  message: "Use `bigint` instead."
189
178
  },
190
- "Boolean": {
179
+ Boolean: {
191
180
  fixWith: "boolean",
192
181
  message: "Use `boolean` instead."
193
182
  },
194
- "Function": "Use a specific function type instead, like `() => void`.",
195
- "Number": {
183
+ Function: "Use a specific function type instead, like `() => void`.",
184
+ Number: {
196
185
  fixWith: "number",
197
186
  message: "Use `number` instead."
198
187
  },
199
- "Object": {
188
+ Object: {
200
189
  fixWith: "Record<string, unknown>",
201
190
  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"
202
191
  },
203
- "String": {
192
+ String: {
204
193
  fixWith: "string",
205
194
  message: "Use `string` instead."
206
195
  },
207
- "Symbol": {
196
+ Symbol: {
208
197
  fixWith: "symbol",
209
198
  message: "Use `symbol` instead."
210
199
  },
211
- "[]": {
212
- message: "Don't use the empty array type `[]`. It only allows empty arrays. Use `SomeType[]` instead."
213
- },
214
- "object": {
200
+ object: {
215
201
  fixWith: "Record<string, unknown>",
216
202
  message: "The `object` type is hard to use. Use `Record<string, unknown>` instead. See: https://github.com/typescript-eslint/typescript-eslint/pull/848"
217
- },
218
- "{}": {
219
- fixWith: "Record<string, unknown>",
220
- message: "The `{}` type is mostly the same as `unknown`. You probably want `Record<string, unknown>` instead."
221
203
  }
222
204
  }
223
205
  }],
@@ -246,13 +228,20 @@ async function typescript(options) {
246
228
  "ts/prefer-ts-expect-error": "error",
247
229
  "ts/triple-slash-reference": "off",
248
230
  "ts/unified-signatures": "off",
231
+ ...overrides
232
+ }
233
+ },
234
+ {
235
+ name: "luxass:typescript:rules-type-aware",
236
+ files: filesTypeAware,
237
+ rules: {
249
238
  ...tsconfigPath ? typeAwareRules : {},
250
239
  ...overrides
251
240
  }
252
241
  },
253
242
  {
254
- files: ["**/*.d.ts"],
255
243
  name: "luxass:typescript:dts-overrides",
244
+ files: ["**/*.d.ts"],
256
245
  rules: {
257
246
  "eslint-comments/no-unlimited-disable": "off",
258
247
  "import/no-duplicates": "off",
@@ -261,15 +250,15 @@ async function typescript(options) {
261
250
  }
262
251
  },
263
252
  {
264
- files: ["**/*.{test,spec}.ts?(x)"],
265
253
  name: "luxass:typescript:tests-overrides",
254
+ files: ["**/*.{test,spec}.ts?(x)"],
266
255
  rules: {
267
256
  "no-unused-expressions": "off"
268
257
  }
269
258
  },
270
259
  {
271
- files: ["**/*.js", "**/*.cjs"],
272
260
  name: "luxass:typescript:javascript-overrides",
261
+ files: ["**/*.js", "**/*.cjs"],
273
262
  rules: {
274
263
  "ts/no-require-imports": "off",
275
264
  "ts/no-var-requires": "off"
@@ -1,6 +1,6 @@
1
- import { a as OptionsComponentExts, O as OverrideOptions, d as OptionsTypeScriptWithTypes, e as OptionsTypeScriptParserOptions, F as FlatConfigItem } from '../types-fxhbVLKI.cjs';
2
- import 'eslint-config-flat-gitignore';
3
1
  import '@typescript-eslint/parser';
2
+ export { T as TypeScriptOptions, t as typescript } from '../types-spTEGSaV.cjs';
3
+ import 'eslint-config-flat-gitignore';
4
4
  import '@antfu/eslint-define-config';
5
5
  import '@eslint-types/jsdoc/types';
6
6
  import '@eslint-types/typescript-eslint/types';
@@ -8,7 +8,4 @@ import '@eslint-types/unicorn/types';
8
8
  import 'eslint-plugin-antfu';
9
9
  import '@stylistic/eslint-plugin';
10
10
  import 'eslint';
11
-
12
- declare function typescript(options?: OptionsComponentExts & OverrideOptions & OptionsTypeScriptWithTypes & OptionsTypeScriptParserOptions): Promise<FlatConfigItem[]>;
13
-
14
- export { typescript };
11
+ import 'eslint-processor-vue-blocks';
@@ -1,6 +1,6 @@
1
- import { a as OptionsComponentExts, O as OverrideOptions, d as OptionsTypeScriptWithTypes, e as OptionsTypeScriptParserOptions, F as FlatConfigItem } from '../types-fxhbVLKI.js';
2
- import 'eslint-config-flat-gitignore';
3
1
  import '@typescript-eslint/parser';
2
+ export { T as TypeScriptOptions, t as typescript } from '../types-spTEGSaV.js';
3
+ import 'eslint-config-flat-gitignore';
4
4
  import '@antfu/eslint-define-config';
5
5
  import '@eslint-types/jsdoc/types';
6
6
  import '@eslint-types/typescript-eslint/types';
@@ -8,7 +8,4 @@ import '@eslint-types/unicorn/types';
8
8
  import 'eslint-plugin-antfu';
9
9
  import '@stylistic/eslint-plugin';
10
10
  import 'eslint';
11
-
12
- declare function typescript(options?: OptionsComponentExts & OverrideOptions & OptionsTypeScriptWithTypes & OptionsTypeScriptParserOptions): Promise<FlatConfigItem[]>;
13
-
14
- export { typescript };
11
+ import 'eslint-processor-vue-blocks';
@@ -1,9 +1,8 @@
1
1
  import {
2
2
  typescript
3
- } from "../chunk-BAKUP7QM.mjs";
4
- import "../chunk-R4NSLRAE.mjs";
5
- import "../chunk-C5VMTRKT.mjs";
6
- import "../chunk-TQ476NL2.mjs";
3
+ } from "../chunk-P3QUAOFO.mjs";
4
+ import "../chunk-4YBQZLPS.mjs";
5
+ import "../chunk-ATRL3UZP.mjs";
7
6
  export {
8
7
  typescript
9
8
  };
@@ -33,17 +33,7 @@ __export(unicorn_exports, {
33
33
  unicorn: () => unicorn
34
34
  });
35
35
  module.exports = __toCommonJS(unicorn_exports);
36
-
37
- // src/plugins.ts
38
- var import_eslint_plugin_antfu = __toESM(require("eslint-plugin-antfu"), 1);
39
- var import_eslint_plugin_eslint_comments = __toESM(require("eslint-plugin-eslint-comments"), 1);
40
- var pluginImport = __toESM(require("eslint-plugin-i"), 1);
41
- var import_eslint_plugin_n = __toESM(require("eslint-plugin-n"), 1);
42
36
  var import_eslint_plugin_unicorn = __toESM(require("eslint-plugin-unicorn"), 1);
43
- var import_eslint_plugin_unused_imports = __toESM(require("eslint-plugin-unused-imports"), 1);
44
- var import_eslint_plugin_perfectionist = __toESM(require("eslint-plugin-perfectionist"), 1);
45
-
46
- // src/configs/unicorn.ts
47
37
  function unicorn() {
48
38
  return [
49
39
  {
@@ -53,30 +43,43 @@ function unicorn() {
53
43
  },
54
44
  rules: {
55
45
  // Pass error message when throwing errors
46
+ // https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/error-message.md
56
47
  "unicorn/error-message": "error",
57
48
  // Uppercase regex escapes
49
+ // https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/escape-case.md
58
50
  "unicorn/escape-case": "error",
59
51
  // Array.isArray instead of instanceof
52
+ // https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/no-instanceof-array.md
60
53
  "unicorn/no-instanceof-array": "error",
61
54
  // Ban `new Array` as `Array` constructor's params are ambiguous
55
+ // https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/no-new-array.md
62
56
  "unicorn/no-new-array": "error",
63
57
  // Prevent deprecated `new Buffer()`
58
+ // https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/no-new-buffer.md
64
59
  "unicorn/no-new-buffer": "error",
65
60
  // Lowercase number formatting for octal, hex, binary (0x1'error' instead of 0X1'error')
61
+ // https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/number-literal-case.md
66
62
  "unicorn/number-literal-case": "error",
67
63
  // textContent instead of innerText
64
+ // https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/prefer-dom-node-text-content.md
68
65
  "unicorn/prefer-dom-node-text-content": "error",
69
66
  // includes over indexOf when checking for existence
67
+ // https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/prefer-includes.md
70
68
  "unicorn/prefer-includes": "error",
71
69
  // Prefer using the node: protocol
70
+ // https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/prefer-node-protocol.md
72
71
  "unicorn/prefer-node-protocol": "error",
73
72
  // Prefer using number properties like `Number.isNaN` rather than `isNaN`
73
+ // https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/prefer-number-properties.md
74
74
  "unicorn/prefer-number-properties": "error",
75
75
  // String methods startsWith/endsWith instead of more complicated stuff
76
+ // https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/prefer-string-starts-ends-with.md
76
77
  "unicorn/prefer-string-starts-ends-with": "error",
77
78
  // Enforce throwing type error when throwing error while checking typeof
79
+ // https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/prefer-type-error.md
78
80
  "unicorn/prefer-type-error": "error",
79
81
  // Use new when throwing error
82
+ // https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/throw-new-error.md
80
83
  "unicorn/throw-new-error": "error"
81
84
  }
82
85
  }
@@ -1,6 +1,5 @@
1
- import { F as FlatConfigItem } from '../types-fxhbVLKI.cjs';
1
+ import { k as FlatConfigItem } from '../types-spTEGSaV.cjs';
2
2
  import 'eslint-config-flat-gitignore';
3
- import '@typescript-eslint/parser';
4
3
  import '@antfu/eslint-define-config';
5
4
  import '@eslint-types/jsdoc/types';
6
5
  import '@eslint-types/typescript-eslint/types';
@@ -8,6 +7,8 @@ import '@eslint-types/unicorn/types';
8
7
  import 'eslint-plugin-antfu';
9
8
  import '@stylistic/eslint-plugin';
10
9
  import 'eslint';
10
+ import '@typescript-eslint/parser';
11
+ import 'eslint-processor-vue-blocks';
11
12
 
12
13
  declare function unicorn(): FlatConfigItem[];
13
14
 
@@ -1,6 +1,5 @@
1
- import { F as FlatConfigItem } from '../types-fxhbVLKI.js';
1
+ import { k as FlatConfigItem } from '../types-spTEGSaV.js';
2
2
  import 'eslint-config-flat-gitignore';
3
- import '@typescript-eslint/parser';
4
3
  import '@antfu/eslint-define-config';
5
4
  import '@eslint-types/jsdoc/types';
6
5
  import '@eslint-types/typescript-eslint/types';
@@ -8,6 +7,8 @@ import '@eslint-types/unicorn/types';
8
7
  import 'eslint-plugin-antfu';
9
8
  import '@stylistic/eslint-plugin';
10
9
  import 'eslint';
10
+ import '@typescript-eslint/parser';
11
+ import 'eslint-processor-vue-blocks';
11
12
 
12
13
  declare function unicorn(): FlatConfigItem[];
13
14
 
@@ -1,7 +1,6 @@
1
1
  import {
2
2
  unicorn
3
- } from "../chunk-HE56XDG6.mjs";
4
- import "../chunk-C5VMTRKT.mjs";
3
+ } from "../chunk-RVSUTDCE.mjs";
5
4
  export {
6
5
  unicorn
7
6
  };
@@ -34,6 +34,30 @@ __export(unocss_exports, {
34
34
  });
35
35
  module.exports = __toCommonJS(unocss_exports);
36
36
 
37
+ // src/globs.ts
38
+ var GLOB_SRC_EXT = "?([cm])[jt]s?(x)";
39
+ var GLOB_SRC = `**/*.${GLOB_SRC_EXT}`;
40
+ var GLOB_MARKDOWN = "**/*.md";
41
+ var GLOB_MARKDOWN_CODE = `${GLOB_MARKDOWN}/${GLOB_SRC}`;
42
+ var GLOB_TESTS = [
43
+ `**/__tests__/**/*.${GLOB_SRC_EXT}`,
44
+ `**/*.spec.${GLOB_SRC_EXT}`,
45
+ `**/*.test.${GLOB_SRC_EXT}`,
46
+ `**/*.bench.${GLOB_SRC_EXT}`,
47
+ `**/*.benchmark.${GLOB_SRC_EXT}`
48
+ ];
49
+ var GLOB_NEXTJS_ROUTES = [
50
+ `**/app/**/page.${GLOB_SRC_EXT}`,
51
+ `**/app/**/layout.${GLOB_SRC_EXT}`,
52
+ `**/app/**/error.${GLOB_SRC_EXT}`,
53
+ `**/app/**/template.${GLOB_SRC_EXT}`,
54
+ `**/app/**/not-found.${GLOB_SRC_EXT}`,
55
+ `**/app/**/loading.${GLOB_SRC_EXT}`,
56
+ `**/app/**/robots.${GLOB_SRC_EXT}`,
57
+ `**/app/**/sitemap.${GLOB_SRC_EXT}`,
58
+ `**/pages/**/*.${GLOB_SRC_EXT}`
59
+ ];
60
+
37
61
  // src/utils.ts
38
62
  var import_node_process = __toESM(require("process"), 1);
39
63
  var import_local_pkg = require("local-pkg");
@@ -41,18 +65,64 @@ async function interop(m) {
41
65
  const resolved = await m;
42
66
  return resolved.default || resolved;
43
67
  }
68
+ async function ensure(packages) {
69
+ if (import_node_process.default.env.CI || import_node_process.default.stdout.isTTY === false) {
70
+ return;
71
+ }
72
+ ;
73
+ const nonExistingPackages = packages.filter((i) => !(0, import_local_pkg.isPackageExists)(i));
74
+ if (nonExistingPackages.length === 0) {
75
+ return;
76
+ }
77
+ ;
78
+ const { default: prompts } = await import("prompts");
79
+ const { result } = await prompts([
80
+ {
81
+ name: "result",
82
+ message: `${nonExistingPackages.length === 1 ? "Package is" : "Packages are"} required for this config: ${nonExistingPackages.join(", ")}. Do you want to install them?`,
83
+ type: "confirm"
84
+ }
85
+ ]);
86
+ if (result) {
87
+ await import("@antfu/install-pkg").then((i) => i.installPackage(nonExistingPackages, {
88
+ dev: true
89
+ }));
90
+ }
91
+ ;
92
+ }
44
93
 
45
94
  // src/configs/unocss.ts
46
- async function unocss() {
47
- const pluginUnoCSS = await interop(import("@unocss/eslint-plugin"));
95
+ async function unocss(options = {}) {
96
+ const {
97
+ attributify = true,
98
+ files = [GLOB_SRC],
99
+ overrides,
100
+ strict = false
101
+ } = options;
102
+ await ensure([
103
+ "@unocss/eslint-plugin"
104
+ ]);
105
+ const [
106
+ pluginUnoCSS
107
+ ] = await Promise.all([
108
+ interop(import("@unocss/eslint-plugin"))
109
+ ]);
48
110
  return [
49
111
  {
50
112
  name: "luxass:unocss",
113
+ files,
51
114
  plugins: {
52
- "@unocss": pluginUnoCSS
115
+ unocss: pluginUnoCSS
53
116
  },
54
117
  rules: {
55
- ...pluginUnoCSS.configs.recommended.rules
118
+ "unocss/order": "warn",
119
+ ...attributify ? {
120
+ "unocss/order-attributify": "warn"
121
+ } : {},
122
+ ...strict ? {
123
+ "unocss/blocklist": "error"
124
+ } : {},
125
+ ...overrides
56
126
  }
57
127
  }
58
128
  ];
@@ -1,6 +1,5 @@
1
- import { F as FlatConfigItem } from '../types-fxhbVLKI.cjs';
1
+ export { U as UnoCSSOptions, u as unocss } from '../types-spTEGSaV.cjs';
2
2
  import 'eslint-config-flat-gitignore';
3
- import '@typescript-eslint/parser';
4
3
  import '@antfu/eslint-define-config';
5
4
  import '@eslint-types/jsdoc/types';
6
5
  import '@eslint-types/typescript-eslint/types';
@@ -8,7 +7,5 @@ import '@eslint-types/unicorn/types';
8
7
  import 'eslint-plugin-antfu';
9
8
  import '@stylistic/eslint-plugin';
10
9
  import 'eslint';
11
-
12
- declare function unocss(): Promise<FlatConfigItem[]>;
13
-
14
- export { unocss };
10
+ import '@typescript-eslint/parser';
11
+ import 'eslint-processor-vue-blocks';
@@ -1,6 +1,5 @@
1
- import { F as FlatConfigItem } from '../types-fxhbVLKI.js';
1
+ export { U as UnoCSSOptions, u as unocss } from '../types-spTEGSaV.js';
2
2
  import 'eslint-config-flat-gitignore';
3
- import '@typescript-eslint/parser';
4
3
  import '@antfu/eslint-define-config';
5
4
  import '@eslint-types/jsdoc/types';
6
5
  import '@eslint-types/typescript-eslint/types';
@@ -8,7 +7,5 @@ import '@eslint-types/unicorn/types';
8
7
  import 'eslint-plugin-antfu';
9
8
  import '@stylistic/eslint-plugin';
10
9
  import 'eslint';
11
-
12
- declare function unocss(): Promise<FlatConfigItem[]>;
13
-
14
- export { unocss };
10
+ import '@typescript-eslint/parser';
11
+ import 'eslint-processor-vue-blocks';
@@ -1,7 +1,8 @@
1
1
  import {
2
2
  unocss
3
- } from "../chunk-CFSYEIE4.mjs";
4
- import "../chunk-TQ476NL2.mjs";
3
+ } from "../chunk-KJ7ZCBK4.mjs";
4
+ import "../chunk-4YBQZLPS.mjs";
5
+ import "../chunk-ATRL3UZP.mjs";
5
6
  export {
6
7
  unocss
7
8
  };
@@ -33,12 +33,11 @@ __export(vue_exports, {
33
33
  vue: () => vue
34
34
  });
35
35
  module.exports = __toCommonJS(vue_exports);
36
+ var import_eslint_merge_processors = require("eslint-merge-processors");
36
37
 
37
38
  // src/globs.ts
38
39
  var GLOB_SRC_EXT = "?([cm])[jt]s?(x)";
39
- var GLOB_SRC = "**/*.?([cm])[jt]s?(x)";
40
- var GLOB_JSX_EXT = "[jt]sx";
41
- var GLOB_JSX = `**/*.${GLOB_JSX_EXT}`;
40
+ var GLOB_SRC = `**/*.${GLOB_SRC_EXT}`;
42
41
  var GLOB_MARKDOWN = "**/*.md";
43
42
  var GLOB_VUE = "**/*.vue";
44
43
  var GLOB_MARKDOWN_CODE = `${GLOB_MARKDOWN}/${GLOB_SRC}`;
@@ -49,11 +48,6 @@ var GLOB_TESTS = [
49
48
  `**/*.bench.${GLOB_SRC_EXT}`,
50
49
  `**/*.benchmark.${GLOB_SRC_EXT}`
51
50
  ];
52
- var GLOB_NEXTJS_OG = [
53
- `**/app/**/opengraph-image.${GLOB_JSX_EXT}`,
54
- `**/app/**/twitter-image.${GLOB_JSX_EXT}`,
55
- `**/app/**/route.${GLOB_JSX_EXT}`
56
- ];
57
51
  var GLOB_NEXTJS_ROUTES = [
58
52
  `**/app/**/page.${GLOB_SRC_EXT}`,
59
53
  `**/app/**/layout.${GLOB_SRC_EXT}`,
@@ -76,14 +70,24 @@ async function interop(m) {
76
70
 
77
71
  // src/configs/vue.ts
78
72
  async function vue(options = {}) {
79
- const { overrides = {}, stylistic = true } = options;
73
+ const {
74
+ a11y = true,
75
+ files = [GLOB_VUE],
76
+ overrides = {},
77
+ stylistic = true
78
+ } = options;
80
79
  const [
81
80
  pluginVue,
82
- parserVue
81
+ parserVue,
82
+ processorVueBlocks,
83
+ pluginA11y
83
84
  ] = await Promise.all([
84
85
  interop(import("eslint-plugin-vue")),
85
- interop(import("vue-eslint-parser"))
86
+ interop(import("vue-eslint-parser")),
87
+ interop(import("eslint-processor-vue-blocks")),
88
+ ...a11y ? [interop(import("eslint-plugin-vuejs-accessibility"))] : []
86
89
  ]);
90
+ const sfcBlocks = options.sfcBlocks === true ? {} : options.sfcBlocks ?? {};
87
91
  const {
88
92
  indent = 2
89
93
  } = typeof stylistic === "boolean" ? {} : stylistic;
@@ -91,11 +95,13 @@ async function vue(options = {}) {
91
95
  {
92
96
  name: "luxass:vue:setup",
93
97
  plugins: {
94
- vue: pluginVue
98
+ vue: pluginVue,
99
+ ...a11y ? { "vue-a11y": pluginA11y } : {}
95
100
  }
96
101
  },
97
102
  {
98
- files: [GLOB_VUE],
103
+ name: "luxass:vue:rules",
104
+ files,
99
105
  languageOptions: {
100
106
  parser: parserVue,
101
107
  parserOptions: {
@@ -107,8 +113,16 @@ async function vue(options = {}) {
107
113
  sourceType: "module"
108
114
  }
109
115
  },
110
- name: "luxass:vue:rules",
111
- processor: pluginVue.processors[".vue"],
116
+ processor: sfcBlocks === false ? pluginVue.processors[".vue"] : (0, import_eslint_merge_processors.mergeProcessors)([
117
+ pluginVue.processors[".vue"],
118
+ processorVueBlocks({
119
+ ...sfcBlocks,
120
+ blocks: {
121
+ styles: true,
122
+ ...sfcBlocks.blocks
123
+ }
124
+ })
125
+ ]),
112
126
  rules: {
113
127
  ...pluginVue.configs.base.rules,
114
128
  ...pluginVue.configs["vue3-essential"].rules,
@@ -217,6 +231,28 @@ async function vue(options = {}) {
217
231
  "vue/space-in-parens": ["error", "never"],
218
232
  "vue/template-curly-spacing": "error"
219
233
  } : {},
234
+ ...a11y ? {
235
+ "vue-a11y/alt-text": "error",
236
+ "vue-a11y/anchor-has-content": "error",
237
+ "vue-a11y/aria-props": "error",
238
+ "vue-a11y/aria-role": "error",
239
+ "vue-a11y/aria-unsupported-elements": "error",
240
+ "vue-a11y/click-events-have-key-events": "error",
241
+ "vue-a11y/form-control-has-label": "error",
242
+ "vue-a11y/heading-has-content": "error",
243
+ "vue-a11y/iframe-has-title": "error",
244
+ "vue-a11y/interactive-supports-focus": "error",
245
+ "vue-a11y/label-has-for": "error",
246
+ "vue-a11y/media-has-caption": "error",
247
+ "vue-a11y/mouse-events-have-key-events": "error",
248
+ "vue-a11y/no-access-key": "error",
249
+ "vue-a11y/no-autofocus": "error",
250
+ "vue-a11y/no-distracting-elements": "error",
251
+ "vue-a11y/no-redundant-roles": "error",
252
+ "vue-a11y/no-static-element-interactions": "error",
253
+ "vue-a11y/role-has-required-aria-props": "error",
254
+ "vue-a11y/tabindex-no-positive": "error"
255
+ } : {},
220
256
  ...overrides
221
257
  }
222
258
  }
@@ -1,6 +1,6 @@
1
- import { C as ConfigurationOptions, O as OverrideOptions, S as StylisticOptions, F as FlatConfigItem } from '../types-fxhbVLKI.cjs';
1
+ import 'eslint-processor-vue-blocks';
2
+ export { V as VueOptions, v as vue } from '../types-spTEGSaV.cjs';
2
3
  import 'eslint-config-flat-gitignore';
3
- import '@typescript-eslint/parser';
4
4
  import '@antfu/eslint-define-config';
5
5
  import '@eslint-types/jsdoc/types';
6
6
  import '@eslint-types/typescript-eslint/types';
@@ -8,7 +8,4 @@ import '@eslint-types/unicorn/types';
8
8
  import 'eslint-plugin-antfu';
9
9
  import '@stylistic/eslint-plugin';
10
10
  import 'eslint';
11
-
12
- declare function vue(options?: ConfigurationOptions<"typescript"> & OverrideOptions & StylisticOptions): Promise<FlatConfigItem[]>;
13
-
14
- export { vue };
11
+ import '@typescript-eslint/parser';
@@ -1,6 +1,6 @@
1
- import { C as ConfigurationOptions, O as OverrideOptions, S as StylisticOptions, F as FlatConfigItem } from '../types-fxhbVLKI.js';
1
+ import 'eslint-processor-vue-blocks';
2
+ export { V as VueOptions, v as vue } from '../types-spTEGSaV.js';
2
3
  import 'eslint-config-flat-gitignore';
3
- import '@typescript-eslint/parser';
4
4
  import '@antfu/eslint-define-config';
5
5
  import '@eslint-types/jsdoc/types';
6
6
  import '@eslint-types/typescript-eslint/types';
@@ -8,7 +8,4 @@ import '@eslint-types/unicorn/types';
8
8
  import 'eslint-plugin-antfu';
9
9
  import '@stylistic/eslint-plugin';
10
10
  import 'eslint';
11
-
12
- declare function vue(options?: ConfigurationOptions<"typescript"> & OverrideOptions & StylisticOptions): Promise<FlatConfigItem[]>;
13
-
14
- export { vue };
11
+ import '@typescript-eslint/parser';
@@ -1,8 +1,8 @@
1
1
  import {
2
2
  vue
3
- } from "../chunk-NUG6FLHN.mjs";
4
- import "../chunk-R4NSLRAE.mjs";
5
- import "../chunk-TQ476NL2.mjs";
3
+ } from "../chunk-VZ2YFMWH.mjs";
4
+ import "../chunk-4YBQZLPS.mjs";
5
+ import "../chunk-ATRL3UZP.mjs";
6
6
  export {
7
7
  vue
8
8
  };