@coderwyd/eslint-config 2.4.2 → 2.5.0-beta.2
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 +47 -24
- package/dist/cli.cjs +19 -3
- package/dist/cli.js +19 -3
- package/dist/index.cjs +159 -109
- package/dist/index.d.cts +6412 -3327
- package/dist/index.d.ts +6412 -3327
- package/dist/index.js +159 -108
- package/package.json +7 -6
package/README.md
CHANGED
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
- ✨ Support Vue, React, Svelte.
|
|
11
11
|
- 🎯 Designed to work with TypeScript, Vue out-of-box
|
|
12
12
|
- 🏆 Reasonable defaults, best practices, only one-line of config
|
|
13
|
-
- 🎨 Use ESlint
|
|
13
|
+
- 🎨 Use ESlint to format HTML, CSS, LESS, SCSS, YAML, TOML, Markdown, JSON, JSONC.
|
|
14
14
|
|
|
15
15
|
## Usage
|
|
16
16
|
|
|
@@ -72,6 +72,20 @@ Add the following settings to your `.vscode/settings.json`:
|
|
|
72
72
|
"source.organizeImports": "never"
|
|
73
73
|
},
|
|
74
74
|
|
|
75
|
+
// Silent the stylistic rules in you IDE, but still auto fix them
|
|
76
|
+
"eslint.rules.customizations": [
|
|
77
|
+
{ "rule": "style/*", "severity": "off" },
|
|
78
|
+
{ "rule": "format/*", "severity": "off" },
|
|
79
|
+
{ "rule": "*-indent", "severity": "off" },
|
|
80
|
+
{ "rule": "*-spacing", "severity": "off" },
|
|
81
|
+
{ "rule": "*-spaces", "severity": "off" },
|
|
82
|
+
{ "rule": "*-order", "severity": "off" },
|
|
83
|
+
{ "rule": "*-dangle", "severity": "off" },
|
|
84
|
+
{ "rule": "*-newline", "severity": "off" },
|
|
85
|
+
{ "rule": "*quotes", "severity": "off" },
|
|
86
|
+
{ "rule": "*semi", "severity": "off" }
|
|
87
|
+
],
|
|
88
|
+
|
|
75
89
|
// Enable eslint for all supported languages
|
|
76
90
|
"eslint.validate": [
|
|
77
91
|
"html",
|
|
@@ -113,8 +127,8 @@ npm i -D lint-staged simple-git-hooks
|
|
|
113
127
|
|
|
114
128
|
### interface Options
|
|
115
129
|
|
|
116
|
-
|
|
117
|
-
interface OptionsConfig {
|
|
130
|
+
```ts
|
|
131
|
+
interface OptionsConfig extends OptionsComponentExts {
|
|
118
132
|
/**
|
|
119
133
|
* The current working directory
|
|
120
134
|
*
|
|
@@ -146,6 +160,15 @@ interface OptionsConfig {
|
|
|
146
160
|
*/
|
|
147
161
|
typescript?: boolean | OptionsTypescript
|
|
148
162
|
|
|
163
|
+
/**
|
|
164
|
+
* Enable JSX related rules.
|
|
165
|
+
*
|
|
166
|
+
* Currently only stylistic rules are included.
|
|
167
|
+
*
|
|
168
|
+
* @default true
|
|
169
|
+
*/
|
|
170
|
+
jsx?: boolean
|
|
171
|
+
|
|
149
172
|
/**
|
|
150
173
|
* Enable test support.
|
|
151
174
|
*
|
|
@@ -171,7 +194,7 @@ interface OptionsConfig {
|
|
|
171
194
|
* Enable react rules.
|
|
172
195
|
*
|
|
173
196
|
* Requires installing:
|
|
174
|
-
* -
|
|
197
|
+
* - `@eslint-react/eslint-plugin`
|
|
175
198
|
* - `eslint-plugin-react-hooks`
|
|
176
199
|
* - `eslint-plugin-react-refresh`
|
|
177
200
|
*
|
|
@@ -207,13 +230,20 @@ interface OptionsConfig {
|
|
|
207
230
|
unocss?: boolean | OptionsUnoCSS
|
|
208
231
|
|
|
209
232
|
/**
|
|
210
|
-
*
|
|
233
|
+
* Enable stylistic rules.
|
|
211
234
|
*
|
|
212
|
-
*
|
|
235
|
+
* @see https://eslint.style/
|
|
236
|
+
* @default true
|
|
237
|
+
*/
|
|
238
|
+
stylistic?: boolean | (StylisticConfig & OptionsOverrides)
|
|
239
|
+
|
|
240
|
+
/**
|
|
241
|
+
* Enable regexp rules.
|
|
213
242
|
*
|
|
243
|
+
* @see https://ota-meshi.github.io/eslint-plugin-regexp/
|
|
214
244
|
* @default true
|
|
215
245
|
*/
|
|
216
|
-
|
|
246
|
+
regexp?: boolean | (OptionsRegExp & OptionsOverrides)
|
|
217
247
|
|
|
218
248
|
/**
|
|
219
249
|
* Use external formatters to format files.
|
|
@@ -227,32 +257,25 @@ interface OptionsConfig {
|
|
|
227
257
|
* "yaml": false
|
|
228
258
|
* "toml": false
|
|
229
259
|
* }
|
|
230
|
-
*/
|
|
231
|
-
formatter?: OptionsFormatters
|
|
232
|
-
|
|
233
|
-
/**
|
|
234
|
-
* Default prettier rules
|
|
235
260
|
*
|
|
236
|
-
*
|
|
237
|
-
* ```json
|
|
238
|
-
* {
|
|
239
|
-
* "arrowParens": "avoid",
|
|
240
|
-
* "htmlWhitespaceSensitivity": "ignore"
|
|
241
|
-
* "printWidth": 80,
|
|
242
|
-
* "semi": false,
|
|
243
|
-
* "singleQuote": true,
|
|
244
|
-
* }
|
|
245
|
-
* ```
|
|
261
|
+
* When set to `true`, it will enable all formatters.
|
|
246
262
|
*/
|
|
247
|
-
|
|
263
|
+
formatter?: boolean | OptionsFormatters
|
|
248
264
|
|
|
249
265
|
/**
|
|
250
266
|
* Control to disable some rules in editors.
|
|
251
267
|
* @default auto-detect based on the process.env
|
|
252
268
|
*/
|
|
253
269
|
isInEditor?: boolean
|
|
270
|
+
|
|
271
|
+
/**
|
|
272
|
+
* Automatically rename plugins in the config.
|
|
273
|
+
*
|
|
274
|
+
* @default true
|
|
275
|
+
*/
|
|
276
|
+
autoRenamePlugins?: boolean
|
|
254
277
|
}
|
|
255
|
-
|
|
278
|
+
```
|
|
256
279
|
|
|
257
280
|
## Thanks
|
|
258
281
|
|
package/dist/cli.cjs
CHANGED
|
@@ -46,11 +46,12 @@ var import_parse_gitignore = __toESM(require("parse-gitignore"), 1);
|
|
|
46
46
|
var import_picocolors = __toESM(require("picocolors"), 1);
|
|
47
47
|
|
|
48
48
|
// package.json
|
|
49
|
-
var version = "2.
|
|
49
|
+
var version = "2.5.0-beta.2";
|
|
50
50
|
var devDependencies = {
|
|
51
51
|
"@antfu/ni": "^0.21.12",
|
|
52
52
|
"@eslint-react/eslint-plugin": "^1.5.12",
|
|
53
53
|
"@eslint/config-inspector": "^0.4.8",
|
|
54
|
+
"@stylistic/eslint-plugin-migrate": "^2.1.0",
|
|
54
55
|
"@types/eslint": "^8.56.10",
|
|
55
56
|
"@types/fs-extra": "^11.0.4",
|
|
56
57
|
"@types/node": "^20.12.12",
|
|
@@ -96,6 +97,20 @@ var vscodeSettingsString = `
|
|
|
96
97
|
"source.organizeImports": "never"
|
|
97
98
|
},
|
|
98
99
|
|
|
100
|
+
// Silent the stylistic rules in you IDE, but still auto fix them
|
|
101
|
+
"eslint.rules.customizations": [
|
|
102
|
+
{ "rule": "style/*", "severity": "off" },
|
|
103
|
+
{ "rule": "format/*", "severity": "off" },
|
|
104
|
+
{ "rule": "*-indent", "severity": "off" },
|
|
105
|
+
{ "rule": "*-spacing", "severity": "off" },
|
|
106
|
+
{ "rule": "*-spaces", "severity": "off" },
|
|
107
|
+
{ "rule": "*-order", "severity": "off" },
|
|
108
|
+
{ "rule": "*-dangle", "severity": "off" },
|
|
109
|
+
{ "rule": "*-newline", "severity": "off" },
|
|
110
|
+
{ "rule": "*quotes", "severity": "off" },
|
|
111
|
+
{ "rule": "*semi", "severity": "off" }
|
|
112
|
+
],
|
|
113
|
+
|
|
99
114
|
// Enable eslint for all supported languages
|
|
100
115
|
"eslint.validate": [
|
|
101
116
|
"svelte",
|
|
@@ -167,12 +182,13 @@ async function run(options = {}) {
|
|
|
167
182
|
const parsed = (0, import_parse_gitignore.default)(content);
|
|
168
183
|
const globs = parsed.globs();
|
|
169
184
|
for (const glob of globs) {
|
|
170
|
-
if (glob.type === "ignore")
|
|
185
|
+
if (glob.type === "ignore") {
|
|
171
186
|
eslintIgnores.push(...glob.patterns);
|
|
172
|
-
else if (glob.type === "unignore")
|
|
187
|
+
} else if (glob.type === "unignore") {
|
|
173
188
|
eslintIgnores.push(
|
|
174
189
|
...glob.patterns.map((pattern) => `!${pattern}`)
|
|
175
190
|
);
|
|
191
|
+
}
|
|
176
192
|
}
|
|
177
193
|
}
|
|
178
194
|
let eslintConfigContent = "";
|
package/dist/cli.js
CHANGED
|
@@ -17,11 +17,12 @@ import parse from "parse-gitignore";
|
|
|
17
17
|
import c from "picocolors";
|
|
18
18
|
|
|
19
19
|
// package.json
|
|
20
|
-
var version = "2.
|
|
20
|
+
var version = "2.5.0-beta.2";
|
|
21
21
|
var devDependencies = {
|
|
22
22
|
"@antfu/ni": "^0.21.12",
|
|
23
23
|
"@eslint-react/eslint-plugin": "^1.5.12",
|
|
24
24
|
"@eslint/config-inspector": "^0.4.8",
|
|
25
|
+
"@stylistic/eslint-plugin-migrate": "^2.1.0",
|
|
25
26
|
"@types/eslint": "^8.56.10",
|
|
26
27
|
"@types/fs-extra": "^11.0.4",
|
|
27
28
|
"@types/node": "^20.12.12",
|
|
@@ -67,6 +68,20 @@ var vscodeSettingsString = `
|
|
|
67
68
|
"source.organizeImports": "never"
|
|
68
69
|
},
|
|
69
70
|
|
|
71
|
+
// Silent the stylistic rules in you IDE, but still auto fix them
|
|
72
|
+
"eslint.rules.customizations": [
|
|
73
|
+
{ "rule": "style/*", "severity": "off" },
|
|
74
|
+
{ "rule": "format/*", "severity": "off" },
|
|
75
|
+
{ "rule": "*-indent", "severity": "off" },
|
|
76
|
+
{ "rule": "*-spacing", "severity": "off" },
|
|
77
|
+
{ "rule": "*-spaces", "severity": "off" },
|
|
78
|
+
{ "rule": "*-order", "severity": "off" },
|
|
79
|
+
{ "rule": "*-dangle", "severity": "off" },
|
|
80
|
+
{ "rule": "*-newline", "severity": "off" },
|
|
81
|
+
{ "rule": "*quotes", "severity": "off" },
|
|
82
|
+
{ "rule": "*semi", "severity": "off" }
|
|
83
|
+
],
|
|
84
|
+
|
|
70
85
|
// Enable eslint for all supported languages
|
|
71
86
|
"eslint.validate": [
|
|
72
87
|
"svelte",
|
|
@@ -138,12 +153,13 @@ async function run(options = {}) {
|
|
|
138
153
|
const parsed = parse(content);
|
|
139
154
|
const globs = parsed.globs();
|
|
140
155
|
for (const glob of globs) {
|
|
141
|
-
if (glob.type === "ignore")
|
|
156
|
+
if (glob.type === "ignore") {
|
|
142
157
|
eslintIgnores.push(...glob.patterns);
|
|
143
|
-
else if (glob.type === "unignore")
|
|
158
|
+
} else if (glob.type === "unignore") {
|
|
144
159
|
eslintIgnores.push(
|
|
145
160
|
...glob.patterns.map((pattern) => `!${pattern}`)
|
|
146
161
|
);
|
|
162
|
+
}
|
|
147
163
|
}
|
|
148
164
|
}
|
|
149
165
|
let eslintConfigContent = "";
|