@antfu/eslint-config 2.2.0 → 2.2.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 +2 -28
- package/dist/cli.cjs +2 -1
- package/dist/cli.js +2 -1
- package/dist/index.cjs +1 -0
- package/dist/index.d.cts +3 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.js +1 -0
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -120,6 +120,7 @@ Add the following settings to your `.vscode/settings.json`:
|
|
|
120
120
|
// Silent the stylistic rules in you IDE, but still auto fix them
|
|
121
121
|
"eslint.rules.customizations": [
|
|
122
122
|
{ "rule": "style/*", "severity": "off" },
|
|
123
|
+
{ "rule": "prettier/*", "severity": "off" },
|
|
123
124
|
{ "rule": "*-indent", "severity": "off" },
|
|
124
125
|
{ "rule": "*-spacing", "severity": "off" },
|
|
125
126
|
{ "rule": "*-spaces", "severity": "off" },
|
|
@@ -313,7 +314,7 @@ export default antfu(
|
|
|
313
314
|
)
|
|
314
315
|
```
|
|
315
316
|
|
|
316
|
-
We also provided
|
|
317
|
+
We also provided an `overrides` options to make it easier:
|
|
317
318
|
|
|
318
319
|
```js
|
|
319
320
|
// eslint.config.js
|
|
@@ -337,33 +338,6 @@ export default antfu({
|
|
|
337
338
|
|
|
338
339
|
We provide some optional configs for specific use cases, that we don't include their dependencies by default.
|
|
339
340
|
|
|
340
|
-
#### Prettier
|
|
341
|
-
|
|
342
|
-
ESLint is mainly forced on JavaScript. It can support other languages with custom parsers, but that requires a lot of effort to rule parsers and rules to build ecosystems around them. For example, ESLint does not handle CSS and HTML at this moment. It has been a shame for a long time. But since Prettier supports wider range of languages, why don't we use Prettier for them?
|
|
343
|
-
|
|
344
|
-
> [!WARNING]
|
|
345
|
-
> This is experiemental :)
|
|
346
|
-
|
|
347
|
-
To enable Prettier support, you need to explicitly turn it on and specify the languages you want to handle:
|
|
348
|
-
|
|
349
|
-
```js
|
|
350
|
-
// eslint.config.js
|
|
351
|
-
import antfu from '@antfu/eslint-config'
|
|
352
|
-
|
|
353
|
-
export default antfu({
|
|
354
|
-
prettier: {
|
|
355
|
-
css: true, // Let Prettier handles CSS, LESS, SCSS, etc
|
|
356
|
-
html: true, // Let Prettier handles HTML
|
|
357
|
-
}
|
|
358
|
-
})
|
|
359
|
-
```
|
|
360
|
-
|
|
361
|
-
Running `npx eslint` should prompt you to install the required dependencies, otherwise, you can install them manually:
|
|
362
|
-
|
|
363
|
-
```bash
|
|
364
|
-
npm i -D eslint-plugin-prettier prettier
|
|
365
|
-
```
|
|
366
|
-
|
|
367
341
|
#### React
|
|
368
342
|
|
|
369
343
|
To enable React support you need to explicitly turn it on:
|
package/dist/cli.cjs
CHANGED
|
@@ -46,7 +46,7 @@ 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.2.
|
|
49
|
+
var version = "2.2.1";
|
|
50
50
|
var devDependencies = {
|
|
51
51
|
"@antfu/eslint-config": "workspace:*",
|
|
52
52
|
"@antfu/eslint-plugin-prettier": "^5.0.1-1",
|
|
@@ -99,6 +99,7 @@ var vscodeSettingsString = `
|
|
|
99
99
|
// Silent the stylistic rules in you IDE, but still auto fix them
|
|
100
100
|
"eslint.rules.customizations": [
|
|
101
101
|
{ "rule": "style/*", "severity": "off" },
|
|
102
|
+
{ "rule": "prettier/*", "severity": "off" },
|
|
102
103
|
{ "rule": "*-indent", "severity": "off" },
|
|
103
104
|
{ "rule": "*-spacing", "severity": "off" },
|
|
104
105
|
{ "rule": "*-spaces", "severity": "off" },
|
package/dist/cli.js
CHANGED
|
@@ -17,7 +17,7 @@ import parse from "parse-gitignore";
|
|
|
17
17
|
import c from "picocolors";
|
|
18
18
|
|
|
19
19
|
// package.json
|
|
20
|
-
var version = "2.2.
|
|
20
|
+
var version = "2.2.1";
|
|
21
21
|
var devDependencies = {
|
|
22
22
|
"@antfu/eslint-config": "workspace:*",
|
|
23
23
|
"@antfu/eslint-plugin-prettier": "^5.0.1-1",
|
|
@@ -70,6 +70,7 @@ var vscodeSettingsString = `
|
|
|
70
70
|
// Silent the stylistic rules in you IDE, but still auto fix them
|
|
71
71
|
"eslint.rules.customizations": [
|
|
72
72
|
{ "rule": "style/*", "severity": "off" },
|
|
73
|
+
{ "rule": "prettier/*", "severity": "off" },
|
|
73
74
|
{ "rule": "*-indent", "severity": "off" },
|
|
74
75
|
{ "rule": "*-spacing", "severity": "off" },
|
|
75
76
|
{ "rule": "*-spaces", "severity": "off" },
|
package/dist/index.cjs
CHANGED
|
@@ -759,6 +759,7 @@ async function stylistic(options = {}) {
|
|
|
759
759
|
|
|
760
760
|
// src/configs/prettier.ts
|
|
761
761
|
async function prettier(options = {}, stylistic2 = {}) {
|
|
762
|
+
console.warn("@antfu/eslint-config: `prettier` option is deprecated, please do not use it anymore. We will find better formatters to support that in the future.");
|
|
762
763
|
await ensurePackages([
|
|
763
764
|
"@antfu/eslint-plugin-prettier"
|
|
764
765
|
]);
|
package/dist/index.d.cts
CHANGED
|
@@ -349,6 +349,9 @@ declare function node(): Promise<FlatConfigItem[]>;
|
|
|
349
349
|
*/
|
|
350
350
|
declare function perfectionist(): Promise<FlatConfigItem[]>;
|
|
351
351
|
|
|
352
|
+
/**
|
|
353
|
+
* @deprecated
|
|
354
|
+
*/
|
|
352
355
|
declare function prettier(options?: OptionsPrettier, stylistic?: StylisticConfig): Promise<FlatConfigItem[]>;
|
|
353
356
|
|
|
354
357
|
declare function react(options?: OptionsHasTypeScript & OptionsOverrides & OptionsFiles): Promise<FlatConfigItem[]>;
|
package/dist/index.d.ts
CHANGED
|
@@ -349,6 +349,9 @@ declare function node(): Promise<FlatConfigItem[]>;
|
|
|
349
349
|
*/
|
|
350
350
|
declare function perfectionist(): Promise<FlatConfigItem[]>;
|
|
351
351
|
|
|
352
|
+
/**
|
|
353
|
+
* @deprecated
|
|
354
|
+
*/
|
|
352
355
|
declare function prettier(options?: OptionsPrettier, stylistic?: StylisticConfig): Promise<FlatConfigItem[]>;
|
|
353
356
|
|
|
354
357
|
declare function react(options?: OptionsHasTypeScript & OptionsOverrides & OptionsFiles): Promise<FlatConfigItem[]>;
|
package/dist/index.js
CHANGED
|
@@ -673,6 +673,7 @@ async function stylistic(options = {}) {
|
|
|
673
673
|
|
|
674
674
|
// src/configs/prettier.ts
|
|
675
675
|
async function prettier(options = {}, stylistic2 = {}) {
|
|
676
|
+
console.warn("@antfu/eslint-config: `prettier` option is deprecated, please do not use it anymore. We will find better formatters to support that in the future.");
|
|
676
677
|
await ensurePackages([
|
|
677
678
|
"@antfu/eslint-plugin-prettier"
|
|
678
679
|
]);
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@antfu/eslint-config",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "2.2.
|
|
4
|
+
"version": "2.2.1",
|
|
5
5
|
"packageManager": "pnpm@8.11.0",
|
|
6
6
|
"description": "Anthony's ESLint config",
|
|
7
7
|
"author": "Anthony Fu <anthonyfu117@hotmail.com> (https://github.com/antfu/)",
|
|
@@ -110,7 +110,7 @@
|
|
|
110
110
|
"tsup": "^8.0.1",
|
|
111
111
|
"typescript": "^5.3.2",
|
|
112
112
|
"vitest": "^0.34.6",
|
|
113
|
-
"@antfu/eslint-config": "2.2.
|
|
113
|
+
"@antfu/eslint-config": "2.2.1"
|
|
114
114
|
},
|
|
115
115
|
"simple-git-hooks": {
|
|
116
116
|
"pre-commit": "pnpm lint-staged"
|