@luxass/eslint-config 3.3.2 → 4.0.0-beta.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +168 -5
- package/dist/chunk-2SW2E3TH.mjs +38 -0
- package/dist/chunk-3JCJ7J5K.mjs +64 -0
- package/dist/chunk-4HH6LYJ6.mjs +25 -0
- package/dist/chunk-4VUK6ART.mjs +29 -0
- package/dist/chunk-AQEIRSYN.mjs +463 -0
- package/dist/chunk-C5VMTRKT.mjs +18 -0
- package/dist/chunk-C6E356K2.mjs +92 -0
- package/dist/chunk-D22QGGAS.mjs +80 -0
- package/dist/chunk-DX7HDGX6.mjs +16 -0
- package/dist/chunk-EM2N3I25.mjs +89 -0
- package/dist/chunk-FOIFEV73.mjs +215 -0
- package/dist/chunk-GNERIPAH.mjs +156 -0
- package/dist/chunk-HE56XDG6.mjs +47 -0
- package/dist/chunk-KZ7VBBWT.mjs +158 -0
- package/dist/chunk-MAFD6GLW.mjs +44 -0
- package/dist/chunk-NAAUGWPQ.mjs +41 -0
- package/dist/chunk-NDNDG7BH.mjs +29 -0
- package/dist/chunk-P6SR2VCL.mjs +0 -0
- package/dist/chunk-QLZ7XDIR.mjs +51 -0
- package/dist/chunk-RFYK7NGH.mjs +268 -0
- package/dist/chunk-SLYFE6WI.mjs +23 -0
- package/dist/chunk-UGD2TRXO.mjs +28 -0
- package/dist/chunk-WGDT3TJP.mjs +86 -0
- package/dist/configs/comments.cjs +66 -0
- package/dist/configs/comments.d.cts +14 -0
- package/dist/configs/comments.d.ts +14 -0
- package/dist/configs/comments.mjs +7 -0
- package/dist/configs/ignores.cjs +81 -0
- package/dist/configs/ignores.d.cts +14 -0
- package/dist/configs/ignores.d.ts +14 -0
- package/dist/configs/ignores.mjs +7 -0
- package/dist/configs/imports.cjs +78 -0
- package/dist/configs/imports.d.cts +14 -0
- package/dist/configs/imports.d.ts +14 -0
- package/dist/configs/imports.mjs +7 -0
- package/dist/configs/index.cjs +1904 -0
- package/dist/configs/index.d.cts +29 -0
- package/dist/configs/index.d.ts +29 -0
- package/dist/configs/index.mjs +84 -0
- package/dist/configs/javascript.cjs +317 -0
- package/dist/configs/javascript.d.cts +14 -0
- package/dist/configs/javascript.d.ts +14 -0
- package/dist/configs/javascript.mjs +8 -0
- package/dist/configs/jsdoc.cjs +79 -0
- package/dist/configs/jsdoc.d.cts +14 -0
- package/dist/configs/jsdoc.d.ts +14 -0
- package/dist/configs/jsdoc.mjs +7 -0
- package/dist/configs/jsonc.cjs +138 -0
- package/dist/configs/jsonc.d.cts +14 -0
- package/dist/configs/jsonc.d.ts +14 -0
- package/dist/configs/jsonc.mjs +8 -0
- package/dist/configs/markdown.cjs +133 -0
- package/dist/configs/markdown.d.cts +14 -0
- package/dist/configs/markdown.d.ts +14 -0
- package/dist/configs/markdown.mjs +8 -0
- package/dist/configs/nextjs.cjs +128 -0
- package/dist/configs/nextjs.d.cts +14 -0
- package/dist/configs/nextjs.d.ts +14 -0
- package/dist/configs/nextjs.mjs +8 -0
- package/dist/configs/node.cjs +70 -0
- package/dist/configs/node.d.cts +14 -0
- package/dist/configs/node.d.ts +14 -0
- package/dist/configs/node.mjs +7 -0
- package/dist/configs/perfectionist.cjs +69 -0
- package/dist/configs/perfectionist.d.cts +19 -0
- package/dist/configs/perfectionist.d.ts +19 -0
- package/dist/configs/perfectionist.mjs +7 -0
- package/dist/configs/react.cjs +512 -0
- package/dist/configs/react.d.cts +14 -0
- package/dist/configs/react.d.ts +14 -0
- package/dist/configs/react.mjs +8 -0
- package/dist/configs/sort.cjs +240 -0
- package/dist/configs/sort.d.cts +25 -0
- package/dist/configs/sort.d.ts +25 -0
- package/dist/configs/sort.mjs +8 -0
- package/dist/configs/stylistic.cjs +88 -0
- package/dist/configs/stylistic.d.cts +14 -0
- package/dist/configs/stylistic.d.ts +14 -0
- package/dist/configs/stylistic.mjs +8 -0
- package/dist/configs/test.cjs +99 -0
- package/dist/configs/test.d.cts +14 -0
- package/dist/configs/test.d.ts +14 -0
- package/dist/configs/test.mjs +8 -0
- package/dist/configs/typescript.cjs +223 -0
- package/dist/configs/typescript.d.cts +14 -0
- package/dist/configs/typescript.d.ts +14 -0
- package/dist/configs/typescript.mjs +9 -0
- package/dist/configs/unicorn.cjs +88 -0
- package/dist/configs/unicorn.d.cts +14 -0
- package/dist/configs/unicorn.d.ts +14 -0
- package/dist/configs/unicorn.mjs +7 -0
- package/dist/configs/unocss.cjs +61 -0
- package/dist/configs/unocss.d.cts +14 -0
- package/dist/configs/unocss.d.ts +14 -0
- package/dist/configs/unocss.mjs +7 -0
- package/dist/configs/vue.cjs +205 -0
- package/dist/configs/vue.d.cts +14 -0
- package/dist/configs/vue.d.ts +14 -0
- package/dist/configs/vue.mjs +8 -0
- package/dist/configs/yaml.cjs +113 -0
- package/dist/configs/yaml.d.cts +14 -0
- package/dist/configs/yaml.d.ts +14 -0
- package/dist/configs/yaml.mjs +8 -0
- package/dist/index.cjs +2127 -0
- package/dist/index.d.cts +59 -0
- package/dist/index.d.ts +59 -0
- package/dist/index.mjs +287 -0
- package/dist/types-1OpPSxOO.d.ts +182 -0
- package/package.json +100 -12
- package/index.js +0 -5
package/README.md
CHANGED
|
@@ -1,16 +1,179 @@
|
|
|
1
1
|
# @luxass/eslint-config
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
> [!IMPORTANT]
|
|
4
|
+
> The configuration is not currently finished, and the old config should be used. You can find it [here](https://github.com/luxass/eslint-config-legacy)
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
## ✨ Features
|
|
8
|
+
|
|
9
|
+
- Designed to work with JavaScript, Typescript, React, Svelte, Astro, Vue out of the box.
|
|
10
|
+
- Support for JSON, YAML, Markdown
|
|
11
|
+
- Sorted imports for `package.json` and `tsconfig.json`
|
|
12
|
+
- [ESLint Flat config](https://eslint.org/docs/latest/use/configure/configuration-files-new), compose easily!
|
|
13
|
+
- Using [ESLint Stylistic](https://eslint.style/guide/why)
|
|
14
|
+
|
|
15
|
+
## 📦 Install
|
|
4
16
|
|
|
5
17
|
```bash
|
|
6
18
|
pnpm add -D eslint @luxass/eslint-config
|
|
7
19
|
```
|
|
8
20
|
|
|
9
|
-
## Usage
|
|
21
|
+
## 🚀 Usage
|
|
22
|
+
```js
|
|
23
|
+
// eslint.config.js
|
|
24
|
+
import { luxass } from "@luxass/eslint-config";
|
|
10
25
|
|
|
11
|
-
|
|
12
|
-
```
|
|
26
|
+
export default luxass();
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
## Setup for Visual Studio Code
|
|
30
|
+
|
|
31
|
+
Install [ESLint extension](https://marketplace.visualstudio.com/items?itemName=dbaeumer.vscode-eslint) and add the following to your `.vscode/settings.json`:
|
|
32
|
+
|
|
33
|
+
```jsonc
|
|
34
|
+
// .vscode/settings.json
|
|
13
35
|
{
|
|
14
|
-
|
|
36
|
+
// will ensure that eslint can use the experimental flat config
|
|
37
|
+
"eslint.experimental.useFlatConfig": true,
|
|
38
|
+
|
|
39
|
+
// disable the default formatter
|
|
40
|
+
"prettier.enable": false,
|
|
41
|
+
"editor.formatOnSave": false,
|
|
42
|
+
|
|
43
|
+
// auto fix on save
|
|
44
|
+
"editor.codeActionsOnSave": {
|
|
45
|
+
"source.fixAll": "explicit",
|
|
46
|
+
"source.organizeImports": "never"
|
|
47
|
+
},
|
|
48
|
+
|
|
49
|
+
// silent the stylistic rules in you IDE, but still auto fix them
|
|
50
|
+
"eslint.rules.customizations": [
|
|
51
|
+
{ "rule": "style/*", "severity": "off" },
|
|
52
|
+
{ "rule": "*-indent", "severity": "off" },
|
|
53
|
+
{ "rule": "*-spacing", "severity": "off" },
|
|
54
|
+
{ "rule": "*-spaces", "severity": "off" },
|
|
55
|
+
{ "rule": "*-order", "severity": "off" },
|
|
56
|
+
{ "rule": "*-dangle", "severity": "off" },
|
|
57
|
+
{ "rule": "*-newline", "severity": "off" },
|
|
58
|
+
{ "rule": "*quotes", "severity": "off" },
|
|
59
|
+
{ "rule": "*semi", "severity": "off" }
|
|
60
|
+
],
|
|
61
|
+
|
|
62
|
+
// The following is optional.
|
|
63
|
+
// It's better to put under project setting `.vscode/settings.json`
|
|
64
|
+
// to avoid conflicts with working with different eslint configs
|
|
65
|
+
// that does not support all formats.
|
|
66
|
+
"eslint.validate": [
|
|
67
|
+
"javascript",
|
|
68
|
+
"javascriptreact",
|
|
69
|
+
"typescript",
|
|
70
|
+
"typescriptreact",
|
|
71
|
+
"vue",
|
|
72
|
+
"html",
|
|
73
|
+
"markdown",
|
|
74
|
+
"json",
|
|
75
|
+
"jsonc",
|
|
76
|
+
"yaml"
|
|
77
|
+
]
|
|
15
78
|
}
|
|
16
79
|
```
|
|
80
|
+
|
|
81
|
+
## Customization
|
|
82
|
+
|
|
83
|
+
Normally you would only need to import the `luxass` preset:
|
|
84
|
+
|
|
85
|
+
```js
|
|
86
|
+
// eslint.config.js
|
|
87
|
+
import { luxass } from "@luxass/eslint-config";
|
|
88
|
+
|
|
89
|
+
export default luxass();
|
|
90
|
+
```
|
|
91
|
+
|
|
92
|
+
you can also configure each `config` individually:
|
|
93
|
+
|
|
94
|
+
```js
|
|
95
|
+
// eslint.config.js
|
|
96
|
+
import { luxass } from "@luxass/eslint-config";
|
|
97
|
+
|
|
98
|
+
export default luxass({
|
|
99
|
+
typescript: true,
|
|
100
|
+
vue: true,
|
|
101
|
+
react: false,
|
|
102
|
+
astro: true,
|
|
103
|
+
svelte: false,
|
|
104
|
+
unocss: true,
|
|
105
|
+
stylistic: true
|
|
106
|
+
});
|
|
107
|
+
```
|
|
108
|
+
|
|
109
|
+
The `luxass` function accepts an arbitrary number of `flat configs` overrides:
|
|
110
|
+
|
|
111
|
+
```js
|
|
112
|
+
// eslint.config.js
|
|
113
|
+
import { luxass } from "@luxass/eslint-config";
|
|
114
|
+
|
|
115
|
+
export default luxass({}, {
|
|
116
|
+
rules: {}
|
|
117
|
+
}, {
|
|
118
|
+
rules: {}
|
|
119
|
+
});
|
|
120
|
+
```
|
|
121
|
+
|
|
122
|
+
### Fine Grained Configurations
|
|
123
|
+
|
|
124
|
+
If you want it more advanced, you can also just import the `config` you need.
|
|
125
|
+
|
|
126
|
+
```js
|
|
127
|
+
// eslint.config.js
|
|
128
|
+
import {
|
|
129
|
+
astro,
|
|
130
|
+
comments,
|
|
131
|
+
ignores,
|
|
132
|
+
imports,
|
|
133
|
+
javascript,
|
|
134
|
+
javascriptStylistic,
|
|
135
|
+
jsdoc,
|
|
136
|
+
jsonc,
|
|
137
|
+
markdown,
|
|
138
|
+
node,
|
|
139
|
+
react,
|
|
140
|
+
sort,
|
|
141
|
+
svelte,
|
|
142
|
+
tailwindcss,
|
|
143
|
+
typescript,
|
|
144
|
+
typescriptStylistic,
|
|
145
|
+
unicorn,
|
|
146
|
+
unocss,
|
|
147
|
+
vue,
|
|
148
|
+
yml
|
|
149
|
+
} from "@luxass/eslint-config/configs";
|
|
150
|
+
|
|
151
|
+
export default [
|
|
152
|
+
...astro,
|
|
153
|
+
...comments,
|
|
154
|
+
...ignores,
|
|
155
|
+
...imports,
|
|
156
|
+
...javascript,
|
|
157
|
+
...javascriptStylistic,
|
|
158
|
+
...jsdoc,
|
|
159
|
+
...jsonc,
|
|
160
|
+
...markdown,
|
|
161
|
+
...node,
|
|
162
|
+
...react,
|
|
163
|
+
...sort,
|
|
164
|
+
...svelte,
|
|
165
|
+
...tailwindcss,
|
|
166
|
+
...typescript,
|
|
167
|
+
...typescriptStylistic,
|
|
168
|
+
...unicorn,
|
|
169
|
+
...unocss,
|
|
170
|
+
...vue,
|
|
171
|
+
...yml
|
|
172
|
+
];
|
|
173
|
+
```
|
|
174
|
+
|
|
175
|
+
> Thanks to [sxzz/eslint-config](https://github.com/sxzz/eslint-config) and [antfu/eslint-config](https://github.com/antfu/eslint-config) for the inspiration and references.
|
|
176
|
+
|
|
177
|
+
## 📄 License
|
|
178
|
+
|
|
179
|
+
Published under [MIT License](./LICENSE).
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import {
|
|
2
|
+
default as default2,
|
|
3
|
+
pluginImport
|
|
4
|
+
} from "./chunk-C5VMTRKT.mjs";
|
|
5
|
+
|
|
6
|
+
// src/configs/imports.ts
|
|
7
|
+
async function imports(options = {}) {
|
|
8
|
+
const {
|
|
9
|
+
stylistic = true
|
|
10
|
+
} = options;
|
|
11
|
+
return [
|
|
12
|
+
{
|
|
13
|
+
name: "luxass:imports",
|
|
14
|
+
plugins: {
|
|
15
|
+
antfu: default2,
|
|
16
|
+
import: pluginImport
|
|
17
|
+
},
|
|
18
|
+
rules: {
|
|
19
|
+
"antfu/import-dedupe": "error",
|
|
20
|
+
"antfu/no-import-node-modules-by-path": "error",
|
|
21
|
+
"import/first": "error",
|
|
22
|
+
"import/no-duplicates": "error",
|
|
23
|
+
"import/no-mutable-exports": "error",
|
|
24
|
+
"import/no-named-default": "error",
|
|
25
|
+
"import/no-self-import": "error",
|
|
26
|
+
"import/no-webpack-loader-syntax": "error",
|
|
27
|
+
"import/order": "error",
|
|
28
|
+
...stylistic ? {
|
|
29
|
+
"import/newline-after-import": ["error", { considerComments: true, count: 1 }]
|
|
30
|
+
} : {}
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
];
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
export {
|
|
37
|
+
imports
|
|
38
|
+
};
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
import {
|
|
2
|
+
GLOB_YAML
|
|
3
|
+
} from "./chunk-C6E356K2.mjs";
|
|
4
|
+
import {
|
|
5
|
+
interop
|
|
6
|
+
} from "./chunk-4VUK6ART.mjs";
|
|
7
|
+
|
|
8
|
+
// src/configs/yaml.ts
|
|
9
|
+
async function yaml(options = {}) {
|
|
10
|
+
const { overrides = {}, stylistic = true } = options;
|
|
11
|
+
const [
|
|
12
|
+
pluginYaml,
|
|
13
|
+
parserYaml
|
|
14
|
+
] = await Promise.all([
|
|
15
|
+
interop(import("eslint-plugin-yml")),
|
|
16
|
+
interop(import("yaml-eslint-parser"))
|
|
17
|
+
]);
|
|
18
|
+
return [
|
|
19
|
+
{
|
|
20
|
+
name: "luxass:yaml:setup",
|
|
21
|
+
plugins: {
|
|
22
|
+
yaml: pluginYaml
|
|
23
|
+
}
|
|
24
|
+
},
|
|
25
|
+
{
|
|
26
|
+
files: [GLOB_YAML],
|
|
27
|
+
languageOptions: {
|
|
28
|
+
parser: parserYaml
|
|
29
|
+
},
|
|
30
|
+
name: "luxass:yaml:rules",
|
|
31
|
+
rules: {
|
|
32
|
+
"style/spaced-comment": "off",
|
|
33
|
+
"yaml/block-mapping": "error",
|
|
34
|
+
"yaml/block-sequence": "error",
|
|
35
|
+
"yaml/no-empty-key": "error",
|
|
36
|
+
"yaml/no-empty-sequence-entry": "error",
|
|
37
|
+
"yaml/no-irregular-whitespace": "error",
|
|
38
|
+
"yaml/plain-scalar": "error",
|
|
39
|
+
"yaml/vue-custom-block/no-parsing-error": "error",
|
|
40
|
+
...stylistic ? {
|
|
41
|
+
"yaml/block-mapping-question-indicator-newline": "error",
|
|
42
|
+
"yaml/block-sequence-hyphen-indicator-newline": "error",
|
|
43
|
+
"yaml/flow-mapping-curly-newline": "error",
|
|
44
|
+
"yaml/flow-mapping-curly-spacing": "error",
|
|
45
|
+
"yaml/flow-sequence-bracket-newline": "error",
|
|
46
|
+
"yaml/flow-sequence-bracket-spacing": "error",
|
|
47
|
+
"yaml/indent": ["error", 2],
|
|
48
|
+
"yaml/key-spacing": "error",
|
|
49
|
+
"yaml/no-tab-indent": "error",
|
|
50
|
+
"yaml/quotes": [
|
|
51
|
+
"error",
|
|
52
|
+
{ avoidEscape: false, prefer: "double" }
|
|
53
|
+
],
|
|
54
|
+
"yaml/spaced-comment": "error"
|
|
55
|
+
} : {},
|
|
56
|
+
...overrides
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
];
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
export {
|
|
63
|
+
yaml
|
|
64
|
+
};
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import {
|
|
2
|
+
default2
|
|
3
|
+
} from "./chunk-C5VMTRKT.mjs";
|
|
4
|
+
|
|
5
|
+
// src/configs/comments.ts
|
|
6
|
+
async function comments() {
|
|
7
|
+
return [
|
|
8
|
+
{
|
|
9
|
+
name: "luxass:eslint-comments",
|
|
10
|
+
plugins: {
|
|
11
|
+
"eslint-comments": default2
|
|
12
|
+
},
|
|
13
|
+
rules: {
|
|
14
|
+
"eslint-comments/no-aggregating-enable": "error",
|
|
15
|
+
"eslint-comments/no-duplicate-disable": "error",
|
|
16
|
+
"eslint-comments/no-unlimited-disable": "error",
|
|
17
|
+
"eslint-comments/no-unused-enable": "error"
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
];
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
export {
|
|
24
|
+
comments
|
|
25
|
+
};
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
// src/utils.ts
|
|
2
|
+
async function combine(...configs) {
|
|
3
|
+
const resolved = await Promise.all(configs);
|
|
4
|
+
return resolved.flat();
|
|
5
|
+
}
|
|
6
|
+
function renameRules(rules, from, to) {
|
|
7
|
+
return Object.fromEntries(
|
|
8
|
+
Object.entries(rules).map(([key, value]) => {
|
|
9
|
+
if (key.startsWith(from)) {
|
|
10
|
+
return [to + key.slice(from.length), value];
|
|
11
|
+
}
|
|
12
|
+
return [key, value];
|
|
13
|
+
})
|
|
14
|
+
);
|
|
15
|
+
}
|
|
16
|
+
function toArray(value) {
|
|
17
|
+
return Array.isArray(value) ? value : [value];
|
|
18
|
+
}
|
|
19
|
+
async function interop(m) {
|
|
20
|
+
const resolved = await m;
|
|
21
|
+
return resolved.default || resolved;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
export {
|
|
25
|
+
combine,
|
|
26
|
+
renameRules,
|
|
27
|
+
toArray,
|
|
28
|
+
interop
|
|
29
|
+
};
|