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

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (149) hide show
  1. package/README.md +351 -48
  2. package/dist/{chunk-TQ476NL2.mjs → chunk-4YBQZLPS.mjs} +13 -2
  3. package/dist/{chunk-NDNDG7BH.mjs → chunk-5NK24IKQ.mjs} +2 -5
  4. package/dist/{chunk-2SW2E3TH.mjs → chunk-5SDSWPKR.mjs} +14 -4
  5. package/dist/chunk-6T7MXPCT.mjs +17 -0
  6. package/dist/{chunk-SPQZTV4E.mjs → chunk-7R4FYLS2.mjs} +19 -14
  7. package/dist/{chunk-ADP4MYOS.mjs → chunk-ANUYBAYV.mjs} +1 -1
  8. package/dist/{chunk-R4NSLRAE.mjs → chunk-ATRL3UZP.mjs} +14 -8
  9. package/dist/{chunk-P3N5WLFL.mjs → chunk-BXBN56WI.mjs} +11 -7
  10. package/dist/chunk-CJ3ZUYUJ.mjs +183 -0
  11. package/dist/chunk-DAJA5AV3.mjs +29 -0
  12. package/dist/{chunk-FK567E7G.mjs → chunk-DVQQVCGF.mjs} +7 -3
  13. package/dist/chunk-FU5SRKZU.mjs +104 -0
  14. package/dist/{chunk-LQLF2CMA.mjs → chunk-GBLPCM3X.mjs} +14 -17
  15. package/dist/chunk-KJ7ZCBK4.mjs +48 -0
  16. package/dist/{chunk-QZTI72NS.mjs → chunk-PYS26PF3.mjs} +13 -9
  17. package/dist/chunk-Q57BF3CR.mjs +63 -0
  18. package/dist/{chunk-3QHLEAXK.mjs → chunk-RDZJT36Z.mjs} +22 -8
  19. package/dist/chunk-RNFKNSHW.mjs +293 -0
  20. package/dist/{chunk-HE56XDG6.mjs → chunk-RVSUTDCE.mjs} +15 -5
  21. package/dist/chunk-UMUUVFB7.mjs +69 -0
  22. package/dist/{chunk-NUG6FLHN.mjs → chunk-VZ2YFMWH.mjs} +54 -11
  23. package/dist/chunk-WDSV2EFG.mjs +7 -0
  24. package/dist/{chunk-M5WNLLBT.mjs → chunk-WOYZWHPM.mjs} +20 -7
  25. package/dist/chunk-WRURTO5T.mjs +144 -0
  26. package/dist/{chunk-BAKUP7QM.mjs → chunk-Z7F6QSYQ.mjs} +44 -34
  27. package/dist/configs/astro.cjs +11 -21
  28. package/dist/configs/astro.d.cts +3 -6
  29. package/dist/configs/astro.d.ts +3 -6
  30. package/dist/configs/astro.mjs +3 -3
  31. package/dist/configs/comments.cjs +9 -12
  32. package/dist/configs/comments.d.cts +3 -2
  33. package/dist/configs/comments.d.ts +3 -2
  34. package/dist/configs/comments.mjs +1 -2
  35. package/dist/configs/formatters.cjs +274 -0
  36. package/dist/configs/formatters.d.cts +11 -0
  37. package/dist/configs/formatters.d.ts +11 -0
  38. package/dist/configs/formatters.mjs +9 -0
  39. package/dist/configs/ignores.cjs +1 -8
  40. package/dist/configs/ignores.d.cts +3 -2
  41. package/dist/configs/ignores.d.ts +3 -2
  42. package/dist/configs/ignores.mjs +2 -2
  43. package/dist/configs/imports.cjs +35 -9
  44. package/dist/configs/imports.d.cts +13 -4
  45. package/dist/configs/imports.d.ts +13 -4
  46. package/dist/configs/imports.mjs +2 -2
  47. package/dist/configs/index.cjs +1487 -1074
  48. package/dist/configs/index.d.cts +7 -18
  49. package/dist/configs/index.d.ts +7 -18
  50. package/dist/configs/index.mjs +40 -36
  51. package/dist/configs/javascript.cjs +16 -23
  52. package/dist/configs/javascript.d.cts +3 -6
  53. package/dist/configs/javascript.d.ts +3 -6
  54. package/dist/configs/javascript.mjs +2 -3
  55. package/dist/configs/jsdoc.cjs +6 -2
  56. package/dist/configs/jsdoc.d.cts +17 -4
  57. package/dist/configs/jsdoc.d.ts +17 -4
  58. package/dist/configs/jsdoc.mjs +2 -2
  59. package/dist/configs/jsonc.cjs +8 -11
  60. package/dist/configs/jsonc.d.cts +3 -6
  61. package/dist/configs/jsonc.d.ts +3 -6
  62. package/dist/configs/jsonc.mjs +3 -3
  63. package/dist/configs/markdown.cjs +46 -35
  64. package/dist/configs/markdown.d.cts +25 -4
  65. package/dist/configs/markdown.d.ts +25 -4
  66. package/dist/configs/markdown.mjs +3 -3
  67. package/dist/configs/nextjs.cjs +13 -11
  68. package/dist/configs/nextjs.d.cts +3 -6
  69. package/dist/configs/nextjs.d.ts +3 -6
  70. package/dist/configs/nextjs.mjs +3 -3
  71. package/dist/configs/node.cjs +0 -10
  72. package/dist/configs/node.d.cts +3 -2
  73. package/dist/configs/node.d.ts +3 -2
  74. package/dist/configs/node.mjs +1 -2
  75. package/dist/configs/perfectionist.cjs +2 -20
  76. package/dist/configs/perfectionist.d.cts +4 -3
  77. package/dist/configs/perfectionist.d.ts +4 -3
  78. package/dist/configs/perfectionist.mjs +1 -2
  79. package/dist/configs/react.cjs +206 -203
  80. package/dist/configs/react.d.cts +3 -6
  81. package/dist/configs/react.d.ts +3 -6
  82. package/dist/configs/react.mjs +3 -3
  83. package/dist/configs/sort.cjs +6 -6
  84. package/dist/configs/sort.d.cts +3 -2
  85. package/dist/configs/sort.d.ts +3 -2
  86. package/dist/configs/sort.mjs +1 -1
  87. package/dist/configs/stylistic.cjs +20 -11
  88. package/dist/configs/stylistic.d.cts +4 -7
  89. package/dist/configs/stylistic.d.ts +4 -7
  90. package/dist/configs/stylistic.mjs +4 -3
  91. package/dist/configs/tailwindcss.cjs +33 -47
  92. package/dist/configs/tailwindcss.d.cts +3 -6
  93. package/dist/configs/tailwindcss.d.ts +3 -6
  94. package/dist/configs/tailwindcss.mjs +3 -3
  95. package/dist/configs/test.cjs +103 -16
  96. package/dist/configs/test.d.cts +3 -6
  97. package/dist/configs/test.d.ts +3 -6
  98. package/dist/configs/test.mjs +4 -3
  99. package/dist/configs/toml.cjs +131 -0
  100. package/dist/configs/toml.d.cts +11 -0
  101. package/dist/configs/toml.d.ts +11 -0
  102. package/dist/configs/toml.mjs +8 -0
  103. package/dist/configs/typescript.cjs +39 -43
  104. package/dist/configs/typescript.d.cts +3 -6
  105. package/dist/configs/typescript.d.ts +3 -6
  106. package/dist/configs/typescript.mjs +3 -4
  107. package/dist/configs/unicorn.cjs +13 -10
  108. package/dist/configs/unicorn.d.cts +3 -2
  109. package/dist/configs/unicorn.d.ts +3 -2
  110. package/dist/configs/unicorn.mjs +1 -2
  111. package/dist/configs/unocss.cjs +48 -20
  112. package/dist/configs/unocss.d.cts +3 -6
  113. package/dist/configs/unocss.d.ts +3 -6
  114. package/dist/configs/unocss.mjs +3 -3
  115. package/dist/configs/vue.cjs +51 -15
  116. package/dist/configs/vue.d.cts +3 -6
  117. package/dist/configs/vue.d.ts +3 -6
  118. package/dist/configs/vue.mjs +3 -3
  119. package/dist/configs/yaml.cjs +17 -11
  120. package/dist/configs/yaml.d.cts +3 -6
  121. package/dist/configs/yaml.d.ts +3 -6
  122. package/dist/configs/yaml.mjs +3 -3
  123. package/dist/custom-rules/utils.cjs +31 -0
  124. package/dist/custom-rules/utils.d.cts +6 -0
  125. package/dist/custom-rules/utils.d.ts +6 -0
  126. package/dist/custom-rules/utils.mjs +6 -0
  127. package/dist/globs.cjs +157 -0
  128. package/dist/globs.d.cts +28 -0
  129. package/dist/globs.d.ts +28 -0
  130. package/dist/globs.mjs +56 -0
  131. package/dist/index.cjs +1267 -839
  132. package/dist/index.d.cts +10 -44
  133. package/dist/index.d.ts +10 -44
  134. package/dist/index.mjs +106 -146
  135. package/dist/types-spTEGSaV.d.cts +632 -0
  136. package/dist/types-spTEGSaV.d.ts +632 -0
  137. package/package.json +69 -37
  138. package/dist/chunk-24KJPXII.mjs +0 -51
  139. package/dist/chunk-4HH6LYJ6.mjs +0 -25
  140. package/dist/chunk-AL47KNVD.mjs +0 -37
  141. package/dist/chunk-C5VMTRKT.mjs +0 -18
  142. package/dist/chunk-ERFDRAGW.mjs +0 -86
  143. package/dist/chunk-HLDEUDLN.mjs +0 -28
  144. package/dist/chunk-O4O6V7LI.mjs +0 -70
  145. package/dist/chunk-UBPIYSHC.mjs +0 -284
  146. package/dist/types-h9izbkUX.d.cts +0 -241
  147. package/dist/types-h9izbkUX.d.ts +0 -241
  148. package/dist/{chunk-FKAOMYGL.mjs → chunk-ME2OAMS3.mjs} +0 -0
  149. package/dist/{chunk-FOIFEV73.mjs → chunk-XBASVDU6.mjs} +6 -6
@@ -1,13 +1,26 @@
1
- import {
2
- default as default2
3
- } from "./chunk-C5VMTRKT.mjs";
4
1
  import {
5
2
  interop
6
- } from "./chunk-TQ476NL2.mjs";
3
+ } from "./chunk-4YBQZLPS.mjs";
7
4
 
8
5
  // src/configs/stylistic.ts
6
+ import pluginAntfu from "eslint-plugin-antfu";
7
+ var StylisticConfigDefaults = {
8
+ indent: 2,
9
+ jsx: true,
10
+ quotes: "double",
11
+ semi: true
12
+ };
9
13
  async function stylistic(options = {}) {
10
- const { indent = 2, jsx = true, quotes = "double", semi = true } = options;
14
+ const {
15
+ indent,
16
+ jsx,
17
+ overrides = {},
18
+ quotes,
19
+ semi
20
+ } = {
21
+ ...StylisticConfigDefaults,
22
+ ...options
23
+ };
11
24
  const pluginStylistic = await interop(import("@stylistic/eslint-plugin"));
12
25
  const config = pluginStylistic.configs.customize({
13
26
  flat: true,
@@ -21,23 +34,24 @@ async function stylistic(options = {}) {
21
34
  {
22
35
  name: "luxass:stylistic",
23
36
  plugins: {
24
- antfu: default2,
37
+ antfu: pluginAntfu,
25
38
  style: pluginStylistic
26
39
  },
27
40
  rules: {
28
41
  ...config.rules,
29
42
  "antfu/consistent-list-newline": "error",
30
43
  "antfu/if-newline": "off",
31
- "antfu/indent-binary-ops": ["error", { indent }],
32
44
  "antfu/top-level-function": "error",
33
45
  "curly": ["error", "multi-line", "consistent"],
34
46
  "style/arrow-parens": ["error", "always", { requireForBlockBody: true }],
35
- "style/brace-style": ["error", "1tbs", { allowSingleLine: true }]
47
+ "style/brace-style": ["error", "1tbs", { allowSingleLine: true }],
48
+ ...overrides
36
49
  }
37
50
  }
38
51
  ];
39
52
  }
40
53
 
41
54
  export {
55
+ StylisticConfigDefaults,
42
56
  stylistic
43
57
  };
@@ -0,0 +1,293 @@
1
+ import {
2
+ ensure,
3
+ interop
4
+ } from "./chunk-4YBQZLPS.mjs";
5
+ import {
6
+ GLOB_JSX,
7
+ GLOB_TSX
8
+ } from "./chunk-ATRL3UZP.mjs";
9
+
10
+ // src/configs/react.ts
11
+ import { isPackageExists } from "local-pkg";
12
+ async function react(options = {}) {
13
+ const {
14
+ a11y = false,
15
+ files = [GLOB_JSX, GLOB_TSX],
16
+ overrides = {},
17
+ typescript = true
18
+ } = options;
19
+ await ensure([
20
+ "eslint-plugin-react",
21
+ "eslint-plugin-react-hooks",
22
+ "eslint-plugin-react-refresh",
23
+ ...options.a11y ? ["eslint-plugin-jsx-a11y"] : []
24
+ ]);
25
+ const [
26
+ pluginReact,
27
+ pluginReactHooks,
28
+ pluginReactRefresh,
29
+ pluginA11y
30
+ ] = await Promise.all([
31
+ interop(import("eslint-plugin-react")),
32
+ interop(import("eslint-plugin-react-hooks")),
33
+ interop(import("eslint-plugin-react-refresh")),
34
+ ...a11y ? [interop(import("eslint-plugin-jsx-a11y"))] : []
35
+ ]);
36
+ const isAllowConstantExport = ["vite"].some(
37
+ (i) => isPackageExists(i)
38
+ );
39
+ return [
40
+ {
41
+ name: "luxass:react:setup",
42
+ plugins: {
43
+ "react": pluginReact,
44
+ "react-hooks": pluginReactHooks,
45
+ "react-refresh": pluginReactRefresh,
46
+ ...a11y ? { "jsx-a11y": pluginA11y } : {}
47
+ }
48
+ },
49
+ {
50
+ name: "luxass:react:rules",
51
+ files,
52
+ languageOptions: {
53
+ parserOptions: {
54
+ ecmaFeatures: {
55
+ jsx: true
56
+ }
57
+ }
58
+ },
59
+ rules: {
60
+ ...a11y ? {
61
+ // recommended rules for jsx-a11y
62
+ "jsx-a11y/alt-text": "error",
63
+ "jsx-a11y/anchor-ambiguous-text": "off",
64
+ "jsx-a11y/anchor-has-content": "error",
65
+ "jsx-a11y/anchor-is-valid": "error",
66
+ "jsx-a11y/aria-activedescendant-has-tabindex": "error",
67
+ "jsx-a11y/aria-props": "error",
68
+ "jsx-a11y/aria-proptypes": "error",
69
+ "jsx-a11y/aria-role": "error",
70
+ "jsx-a11y/aria-unsupported-elements": "error",
71
+ "jsx-a11y/autocomplete-valid": "error",
72
+ "jsx-a11y/click-events-have-key-events": "error",
73
+ "jsx-a11y/control-has-associated-label": [
74
+ "off",
75
+ {
76
+ ignoreElements: [
77
+ "audio",
78
+ "canvas",
79
+ "embed",
80
+ "input",
81
+ "textarea",
82
+ "tr",
83
+ "video"
84
+ ],
85
+ ignoreRoles: [
86
+ "grid",
87
+ "listbox",
88
+ "menu",
89
+ "menubar",
90
+ "radiogroup",
91
+ "row",
92
+ "tablist",
93
+ "toolbar",
94
+ "tree",
95
+ "treegrid"
96
+ ],
97
+ includeRoles: [
98
+ "alert",
99
+ "dialog"
100
+ ]
101
+ }
102
+ ],
103
+ "jsx-a11y/heading-has-content": "error",
104
+ "jsx-a11y/html-has-lang": "error",
105
+ "jsx-a11y/iframe-has-title": "error",
106
+ "jsx-a11y/img-redundant-alt": "error",
107
+ "jsx-a11y/interactive-supports-focus": [
108
+ "error",
109
+ {
110
+ tabbable: [
111
+ "button",
112
+ "checkbox",
113
+ "link",
114
+ "searchbox",
115
+ "spinbutton",
116
+ "switch",
117
+ "textbox"
118
+ ]
119
+ }
120
+ ],
121
+ "jsx-a11y/label-has-associated-control": "error",
122
+ "jsx-a11y/label-has-for": "off",
123
+ "jsx-a11y/media-has-caption": "error",
124
+ "jsx-a11y/mouse-events-have-key-events": "error",
125
+ "jsx-a11y/no-access-key": "error",
126
+ "jsx-a11y/no-autofocus": "error",
127
+ "jsx-a11y/no-distracting-elements": "error",
128
+ "jsx-a11y/no-interactive-element-to-noninteractive-role": [
129
+ "error",
130
+ {
131
+ canvas: [
132
+ "img"
133
+ ],
134
+ tr: [
135
+ "none",
136
+ "presentation"
137
+ ]
138
+ }
139
+ ],
140
+ "jsx-a11y/no-noninteractive-element-interactions": [
141
+ "error",
142
+ {
143
+ alert: [
144
+ "onKeyUp",
145
+ "onKeyDown",
146
+ "onKeyPress"
147
+ ],
148
+ body: [
149
+ "onError",
150
+ "onLoad"
151
+ ],
152
+ dialog: [
153
+ "onKeyUp",
154
+ "onKeyDown",
155
+ "onKeyPress"
156
+ ],
157
+ handlers: [
158
+ "onClick",
159
+ "onError",
160
+ "onLoad",
161
+ "onMouseDown",
162
+ "onMouseUp",
163
+ "onKeyPress",
164
+ "onKeyDown",
165
+ "onKeyUp"
166
+ ],
167
+ iframe: [
168
+ "onError",
169
+ "onLoad"
170
+ ],
171
+ img: [
172
+ "onError",
173
+ "onLoad"
174
+ ]
175
+ }
176
+ ],
177
+ "jsx-a11y/no-noninteractive-element-to-interactive-role": [
178
+ "error",
179
+ {
180
+ fieldset: [
181
+ "radiogroup",
182
+ "presentation"
183
+ ],
184
+ li: [
185
+ "menuitem",
186
+ "option",
187
+ "row",
188
+ "tab",
189
+ "treeitem"
190
+ ],
191
+ ol: [
192
+ "listbox",
193
+ "menu",
194
+ "menubar",
195
+ "radiogroup",
196
+ "tablist",
197
+ "tree",
198
+ "treegrid"
199
+ ],
200
+ table: [
201
+ "grid"
202
+ ],
203
+ td: [
204
+ "gridcell"
205
+ ],
206
+ ul: [
207
+ "listbox",
208
+ "menu",
209
+ "menubar",
210
+ "radiogroup",
211
+ "tablist",
212
+ "tree",
213
+ "treegrid"
214
+ ]
215
+ }
216
+ ],
217
+ "jsx-a11y/no-noninteractive-tabindex": [
218
+ "error",
219
+ {
220
+ allowExpressionValues: true,
221
+ roles: [
222
+ "tabpanel"
223
+ ],
224
+ tags: []
225
+ }
226
+ ],
227
+ "jsx-a11y/no-redundant-roles": "error",
228
+ "jsx-a11y/no-static-element-interactions": [
229
+ "error",
230
+ {
231
+ allowExpressionValues: true,
232
+ handlers: [
233
+ "onClick",
234
+ "onMouseDown",
235
+ "onMouseUp",
236
+ "onKeyPress",
237
+ "onKeyDown",
238
+ "onKeyUp"
239
+ ]
240
+ }
241
+ ],
242
+ "jsx-a11y/role-has-required-aria-props": "error",
243
+ "jsx-a11y/role-supports-aria-props": "error",
244
+ "jsx-a11y/scope": "error",
245
+ "jsx-a11y/tabindex-no-positive": "error"
246
+ } : {},
247
+ // recommended rules react
248
+ "react/display-name": "error",
249
+ "react/jsx-key": "error",
250
+ "react/jsx-no-comment-textnodes": "error",
251
+ "react/jsx-no-duplicate-props": "error",
252
+ "react/jsx-no-target-blank": "error",
253
+ "react/jsx-no-undef": "error",
254
+ "react/jsx-uses-react": "error",
255
+ "react/jsx-uses-vars": "error",
256
+ "react/no-children-prop": "error",
257
+ "react/no-danger-with-children": "error",
258
+ "react/no-deprecated": "error",
259
+ "react/no-direct-mutation-state": "error",
260
+ "react/no-find-dom-node": "error",
261
+ "react/no-is-mounted": "error",
262
+ "react/no-render-return-value": "error",
263
+ "react/no-string-refs": "error",
264
+ "react/no-unescaped-entities": "error",
265
+ "react/no-unknown-property": "error",
266
+ "react/no-unsafe": "off",
267
+ "react/prop-types": "error",
268
+ "react/react-in-jsx-scope": "off",
269
+ "react/require-render-return": "error",
270
+ // recommended rules react-hooks
271
+ "react-hooks/exhaustive-deps": "warn",
272
+ "react-hooks/rules-of-hooks": "error",
273
+ // react refresh
274
+ "react-refresh/only-export-components": ["warn", { allowConstantExport: isAllowConstantExport }],
275
+ ...typescript ? {
276
+ "react/jsx-no-undef": "off",
277
+ "react/prop-type": "off"
278
+ } : {},
279
+ // overrides
280
+ ...overrides
281
+ },
282
+ settings: {
283
+ react: {
284
+ version: "detect"
285
+ }
286
+ }
287
+ }
288
+ ];
289
+ }
290
+
291
+ export {
292
+ react
293
+ };
@@ -1,41 +1,51 @@
1
- import {
2
- default4 as default2
3
- } from "./chunk-C5VMTRKT.mjs";
4
-
5
1
  // src/configs/unicorn.ts
2
+ import pluginUnicorn from "eslint-plugin-unicorn";
6
3
  function unicorn() {
7
4
  return [
8
5
  {
9
6
  name: "luxass:unicorn",
10
7
  plugins: {
11
- unicorn: default2
8
+ unicorn: pluginUnicorn
12
9
  },
13
10
  rules: {
14
11
  // Pass error message when throwing errors
12
+ // https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/error-message.md
15
13
  "unicorn/error-message": "error",
16
14
  // Uppercase regex escapes
15
+ // https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/escape-case.md
17
16
  "unicorn/escape-case": "error",
18
17
  // Array.isArray instead of instanceof
18
+ // https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/no-instanceof-array.md
19
19
  "unicorn/no-instanceof-array": "error",
20
20
  // Ban `new Array` as `Array` constructor's params are ambiguous
21
+ // https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/no-new-array.md
21
22
  "unicorn/no-new-array": "error",
22
23
  // Prevent deprecated `new Buffer()`
24
+ // https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/no-new-buffer.md
23
25
  "unicorn/no-new-buffer": "error",
24
26
  // Lowercase number formatting for octal, hex, binary (0x1'error' instead of 0X1'error')
27
+ // https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/number-literal-case.md
25
28
  "unicorn/number-literal-case": "error",
26
29
  // textContent instead of innerText
30
+ // https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/prefer-dom-node-text-content.md
27
31
  "unicorn/prefer-dom-node-text-content": "error",
28
32
  // includes over indexOf when checking for existence
33
+ // https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/prefer-includes.md
29
34
  "unicorn/prefer-includes": "error",
30
35
  // Prefer using the node: protocol
36
+ // https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/prefer-node-protocol.md
31
37
  "unicorn/prefer-node-protocol": "error",
32
38
  // Prefer using number properties like `Number.isNaN` rather than `isNaN`
39
+ // https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/prefer-number-properties.md
33
40
  "unicorn/prefer-number-properties": "error",
34
41
  // String methods startsWith/endsWith instead of more complicated stuff
42
+ // https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/prefer-string-starts-ends-with.md
35
43
  "unicorn/prefer-string-starts-ends-with": "error",
36
44
  // Enforce throwing type error when throwing error while checking typeof
45
+ // https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/prefer-type-error.md
37
46
  "unicorn/prefer-type-error": "error",
38
47
  // Use new when throwing error
48
+ // https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/throw-new-error.md
39
49
  "unicorn/throw-new-error": "error"
40
50
  }
41
51
  }
@@ -0,0 +1,69 @@
1
+ import {
2
+ interop
3
+ } from "./chunk-4YBQZLPS.mjs";
4
+ import {
5
+ GLOB_TOML
6
+ } from "./chunk-ATRL3UZP.mjs";
7
+
8
+ // src/configs/toml.ts
9
+ async function toml(options = {}) {
10
+ const {
11
+ files = [GLOB_TOML],
12
+ overrides = {},
13
+ stylistic = true
14
+ } = options;
15
+ const {
16
+ indent = 2
17
+ } = typeof stylistic === "boolean" ? {} : stylistic;
18
+ const [
19
+ pluginToml,
20
+ parserToml
21
+ ] = await Promise.all([
22
+ interop(import("eslint-plugin-toml")),
23
+ interop(import("toml-eslint-parser"))
24
+ ]);
25
+ return [
26
+ {
27
+ name: "luxass:toml:setup",
28
+ plugins: {
29
+ toml: pluginToml
30
+ }
31
+ },
32
+ {
33
+ name: "luxass:toml:rules",
34
+ files,
35
+ languageOptions: {
36
+ parser: parserToml
37
+ },
38
+ rules: {
39
+ "style/spaced-comment": "off",
40
+ "toml/comma-style": "error",
41
+ "toml/keys-order": "error",
42
+ "toml/no-space-dots": "error",
43
+ "toml/no-unreadable-number-separator": "error",
44
+ "toml/precision-of-fractional-seconds": "error",
45
+ "toml/precision-of-integer": "error",
46
+ "toml/tables-order": "error",
47
+ "toml/vue-custom-block/no-parsing-error": "error",
48
+ ...stylistic ? {
49
+ "toml/array-bracket-newline": "error",
50
+ "toml/array-bracket-spacing": "error",
51
+ "toml/array-element-newline": "error",
52
+ "toml/indent": ["error", indent === "tab" ? 2 : indent],
53
+ "toml/inline-table-curly-spacing": "error",
54
+ "toml/key-spacing": "error",
55
+ "toml/padding-line-between-pairs": "error",
56
+ "toml/padding-line-between-tables": "error",
57
+ "toml/quoted-keys": "error",
58
+ "toml/spaced-comment": "error",
59
+ "toml/table-bracket-spacing": "error"
60
+ } : {},
61
+ ...overrides
62
+ }
63
+ }
64
+ ];
65
+ }
66
+
67
+ export {
68
+ toml
69
+ };
@@ -1,20 +1,31 @@
1
- import {
2
- GLOB_VUE
3
- } from "./chunk-R4NSLRAE.mjs";
4
1
  import {
5
2
  interop
6
- } from "./chunk-TQ476NL2.mjs";
3
+ } from "./chunk-4YBQZLPS.mjs";
4
+ import {
5
+ GLOB_VUE
6
+ } from "./chunk-ATRL3UZP.mjs";
7
7
 
8
8
  // src/configs/vue.ts
9
+ import { mergeProcessors } from "eslint-merge-processors";
9
10
  async function vue(options = {}) {
10
- const { overrides = {}, stylistic = true } = options;
11
+ const {
12
+ a11y = true,
13
+ files = [GLOB_VUE],
14
+ overrides = {},
15
+ stylistic = true
16
+ } = options;
11
17
  const [
12
18
  pluginVue,
13
- parserVue
19
+ parserVue,
20
+ processorVueBlocks,
21
+ pluginA11y
14
22
  ] = await Promise.all([
15
23
  interop(import("eslint-plugin-vue")),
16
- interop(import("vue-eslint-parser"))
24
+ interop(import("vue-eslint-parser")),
25
+ interop(import("eslint-processor-vue-blocks")),
26
+ ...a11y ? [interop(import("eslint-plugin-vuejs-accessibility"))] : []
17
27
  ]);
28
+ const sfcBlocks = options.sfcBlocks === true ? {} : options.sfcBlocks ?? {};
18
29
  const {
19
30
  indent = 2
20
31
  } = typeof stylistic === "boolean" ? {} : stylistic;
@@ -22,11 +33,13 @@ async function vue(options = {}) {
22
33
  {
23
34
  name: "luxass:vue:setup",
24
35
  plugins: {
25
- vue: pluginVue
36
+ vue: pluginVue,
37
+ ...a11y ? { "vue-a11y": pluginA11y } : {}
26
38
  }
27
39
  },
28
40
  {
29
- files: [GLOB_VUE],
41
+ name: "luxass:vue:rules",
42
+ files,
30
43
  languageOptions: {
31
44
  parser: parserVue,
32
45
  parserOptions: {
@@ -38,8 +51,16 @@ async function vue(options = {}) {
38
51
  sourceType: "module"
39
52
  }
40
53
  },
41
- name: "luxass:vue:rules",
42
- processor: pluginVue.processors[".vue"],
54
+ processor: sfcBlocks === false ? pluginVue.processors[".vue"] : mergeProcessors([
55
+ pluginVue.processors[".vue"],
56
+ processorVueBlocks({
57
+ ...sfcBlocks,
58
+ blocks: {
59
+ styles: true,
60
+ ...sfcBlocks.blocks
61
+ }
62
+ })
63
+ ]),
43
64
  rules: {
44
65
  ...pluginVue.configs.base.rules,
45
66
  ...pluginVue.configs["vue3-essential"].rules,
@@ -148,6 +169,28 @@ async function vue(options = {}) {
148
169
  "vue/space-in-parens": ["error", "never"],
149
170
  "vue/template-curly-spacing": "error"
150
171
  } : {},
172
+ ...a11y ? {
173
+ "vue-a11y/alt-text": "error",
174
+ "vue-a11y/anchor-has-content": "error",
175
+ "vue-a11y/aria-props": "error",
176
+ "vue-a11y/aria-role": "error",
177
+ "vue-a11y/aria-unsupported-elements": "error",
178
+ "vue-a11y/click-events-have-key-events": "error",
179
+ "vue-a11y/form-control-has-label": "error",
180
+ "vue-a11y/heading-has-content": "error",
181
+ "vue-a11y/iframe-has-title": "error",
182
+ "vue-a11y/interactive-supports-focus": "error",
183
+ "vue-a11y/label-has-for": "error",
184
+ "vue-a11y/media-has-caption": "error",
185
+ "vue-a11y/mouse-events-have-key-events": "error",
186
+ "vue-a11y/no-access-key": "error",
187
+ "vue-a11y/no-autofocus": "error",
188
+ "vue-a11y/no-distracting-elements": "error",
189
+ "vue-a11y/no-redundant-roles": "error",
190
+ "vue-a11y/no-static-element-interactions": "error",
191
+ "vue-a11y/role-has-required-aria-props": "error",
192
+ "vue-a11y/tabindex-no-positive": "error"
193
+ } : {},
151
194
  ...overrides
152
195
  }
153
196
  }
@@ -0,0 +1,7 @@
1
+ // src/custom-rules/utils.ts
2
+ import { ESLintUtils } from "@typescript-eslint/utils";
3
+ var createRule = ESLintUtils.RuleCreator((ruleName) => `https://github.com/luxass/eslint-config/blob/main/src/custom-rules/${ruleName}/README.md`);
4
+
5
+ export {
6
+ createRule
7
+ };
@@ -1,13 +1,17 @@
1
- import {
2
- GLOB_YAML
3
- } from "./chunk-R4NSLRAE.mjs";
4
1
  import {
5
2
  interop
6
- } from "./chunk-TQ476NL2.mjs";
3
+ } from "./chunk-4YBQZLPS.mjs";
4
+ import {
5
+ GLOB_YAML
6
+ } from "./chunk-ATRL3UZP.mjs";
7
7
 
8
8
  // src/configs/yaml.ts
9
9
  async function yaml(options = {}) {
10
- const { overrides = {}, stylistic = true } = options;
10
+ const {
11
+ files = [GLOB_YAML],
12
+ overrides = {},
13
+ stylistic = true
14
+ } = options;
11
15
  const [
12
16
  pluginYaml,
13
17
  parserYaml
@@ -27,16 +31,17 @@ async function yaml(options = {}) {
27
31
  }
28
32
  },
29
33
  {
30
- files: [GLOB_YAML],
34
+ name: "luxass:yaml:rules",
35
+ files,
31
36
  languageOptions: {
32
37
  parser: parserYaml
33
38
  },
34
- name: "luxass:yaml:rules",
35
39
  rules: {
36
40
  "style/spaced-comment": "off",
37
41
  "yaml/block-mapping": "error",
38
42
  "yaml/block-sequence": "error",
39
43
  "yaml/no-empty-key": "error",
44
+ "yaml/no-empty-mapping-value": "error",
40
45
  "yaml/no-empty-sequence-entry": "error",
41
46
  "yaml/no-irregular-whitespace": "error",
42
47
  "yaml/plain-scalar": "error",
@@ -59,6 +64,14 @@ async function yaml(options = {}) {
59
64
  } : {},
60
65
  ...overrides
61
66
  }
67
+ },
68
+ {
69
+ name: "luxass:yaml:github-actions",
70
+ files: ["**/.github/workflows/*.{yml,yaml}"],
71
+ rules: {
72
+ // GitHub Actions supports empty values to enable features
73
+ "yaml/no-empty-mapping-value": "off"
74
+ }
62
75
  }
63
76
  ];
64
77
  }