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