@luxass/eslint-config 4.0.0-beta.13 → 4.0.0-beta.14
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 +76 -24
- package/dist/chunk-2U46NSDO.mjs +201 -0
- package/dist/{chunk-GDLAZL2U.mjs → chunk-373KVOWN.mjs} +3 -9
- package/dist/{chunk-QZTI72NS.mjs → chunk-4HRTXFWO.mjs} +5 -5
- package/dist/{chunk-P3N5WLFL.mjs → chunk-6ISPPQXV.mjs} +4 -4
- package/dist/{chunk-M5WNLLBT.mjs → chunk-7GTKYZYV.mjs} +3 -3
- package/dist/{chunk-KU6VCFCN.mjs → chunk-BUPZYZVV.mjs} +3 -3
- package/dist/{chunk-R4NSLRAE.mjs → chunk-DB44ZJL2.mjs} +4 -0
- package/dist/{chunk-BAKUP7QM.mjs → chunk-NYNG5MO5.mjs} +6 -9
- package/dist/{chunk-NUG6FLHN.mjs → chunk-OEYWD3ZM.mjs} +26 -10
- package/dist/{chunk-24KJPXII.mjs → chunk-Q2Q636N2.mjs} +3 -3
- package/dist/{chunk-3QHLEAXK.mjs → chunk-QX3N2TR4.mjs} +19 -5
- package/dist/{chunk-YDSNPJF5.mjs → chunk-R5JWBBVA.mjs} +3 -3
- package/dist/{chunk-SPQZTV4E.mjs → chunk-RRMOX2LR.mjs} +1 -1
- package/dist/{chunk-ADP4MYOS.mjs → chunk-SWLQ7JNL.mjs} +1 -1
- package/dist/{chunk-ERFDRAGW.mjs → chunk-WD3C3J3C.mjs} +25 -9
- package/dist/configs/astro.cjs +0 -30
- package/dist/configs/astro.d.cts +2 -1
- package/dist/configs/astro.d.ts +2 -1
- package/dist/configs/astro.mjs +2 -2
- package/dist/configs/comments.d.cts +2 -1
- package/dist/configs/comments.d.ts +2 -1
- package/dist/configs/formatters.cjs +307 -0
- package/dist/configs/{tailwindcss.d.ts → formatters.d.cts} +4 -3
- package/dist/configs/{tailwindcss.d.cts → formatters.d.ts} +4 -3
- package/dist/configs/formatters.mjs +10 -0
- package/dist/configs/ignores.d.cts +2 -1
- package/dist/configs/ignores.d.ts +2 -1
- package/dist/configs/ignores.mjs +2 -2
- package/dist/configs/imports.d.cts +2 -1
- package/dist/configs/imports.d.ts +2 -1
- package/dist/configs/index.cjs +59 -83
- package/dist/configs/index.d.cts +2 -2
- package/dist/configs/index.d.ts +2 -2
- package/dist/configs/index.mjs +21 -25
- package/dist/configs/javascript.d.cts +2 -1
- package/dist/configs/javascript.d.ts +2 -1
- package/dist/configs/javascript.mjs +2 -2
- package/dist/configs/jsdoc.d.cts +2 -1
- package/dist/configs/jsdoc.d.ts +2 -1
- package/dist/configs/jsonc.d.cts +2 -1
- package/dist/configs/jsonc.d.ts +2 -1
- package/dist/configs/jsonc.mjs +2 -2
- package/dist/configs/markdown.cjs +21 -5
- package/dist/configs/markdown.d.cts +2 -1
- package/dist/configs/markdown.d.ts +2 -1
- package/dist/configs/markdown.mjs +2 -2
- package/dist/configs/nextjs.d.cts +2 -1
- package/dist/configs/nextjs.d.ts +2 -1
- package/dist/configs/nextjs.mjs +2 -2
- package/dist/configs/node.d.cts +2 -1
- package/dist/configs/node.d.ts +2 -1
- package/dist/configs/perfectionist.d.cts +2 -1
- package/dist/configs/perfectionist.d.ts +2 -1
- package/dist/configs/react.d.cts +2 -1
- package/dist/configs/react.d.ts +2 -1
- package/dist/configs/react.mjs +2 -2
- package/dist/configs/sort.d.cts +2 -1
- package/dist/configs/sort.d.ts +2 -1
- package/dist/configs/stylistic.cjs +17 -2
- package/dist/configs/stylistic.d.cts +4 -2
- package/dist/configs/stylistic.d.ts +4 -2
- package/dist/configs/stylistic.mjs +4 -2
- package/dist/configs/test.d.cts +2 -1
- package/dist/configs/test.d.ts +2 -1
- package/dist/configs/test.mjs +2 -2
- package/dist/configs/typescript.cjs +0 -3
- package/dist/configs/typescript.d.cts +2 -1
- package/dist/configs/typescript.d.ts +2 -1
- package/dist/configs/typescript.mjs +3 -3
- package/dist/configs/unicorn.d.cts +2 -1
- package/dist/configs/unicorn.d.ts +2 -1
- package/dist/configs/unocss.d.cts +2 -1
- package/dist/configs/unocss.d.ts +2 -1
- package/dist/configs/unocss.mjs +2 -2
- package/dist/configs/vue.cjs +23 -7
- package/dist/configs/vue.d.cts +3 -2
- package/dist/configs/vue.d.ts +3 -2
- package/dist/configs/vue.mjs +2 -2
- package/dist/configs/yaml.d.cts +2 -1
- package/dist/configs/yaml.d.ts +2 -1
- package/dist/configs/yaml.mjs +2 -2
- package/dist/index.cjs +265 -104
- package/dist/index.d.cts +5 -3
- package/dist/index.d.ts +5 -3
- package/dist/index.mjs +48 -49
- package/dist/{types-Nt3GhJIZ.d.ts → types-hyajDir3.d.cts} +164 -37
- package/dist/{types-Nt3GhJIZ.d.cts → types-hyajDir3.d.ts} +164 -37
- package/package.json +24 -23
- package/dist/chunk-O4O6V7LI.mjs +0 -70
- package/dist/configs/tailwindcss.cjs +0 -162
- package/dist/configs/tailwindcss.mjs +0 -8
- /package/dist/{chunk-FKAOMYGL.mjs → chunk-QMWKLGGE.mjs} +0 -0
package/README.md
CHANGED
|
@@ -4,16 +4,22 @@
|
|
|
4
4
|
[![npm downloads][npm-downloads-src]][npm-downloads-href]
|
|
5
5
|
|
|
6
6
|
> [!IMPORTANT]
|
|
7
|
-
> The configuration is not currently finished.
|
|
7
|
+
> The configuration is not currently finished.
|
|
8
8
|
> I could change at any moment.
|
|
9
9
|
|
|
10
10
|
## ✨ Features
|
|
11
11
|
|
|
12
|
-
-
|
|
13
|
-
-
|
|
14
|
-
-
|
|
12
|
+
- Based on [Antfu's ESLint Config](https://github.com/antfu/eslint-config)
|
|
13
|
+
- Auto fix for formatting (aimed to be used standalone **without** Prettier)
|
|
14
|
+
- Designed to work with TypeScript, JSX, Vue & Astro out-of-box
|
|
15
|
+
- Lints also for json, yaml, markdown
|
|
16
|
+
- Sorted imports, dangling commas
|
|
17
|
+
- Reasonable defaults, best practices, only one-line of config
|
|
18
|
+
- Opinionated, but [very customizable](#customization)
|
|
15
19
|
- [ESLint Flat config](https://eslint.org/docs/latest/use/configure/configuration-files-new), compose easily!
|
|
16
|
-
- Using [ESLint Stylistic](https://
|
|
20
|
+
- Using [ESLint Stylistic](https://github.com/eslint-stylistic/eslint-stylistic)
|
|
21
|
+
- Respects `.gitignore` by default
|
|
22
|
+
- Optional [formatters](#formatters) support for CSS, HTML, TOML, etc.
|
|
17
23
|
|
|
18
24
|
## 📦 Install
|
|
19
25
|
|
|
@@ -167,6 +173,7 @@ export default await luxass({
|
|
|
167
173
|
rules: {}
|
|
168
174
|
});
|
|
169
175
|
```
|
|
176
|
+
|
|
170
177
|
<details>
|
|
171
178
|
<summary>Advanced Example</summary>
|
|
172
179
|
|
|
@@ -221,15 +228,15 @@ Check out the [configs](https://github.com/luxass/eslint-config/blob/main/src/co
|
|
|
221
228
|
|
|
222
229
|
Since flat config requires us to explicitly provide the plugin names (instead of mandatory convention from npm package name), we renamed some plugins to make overall scope more consistent and easier to write.
|
|
223
230
|
|
|
224
|
-
| New Prefix | Original Prefix
|
|
225
|
-
|
|
|
226
|
-
| `import/*` | `i/*`
|
|
227
|
-
| `node/*`
|
|
228
|
-
| `yaml/*`
|
|
229
|
-
| `ts/*`
|
|
230
|
-
| `style/*`
|
|
231
|
-
| `test/*`
|
|
232
|
-
| `test/*`
|
|
231
|
+
| New Prefix | Original Prefix | Source Plugin |
|
|
232
|
+
| ---------- | ---------------------- | ------------------------------------------------------------------------------------------ |
|
|
233
|
+
| `import/*` | `i/*` | [eslint-plugin-i](https://github.com/un-es/eslint-plugin-i) |
|
|
234
|
+
| `node/*` | `n/*` | [eslint-plugin-n](https://github.com/eslint-community/eslint-plugin-n) |
|
|
235
|
+
| `yaml/*` | `yml/*` | [eslint-plugin-yml](https://github.com/ota-meshi/eslint-plugin-yml) |
|
|
236
|
+
| `ts/*` | `@typescript-eslint/*` | [@typescript-eslint/eslint-plugin](https://github.com/typescript-eslint/typescript-eslint) |
|
|
237
|
+
| `style/*` | `@stylistic/*` | [@stylistic/eslint-plugin](https://github.com/eslint-stylistic/eslint-stylistic) |
|
|
238
|
+
| `test/*` | `vitest/*` | [eslint-plugin-vitest](https://github.com/veritem/eslint-plugin-vitest) |
|
|
239
|
+
| `test/*` | `no-only-tests/*` | [eslint-plugin-no-only-tests](https://github.com/levibuzolic/eslint-plugin-no-only-tests) |
|
|
233
240
|
|
|
234
241
|
When you want to override rules, or disable them inline, you need to update to the new prefix:
|
|
235
242
|
|
|
@@ -289,6 +296,50 @@ export default luxass({
|
|
|
289
296
|
|
|
290
297
|
We provide some optional configs for specific use cases, that we don't include their dependencies by default.
|
|
291
298
|
|
|
299
|
+
#### Formatters
|
|
300
|
+
|
|
301
|
+
> [!WARNING]
|
|
302
|
+
> Experimental feature, changes might not follow semver.
|
|
303
|
+
|
|
304
|
+
Use external formatters to format files that ESLint cannot handle yet (`.css`, `.html`, etc). Powered by [`eslint-plugin-format`](https://github.com/antfu/eslint-plugin-format).
|
|
305
|
+
|
|
306
|
+
```js
|
|
307
|
+
// eslint.config.js
|
|
308
|
+
import luxass from "@luxass/eslint-config";
|
|
309
|
+
|
|
310
|
+
export default luxass({
|
|
311
|
+
formatters: {
|
|
312
|
+
/**
|
|
313
|
+
* Format CSS, LESS, SCSS files, also the `<style>` blocks in Vue
|
|
314
|
+
* By default uses Prettier
|
|
315
|
+
*/
|
|
316
|
+
css: true,
|
|
317
|
+
/**
|
|
318
|
+
* Format HTML files
|
|
319
|
+
* By default uses Prettier
|
|
320
|
+
*/
|
|
321
|
+
html: true,
|
|
322
|
+
/**
|
|
323
|
+
* Format TOML files
|
|
324
|
+
* Currently only supports dprint
|
|
325
|
+
*/
|
|
326
|
+
toml: "dprint",
|
|
327
|
+
/**
|
|
328
|
+
* Format Markdown files
|
|
329
|
+
* Supports Prettier and dprint
|
|
330
|
+
* By default uses Prettier
|
|
331
|
+
*/
|
|
332
|
+
markdown: "prettier"
|
|
333
|
+
}
|
|
334
|
+
});
|
|
335
|
+
```
|
|
336
|
+
|
|
337
|
+
Running `npx eslint` should prompt you to install the required dependencies, otherwise, you can install them manually:
|
|
338
|
+
|
|
339
|
+
```bash
|
|
340
|
+
npm i -D eslint-plugin-format
|
|
341
|
+
```
|
|
342
|
+
|
|
292
343
|
#### React
|
|
293
344
|
|
|
294
345
|
To enable React support, need to explicitly turn it on:
|
|
@@ -308,42 +359,44 @@ Running `npx eslint` should prompt you to install the required dependencies, oth
|
|
|
308
359
|
npm i -D eslint-plugin-react eslint-plugin-react-hooks eslint-plugin-react-refresh
|
|
309
360
|
```
|
|
310
361
|
|
|
311
|
-
####
|
|
362
|
+
#### Next.JS
|
|
312
363
|
|
|
313
|
-
To enable
|
|
364
|
+
To enable Next.JS support, need to explicitly turn it on:
|
|
365
|
+
|
|
366
|
+
Next.JS also enables React support.
|
|
314
367
|
|
|
315
368
|
```js
|
|
316
369
|
// eslint.config.js
|
|
317
370
|
import luxass from "@luxass/eslint-config";
|
|
318
371
|
|
|
319
372
|
export default luxass({
|
|
320
|
-
|
|
373
|
+
nextjs: true,
|
|
321
374
|
});
|
|
322
375
|
```
|
|
323
376
|
|
|
324
377
|
Running `npx eslint` should prompt you to install the required dependencies, otherwise, you can install them manually:
|
|
325
378
|
|
|
326
379
|
```bash
|
|
327
|
-
npm i -D @
|
|
380
|
+
npm i -D eslint-plugin-react eslint-plugin-react-hooks eslint-plugin-react-refresh @next/eslint-plugin-next
|
|
328
381
|
```
|
|
329
382
|
|
|
330
|
-
####
|
|
383
|
+
#### UnoCSS
|
|
331
384
|
|
|
332
|
-
To enable
|
|
385
|
+
To enable UnoCSS support, need to explicitly turn it on:
|
|
333
386
|
|
|
334
387
|
```js
|
|
335
388
|
// eslint.config.js
|
|
336
389
|
import luxass from "@luxass/eslint-config";
|
|
337
390
|
|
|
338
391
|
export default luxass({
|
|
339
|
-
|
|
392
|
+
unocss: true,
|
|
340
393
|
});
|
|
341
394
|
```
|
|
342
395
|
|
|
343
396
|
Running `npx eslint` should prompt you to install the required dependencies, otherwise, you can install them manually:
|
|
344
397
|
|
|
345
398
|
```bash
|
|
346
|
-
npm i -D eslint-plugin
|
|
399
|
+
npm i -D @unocss/eslint-plugin
|
|
347
400
|
```
|
|
348
401
|
|
|
349
402
|
### Optional Rules
|
|
@@ -354,7 +407,7 @@ This config also provides some optional plugins/rules for extended usages.
|
|
|
354
407
|
|
|
355
408
|
This plugin [`eslint-plugin-perfectionist`](https://github.com/azat-io/eslint-plugin-perfectionist) allows you to sorted object keys, imports, etc, with auto-fix.
|
|
356
409
|
|
|
357
|
-
The plugin is installed but no rules are enabled by default.
|
|
410
|
+
The plugin is installed but no rules are enabled by default.
|
|
358
411
|
|
|
359
412
|
It's recommended to opt-in on each file individually using [configuration comments](https://eslint.org/docs/latest/use/configure/rules#using-configuration-comments-1).
|
|
360
413
|
|
|
@@ -368,7 +421,6 @@ const objectWantedToSort = {
|
|
|
368
421
|
/* eslint perfectionist/sort-objects: "off" */
|
|
369
422
|
```
|
|
370
423
|
|
|
371
|
-
|
|
372
424
|
### Type Aware Rules
|
|
373
425
|
|
|
374
426
|
You can optionally enable the [type aware rules](https://typescript-eslint.io/linting/typed-linting/) by passing the options object to the `typescript` config:
|
|
@@ -0,0 +1,201 @@
|
|
|
1
|
+
import {
|
|
2
|
+
StylisticConfigDefaults
|
|
3
|
+
} from "./chunk-QX3N2TR4.mjs";
|
|
4
|
+
import {
|
|
5
|
+
ensure,
|
|
6
|
+
interop
|
|
7
|
+
} from "./chunk-TQ476NL2.mjs";
|
|
8
|
+
import {
|
|
9
|
+
GLOB_CSS,
|
|
10
|
+
GLOB_LESS,
|
|
11
|
+
GLOB_MARKDOWN,
|
|
12
|
+
GLOB_POSTCSS,
|
|
13
|
+
GLOB_SCSS
|
|
14
|
+
} from "./chunk-DB44ZJL2.mjs";
|
|
15
|
+
|
|
16
|
+
// src/configs/formatters.ts
|
|
17
|
+
import * as parserPlain from "eslint-parser-plain";
|
|
18
|
+
async function formatters(options = {}, stylistic = {}) {
|
|
19
|
+
await ensure([
|
|
20
|
+
"eslint-plugin-format"
|
|
21
|
+
]);
|
|
22
|
+
if (options === true) {
|
|
23
|
+
options = {
|
|
24
|
+
css: true,
|
|
25
|
+
graphql: true,
|
|
26
|
+
html: true,
|
|
27
|
+
markdown: true,
|
|
28
|
+
toml: true
|
|
29
|
+
};
|
|
30
|
+
}
|
|
31
|
+
const {
|
|
32
|
+
indent,
|
|
33
|
+
quotes,
|
|
34
|
+
semi
|
|
35
|
+
} = {
|
|
36
|
+
...StylisticConfigDefaults,
|
|
37
|
+
...stylistic
|
|
38
|
+
};
|
|
39
|
+
const prettierOptions = Object.assign(
|
|
40
|
+
{
|
|
41
|
+
endOfLine: "auto",
|
|
42
|
+
semi,
|
|
43
|
+
singleQuote: quotes === "single",
|
|
44
|
+
tabWidth: typeof indent === "number" ? indent : 2,
|
|
45
|
+
trailingComma: "all",
|
|
46
|
+
useTabs: indent === "tab"
|
|
47
|
+
},
|
|
48
|
+
options.prettierOptions || {}
|
|
49
|
+
);
|
|
50
|
+
const dprintOptions = Object.assign(
|
|
51
|
+
{
|
|
52
|
+
indentWidth: typeof indent === "number" ? indent : 2,
|
|
53
|
+
quoteStyle: quotes === "single" ? "preferSingle" : "preferDouble",
|
|
54
|
+
useTabs: indent === "tab"
|
|
55
|
+
},
|
|
56
|
+
options.dprintOptions || {}
|
|
57
|
+
);
|
|
58
|
+
const pluginFormat = await interop(import("eslint-plugin-format"));
|
|
59
|
+
const configs = [
|
|
60
|
+
{
|
|
61
|
+
name: "luxass:formatters:setup",
|
|
62
|
+
plugins: {
|
|
63
|
+
format: pluginFormat
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
];
|
|
67
|
+
if (options.css) {
|
|
68
|
+
configs.push(
|
|
69
|
+
{
|
|
70
|
+
files: [GLOB_CSS, GLOB_POSTCSS],
|
|
71
|
+
languageOptions: {
|
|
72
|
+
parser: parserPlain
|
|
73
|
+
},
|
|
74
|
+
name: "luxass:formatter:css",
|
|
75
|
+
rules: {
|
|
76
|
+
"format/prettier": [
|
|
77
|
+
"error",
|
|
78
|
+
{
|
|
79
|
+
...prettierOptions,
|
|
80
|
+
parser: "css"
|
|
81
|
+
}
|
|
82
|
+
]
|
|
83
|
+
}
|
|
84
|
+
},
|
|
85
|
+
{
|
|
86
|
+
files: [GLOB_SCSS],
|
|
87
|
+
languageOptions: {
|
|
88
|
+
parser: parserPlain
|
|
89
|
+
},
|
|
90
|
+
name: "luxass:formatter:scss",
|
|
91
|
+
rules: {
|
|
92
|
+
"format/prettier": [
|
|
93
|
+
"error",
|
|
94
|
+
{
|
|
95
|
+
...prettierOptions,
|
|
96
|
+
parser: "scss"
|
|
97
|
+
}
|
|
98
|
+
]
|
|
99
|
+
}
|
|
100
|
+
},
|
|
101
|
+
{
|
|
102
|
+
files: [GLOB_LESS],
|
|
103
|
+
languageOptions: {
|
|
104
|
+
parser: parserPlain
|
|
105
|
+
},
|
|
106
|
+
name: "luxass:formatter:less",
|
|
107
|
+
rules: {
|
|
108
|
+
"format/prettier": [
|
|
109
|
+
"error",
|
|
110
|
+
{
|
|
111
|
+
...prettierOptions,
|
|
112
|
+
parser: "less"
|
|
113
|
+
}
|
|
114
|
+
]
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
);
|
|
118
|
+
}
|
|
119
|
+
if (options.html) {
|
|
120
|
+
configs.push({
|
|
121
|
+
files: ["**/*.html"],
|
|
122
|
+
languageOptions: {
|
|
123
|
+
parser: parserPlain
|
|
124
|
+
},
|
|
125
|
+
name: "luxass:formatter:html",
|
|
126
|
+
rules: {
|
|
127
|
+
"format/prettier": [
|
|
128
|
+
"error",
|
|
129
|
+
{
|
|
130
|
+
...prettierOptions,
|
|
131
|
+
parser: "html"
|
|
132
|
+
}
|
|
133
|
+
]
|
|
134
|
+
}
|
|
135
|
+
});
|
|
136
|
+
}
|
|
137
|
+
if (options.toml) {
|
|
138
|
+
configs.push({
|
|
139
|
+
files: ["**/*.toml"],
|
|
140
|
+
languageOptions: {
|
|
141
|
+
parser: parserPlain
|
|
142
|
+
},
|
|
143
|
+
name: "luxass:formatter:toml",
|
|
144
|
+
rules: {
|
|
145
|
+
"format/dprint": [
|
|
146
|
+
"error",
|
|
147
|
+
{
|
|
148
|
+
...dprintOptions,
|
|
149
|
+
language: "toml"
|
|
150
|
+
}
|
|
151
|
+
]
|
|
152
|
+
}
|
|
153
|
+
});
|
|
154
|
+
}
|
|
155
|
+
if (options.markdown) {
|
|
156
|
+
const formater = options.markdown === true ? "prettier" : options.markdown;
|
|
157
|
+
configs.push({
|
|
158
|
+
files: [GLOB_MARKDOWN],
|
|
159
|
+
languageOptions: {
|
|
160
|
+
parser: parserPlain
|
|
161
|
+
},
|
|
162
|
+
name: "antfu:formatter:markdown",
|
|
163
|
+
rules: {
|
|
164
|
+
[`format/${formater}`]: [
|
|
165
|
+
"error",
|
|
166
|
+
formater === "prettier" ? {
|
|
167
|
+
...prettierOptions,
|
|
168
|
+
embeddedLanguageFormatting: "off",
|
|
169
|
+
parser: "markdown"
|
|
170
|
+
} : {
|
|
171
|
+
...dprintOptions,
|
|
172
|
+
language: "markdown"
|
|
173
|
+
}
|
|
174
|
+
]
|
|
175
|
+
}
|
|
176
|
+
});
|
|
177
|
+
}
|
|
178
|
+
if (options.graphql) {
|
|
179
|
+
configs.push({
|
|
180
|
+
files: ["**/*.graphql"],
|
|
181
|
+
languageOptions: {
|
|
182
|
+
parser: parserPlain
|
|
183
|
+
},
|
|
184
|
+
name: "luxass:formatter:graphql",
|
|
185
|
+
rules: {
|
|
186
|
+
"format/prettier": [
|
|
187
|
+
"error",
|
|
188
|
+
{
|
|
189
|
+
...prettierOptions,
|
|
190
|
+
parser: "graphql"
|
|
191
|
+
}
|
|
192
|
+
]
|
|
193
|
+
}
|
|
194
|
+
});
|
|
195
|
+
}
|
|
196
|
+
return configs;
|
|
197
|
+
}
|
|
198
|
+
|
|
199
|
+
export {
|
|
200
|
+
formatters
|
|
201
|
+
};
|
|
@@ -1,10 +1,9 @@
|
|
|
1
1
|
import {
|
|
2
|
-
GLOB_ASTRO
|
|
3
|
-
} from "./chunk-R4NSLRAE.mjs";
|
|
4
|
-
import {
|
|
5
|
-
ensure,
|
|
6
2
|
interop
|
|
7
3
|
} from "./chunk-TQ476NL2.mjs";
|
|
4
|
+
import {
|
|
5
|
+
GLOB_ASTRO
|
|
6
|
+
} from "./chunk-DB44ZJL2.mjs";
|
|
8
7
|
|
|
9
8
|
// src/configs/astro.ts
|
|
10
9
|
async function astro(options) {
|
|
@@ -13,11 +12,6 @@ async function astro(options) {
|
|
|
13
12
|
overrides = {},
|
|
14
13
|
typescript = true
|
|
15
14
|
} = options;
|
|
16
|
-
await ensure([
|
|
17
|
-
"eslint-plugin-astro",
|
|
18
|
-
"astro-eslint-parser",
|
|
19
|
-
...a11y ? ["eslint-plugin-jsx-a11y"] : []
|
|
20
|
-
]);
|
|
21
15
|
const [
|
|
22
16
|
pluginAstro,
|
|
23
17
|
parserAstro,
|
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import {
|
|
2
|
-
GLOB_NEXTJS_OG,
|
|
3
|
-
GLOB_NEXTJS_ROUTES,
|
|
4
|
-
GLOB_SRC
|
|
5
|
-
} from "./chunk-R4NSLRAE.mjs";
|
|
6
1
|
import {
|
|
7
2
|
ensure,
|
|
8
3
|
interop
|
|
9
4
|
} from "./chunk-TQ476NL2.mjs";
|
|
5
|
+
import {
|
|
6
|
+
GLOB_NEXTJS_OG,
|
|
7
|
+
GLOB_NEXTJS_ROUTES,
|
|
8
|
+
GLOB_SRC
|
|
9
|
+
} from "./chunk-DB44ZJL2.mjs";
|
|
10
10
|
|
|
11
11
|
// src/configs/nextjs.ts
|
|
12
12
|
async function nextjs(options = {}) {
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
+
import {
|
|
2
|
+
interop
|
|
3
|
+
} from "./chunk-TQ476NL2.mjs";
|
|
1
4
|
import {
|
|
2
5
|
GLOB_JSON,
|
|
3
6
|
GLOB_JSON5,
|
|
4
7
|
GLOB_JSONC
|
|
5
|
-
} from "./chunk-
|
|
6
|
-
import {
|
|
7
|
-
interop
|
|
8
|
-
} from "./chunk-TQ476NL2.mjs";
|
|
8
|
+
} from "./chunk-DB44ZJL2.mjs";
|
|
9
9
|
|
|
10
10
|
// src/configs/jsonc.ts
|
|
11
11
|
async function jsonc(options = {}) {
|
|
@@ -7,12 +7,14 @@ var GLOB_JSX_EXT = "[jt]sx";
|
|
|
7
7
|
var GLOB_JSX = `**/*.${GLOB_JSX_EXT}`;
|
|
8
8
|
var GLOB_STYLE = "**/*.{c,le,sc}ss";
|
|
9
9
|
var GLOB_CSS = "**/*.css";
|
|
10
|
+
var GLOB_POSTCSS = "**/*.{p,post}css";
|
|
10
11
|
var GLOB_LESS = "**/*.less";
|
|
11
12
|
var GLOB_SCSS = "**/*.scss";
|
|
12
13
|
var GLOB_JSON = "**/*.json";
|
|
13
14
|
var GLOB_JSON5 = "**/*.json5";
|
|
14
15
|
var GLOB_JSONC = "**/*.jsonc";
|
|
15
16
|
var GLOB_MARKDOWN = "**/*.md";
|
|
17
|
+
var GLOB_MARKDOWN_IN_MARKDOWN = "**/*.md/*.md";
|
|
16
18
|
var GLOB_VUE = "**/*.vue";
|
|
17
19
|
var GLOB_YAML = "**/*.y?(a)ml";
|
|
18
20
|
var GLOB_HTML = "**/*.htm?(l)";
|
|
@@ -84,12 +86,14 @@ export {
|
|
|
84
86
|
GLOB_JSX,
|
|
85
87
|
GLOB_STYLE,
|
|
86
88
|
GLOB_CSS,
|
|
89
|
+
GLOB_POSTCSS,
|
|
87
90
|
GLOB_LESS,
|
|
88
91
|
GLOB_SCSS,
|
|
89
92
|
GLOB_JSON,
|
|
90
93
|
GLOB_JSON5,
|
|
91
94
|
GLOB_JSONC,
|
|
92
95
|
GLOB_MARKDOWN,
|
|
96
|
+
GLOB_MARKDOWN_IN_MARKDOWN,
|
|
93
97
|
GLOB_VUE,
|
|
94
98
|
GLOB_YAML,
|
|
95
99
|
GLOB_HTML,
|
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
import {
|
|
2
|
-
GLOB_SRC
|
|
3
|
-
} from "./chunk-R4NSLRAE.mjs";
|
|
4
|
-
import {
|
|
5
|
-
default as default2
|
|
6
|
-
} from "./chunk-C5VMTRKT.mjs";
|
|
7
1
|
import {
|
|
8
2
|
interop,
|
|
9
3
|
renameRules,
|
|
10
4
|
toArray
|
|
11
5
|
} from "./chunk-TQ476NL2.mjs";
|
|
6
|
+
import {
|
|
7
|
+
GLOB_SRC
|
|
8
|
+
} from "./chunk-DB44ZJL2.mjs";
|
|
9
|
+
import {
|
|
10
|
+
default as default2
|
|
11
|
+
} from "./chunk-C5VMTRKT.mjs";
|
|
12
12
|
|
|
13
13
|
// src/configs/typescript.ts
|
|
14
14
|
import process from "node:process";
|
|
@@ -82,9 +82,6 @@ async function typescript(options) {
|
|
|
82
82
|
"@typescript-eslint/",
|
|
83
83
|
"ts/"
|
|
84
84
|
),
|
|
85
|
-
"antfu/generic-spacing": "error",
|
|
86
|
-
"antfu/named-tuple-spacing": "error",
|
|
87
|
-
"antfu/no-cjs-exports": "error",
|
|
88
85
|
"no-dupe-class-members": "off",
|
|
89
86
|
"no-invalid-this": "off",
|
|
90
87
|
"no-loss-of-precision": "off",
|
|
@@ -1,23 +1,30 @@
|
|
|
1
|
-
import {
|
|
2
|
-
GLOB_VUE
|
|
3
|
-
} from "./chunk-R4NSLRAE.mjs";
|
|
4
1
|
import {
|
|
5
2
|
interop
|
|
6
3
|
} from "./chunk-TQ476NL2.mjs";
|
|
4
|
+
import {
|
|
5
|
+
GLOB_VUE
|
|
6
|
+
} from "./chunk-DB44ZJL2.mjs";
|
|
7
7
|
|
|
8
8
|
// src/configs/vue.ts
|
|
9
|
+
import { mergeProcessors } from "eslint-merge-processors";
|
|
9
10
|
async function vue(options = {}) {
|
|
10
|
-
const {
|
|
11
|
+
const {
|
|
12
|
+
overrides = {},
|
|
13
|
+
stylistic = true
|
|
14
|
+
} = options;
|
|
15
|
+
const sfcBlocks = options.sfcBlocks === true ? {} : options.sfcBlocks ?? {};
|
|
16
|
+
const {
|
|
17
|
+
indent = 2
|
|
18
|
+
} = typeof stylistic === "boolean" ? {} : stylistic;
|
|
11
19
|
const [
|
|
12
20
|
pluginVue,
|
|
13
|
-
parserVue
|
|
21
|
+
parserVue,
|
|
22
|
+
processorVueBlocks
|
|
14
23
|
] = await Promise.all([
|
|
15
24
|
interop(import("eslint-plugin-vue")),
|
|
16
|
-
interop(import("vue-eslint-parser"))
|
|
25
|
+
interop(import("vue-eslint-parser")),
|
|
26
|
+
interop(import("eslint-processor-vue-blocks"))
|
|
17
27
|
]);
|
|
18
|
-
const {
|
|
19
|
-
indent = 2
|
|
20
|
-
} = typeof stylistic === "boolean" ? {} : stylistic;
|
|
21
28
|
return [
|
|
22
29
|
{
|
|
23
30
|
name: "luxass:vue:setup",
|
|
@@ -39,7 +46,16 @@ async function vue(options = {}) {
|
|
|
39
46
|
}
|
|
40
47
|
},
|
|
41
48
|
name: "luxass:vue:rules",
|
|
42
|
-
processor: pluginVue.processors[".vue"]
|
|
49
|
+
processor: sfcBlocks === false ? pluginVue.processors[".vue"] : mergeProcessors([
|
|
50
|
+
pluginVue.processors[".vue"],
|
|
51
|
+
processorVueBlocks({
|
|
52
|
+
...sfcBlocks,
|
|
53
|
+
blocks: {
|
|
54
|
+
styles: true,
|
|
55
|
+
...sfcBlocks.blocks
|
|
56
|
+
}
|
|
57
|
+
})
|
|
58
|
+
]),
|
|
43
59
|
rules: {
|
|
44
60
|
...pluginVue.configs.base.rules,
|
|
45
61
|
...pluginVue.configs["vue3-essential"].rules,
|
|
@@ -1,13 +1,27 @@
|
|
|
1
|
-
import {
|
|
2
|
-
default as default2
|
|
3
|
-
} from "./chunk-C5VMTRKT.mjs";
|
|
4
1
|
import {
|
|
5
2
|
interop
|
|
6
3
|
} from "./chunk-TQ476NL2.mjs";
|
|
4
|
+
import {
|
|
5
|
+
default as default2
|
|
6
|
+
} from "./chunk-C5VMTRKT.mjs";
|
|
7
7
|
|
|
8
8
|
// src/configs/stylistic.ts
|
|
9
|
+
var StylisticConfigDefaults = {
|
|
10
|
+
indent: 2,
|
|
11
|
+
jsx: true,
|
|
12
|
+
quotes: "double",
|
|
13
|
+
semi: true
|
|
14
|
+
};
|
|
9
15
|
async function stylistic(options = {}) {
|
|
10
|
-
const {
|
|
16
|
+
const {
|
|
17
|
+
indent,
|
|
18
|
+
jsx,
|
|
19
|
+
quotes,
|
|
20
|
+
semi
|
|
21
|
+
} = {
|
|
22
|
+
...StylisticConfigDefaults,
|
|
23
|
+
...options
|
|
24
|
+
};
|
|
11
25
|
const pluginStylistic = await interop(import("@stylistic/eslint-plugin"));
|
|
12
26
|
const config = pluginStylistic.configs.customize({
|
|
13
27
|
flat: true,
|
|
@@ -28,7 +42,6 @@ async function stylistic(options = {}) {
|
|
|
28
42
|
...config.rules,
|
|
29
43
|
"antfu/consistent-list-newline": "error",
|
|
30
44
|
"antfu/if-newline": "off",
|
|
31
|
-
"antfu/indent-binary-ops": ["error", { indent }],
|
|
32
45
|
"antfu/top-level-function": "error",
|
|
33
46
|
"curly": ["error", "multi-line", "consistent"],
|
|
34
47
|
"style/arrow-parens": ["error", "always", { requireForBlockBody: true }],
|
|
@@ -39,5 +52,6 @@ async function stylistic(options = {}) {
|
|
|
39
52
|
}
|
|
40
53
|
|
|
41
54
|
export {
|
|
55
|
+
StylisticConfigDefaults,
|
|
42
56
|
stylistic
|
|
43
57
|
};
|