Skip to content

Commit a105c34

Browse files
authored
feat!: add support for ESLint Flat Config; drop `.eslintrc* support (#22)
1 parent 04c4cc2 commit a105c34

7 files changed

+259
-627
lines changed

CHANGELOG.md

+20-25
Original file line numberDiff line numberDiff line change
@@ -1,75 +1,70 @@
11
<a name="8.0.0"></a>
2+
23
## [8.0.0](https://github.com/vuejs/eslint-config-prettier/compare/v7.1.0...v8.0.0) (2023-07-20)
34

45
### Breaking Changes
56

6-
* Upgraded to Prettier v3; please check out the [Prettier release blog](https://prettier.io/blog/2023/07/05/3.0.0.html) for more details
7-
* Requires Node.js >= v14
8-
* Requires ESLint >= v8
9-
7+
- Upgraded to Prettier v3; please check out the [Prettier release blog](https://prettier.io/blog/2023/07/05/3.0.0.html) for more details
8+
- Requires Node.js >= v14
9+
- Requires ESLint >= v8
1010

1111
<a name="7.1.0"></a>
12+
1213
## [7.1.0](https://github.com/vuejs/eslint-config-prettier/compare/v7.0.0...v7.1.0) (2023-02-21)
1314

1415
### New Features
1516

16-
* Added a `skip-formatting` ruleset [b5933a9](https://github.com/vuejs/eslint-config-prettier/commit/b5933a9)
17-
17+
- Added a `skip-formatting` ruleset [b5933a9](https://github.com/vuejs/eslint-config-prettier/commit/b5933a9)
1818

1919
<a name="7.0.0"></a>
20+
2021
## [7.0.0](https://github.com/vuejs/eslint-config-prettier/compare/v6.0.0...v7.0.0) (2021-12-23)
2122

2223
### Breaking Changes
2324

24-
* Updated the dependencies and simplified the usage
25-
* We now recommend using this package along with [`@rushstack/eslint-patch`](https://www.npmjs.com/package/@rushstack/eslint-patch)
26-
25+
- Updated the dependencies and simplified the usage
26+
- We now recommend using this package along with [`@rushstack/eslint-patch`](https://www.npmjs.com/package/@rushstack/eslint-patch)
2727

2828
<a name="6.0.0"></a>
29-
## [6.0.0](https://github.com/vuejs/eslint-config-prettier/compare/v5.1.0...v6.0.0) (2019-11-18)
3029

30+
## [6.0.0](https://github.com/vuejs/eslint-config-prettier/compare/v5.1.0...v6.0.0) (2019-11-18)
3131

3232
### Breaking Changes
3333

34-
* feat!: move `eslint:recommended` to a separate `recommended` config, fixes #3. ([de7a518](https://github.com/vuejs/eslint-config-prettier/commit/de7a518))
34+
- feat!: move `eslint:recommended` to a separate `recommended` config, fixes #3. ([de7a518](https://github.com/vuejs/eslint-config-prettier/commit/de7a518))
3535

3636
`eslint:recommended` is no longer included in the default configuration.
3737
Users of old versions need to update their `extends` to use `@vue/prettier/recommended`, or `['eslint:recommended', '@vue/prettier]`.
3838

39-
4039
<a name="5.1.0"></a>
41-
## [5.1.0](https://github.com/vuejs/eslint-config-prettier/compare/v5.0.0...v5.1.0) (2019-11-17)
4240

41+
## [5.1.0](https://github.com/vuejs/eslint-config-prettier/compare/v5.0.0...v5.1.0) (2019-11-17)
4342

4443
### New Features
4544

46-
* Re-exports `@typescript-eslint` and `standard` configs, so that this config can be used in combination with `@vue/typescript/recommended` or `@vue/standard` ([939f722](https://github.com/vuejs/eslint-config-prettier/commit/939f722))
47-
48-
45+
- Re-exports `@typescript-eslint` and `standard` configs, so that this config can be used in combination with `@vue/typescript/recommended` or `@vue/standard` ([939f722](https://github.com/vuejs/eslint-config-prettier/commit/939f722))
4946

5047
<a name="5.0.0"></a>
51-
## [5.0.0](https://github.com/vuejs/eslint-config-prettier/compare/4578703...v5.0.0) (2019-07-22)
5248

49+
## [5.0.0](https://github.com/vuejs/eslint-config-prettier/compare/4578703...v5.0.0) (2019-07-22)
5350

5451
### Breaking Changes
5552

56-
* Update eslint-config-prettier to v6.0.0 ([0e0712f](https://github.com/vuejs/eslint-config-prettier/commit/0e0712f))
57-
* `eslint`, `prettier` and `eslint-plugin-prettier` are now `peerDependencies`, to better conform to [the plugin loading mechanism of eslint](https://github.com/eslint/eslint/issues/3458) ([aec6c5c](https://github.com/vuejs/eslint-config-prettier/commit/aec6c5c))
58-
59-
53+
- Update eslint-config-prettier to v6.0.0 ([0e0712f](https://github.com/vuejs/eslint-config-prettier/commit/0e0712f))
54+
- `eslint`, `prettier` and `eslint-plugin-prettier` are now `peerDependencies`, to better conform to [the plugin loading mechanism of eslint](https://github.com/eslint/eslint/issues/3458) ([aec6c5c](https://github.com/vuejs/eslint-config-prettier/commit/aec6c5c))
6055

6156
<a name="4.0.1"></a>
57+
6258
## [4.0.1](https://github.com/vuejs/eslint-config-prettier/compare/3bc2a3d...4578703) (2018-11-12)
6359

6460
### Bug Fixes
6561

66-
* Also extend `eslint-config-prettier/vue`, disable `eslint-plugin-vue` rules that are not compatible with `prettier`
67-
62+
- Also extend `eslint-config-prettier/vue`, disable `eslint-plugin-vue` rules that are not compatible with `prettier`
6863

6964
<a name="4.0.0"></a>
70-
## [4.0.0](https://github.com/vuejs/eslint-config-prettier/compare/15cf6d7...3bc2a3d) (2018-10-31)
7165

66+
## [4.0.0](https://github.com/vuejs/eslint-config-prettier/compare/15cf6d7...3bc2a3d) (2018-10-31)
7267

7368
### Beaking Changes
7469

75-
* Update base configs and plugins, now requires ESLint v5 as a peer dependency
70+
- Update base configs and plugins, now requires ESLint v5 as a peer dependency

README.md

+16-22
Original file line numberDiff line numberDiff line change
@@ -2,38 +2,36 @@
22

33
> eslint-config-prettier for Vue
44
5-
This config is specifically designed to be used by `@vue/cli` & `create-vue` setups
5+
This config is specifically designed to be used by `create-vue` setups
66
and is not meant for outside use (it can be used but some adaptations
77
on the user side might be needed - for details see the config file).
88

99
A part of its design is that this config may implicitly depend on
10-
other parts of `@vue/cli`/`create-vue` setups.
10+
other parts of `create-vue` setups.
1111

1212
## Installation
1313

14-
Before [ESLint Flat Config](https://eslint.org/docs/latest/use/configure/configuration-files-new) becomes stable, in order to work around [a known limitation in ESLint](https://github.com/eslint/eslint/issues/3458), we recommend you to use this package alongside `@rushstack/eslint-patch`, so that you don't have to install too many dependencies:
15-
1614
```sh
17-
npm add --dev @vue/eslint-config-prettier @rushstack/eslint-patch
15+
npm add --dev @vue/eslint-config-prettier
1816
```
1917

2018
Please also make sure that you have `prettier` and `eslint` installed.
2119

2220
## Usage
2321

24-
Add `"@vue/eslint-config-prettier"` to the `"extends"` array in your `.eslintrc.cjs` file. Make sure to put it **last**, so it gets the chance to override other configs.
22+
> Note: the current version doesn't support the legacy `.eslintrc*` configuraion format. For that you need to use version 9 or earlier. See the [corresponding README](https://www.npmjs.com/package/@vue/eslint-config-prettier/v/legacy-eslintrc) for more usage instructions.
23+
24+
Import `@vue/eslint-config-prettier` in `eslint.config.js` (or `eslint.config.mjs`), and put it in the configuration array – &&**after** other configs that you want to override.
2525

2626
```js
27-
require("@rushstack/eslint-patch/modern-module-resolution")
28-
29-
module.exports = {
30-
extends: [
31-
// ... other configs
32-
"@vue/eslint-config-prettier"
33-
]
34-
}
27+
import someConfig from "some-other-config-you-use";
28+
import prettierConfig from "@vue/eslint-config-prettier";
29+
30+
export default [someConfig, prettierConfig];
3531
```
3632

33+
Make sure to put it **last**, so it gets the chance to override other configs.
34+
3735
This configuration is the most straightward way to use ESLint with Prettier.
3836

3937
It disables all rules that are unnecessary or might conflict with Prettier.
@@ -51,14 +49,10 @@ Running prettier inside the linter slows down the linting process, might clutter
5149
So we offered an additional ruleset to support this workflow:
5250

5351
```js
54-
require("@rushstack/eslint-patch/modern-module-resolution")
55-
56-
module.exports = {
57-
extends: [
58-
// ... other configs
59-
"@vue/eslint-config-prettier/skip-formatting"
60-
]
61-
}
52+
import someConfig from "some-other-config-you-use";
53+
import skipFormattingConfig from "@vue/eslint-config-prettier/skip-formatting";
54+
55+
export default [someConfig, skipFormattingConfig];
6256
```
6357

6458
Formatting issues won't be reported with this config.

eslint.config.mjs

+9
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
import skipFormattingConfig from "./skip-formatting.js";
2+
3+
export default [
4+
{
5+
name: "app/files-to-lint",
6+
files: ["*.js"],
7+
},
8+
skipFormattingConfig
9+
];

index.js

+5-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,10 @@
1+
const recommendedConfig = require("eslint-config-prettier/recommended");
2+
13
module.exports = {
2-
plugins: ["prettier"],
3-
extends: ["plugin:prettier/recommended"],
4+
...recommendedConfig,
45
rules: {
6+
...recommendedConfig.rules,
7+
// should warn instead of error because formatting is not a critical issue
58
"prettier/prettier": "warn",
69
},
710
};

package.json

+11-13
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
{
22
"name": "@vue/eslint-config-prettier",
33
"version": "9.0.0",
4-
"description": "eslint-config-prettier for Vue",
4+
"description": "eslint-config-prettier for create-vue",
5+
"type": "commonjs",
56
"main": "index.js",
67
"files": [
78
"index.js",
@@ -16,7 +17,8 @@
1617
},
1718
"keywords": [
1819
"vue",
19-
"cli",
20+
"create-vue",
21+
"create-eslint-config",
2022
"eslint",
2123
"prettier"
2224
],
@@ -27,23 +29,19 @@
2729
},
2830
"homepage": "https://github.com/vuejs/eslint-config-prettier#readme",
2931
"dependencies": {
30-
"eslint-config-prettier": "^9.0.0",
31-
"eslint-plugin-prettier": "^5.0.0"
32+
"eslint-config-prettier": "^9.1.0",
33+
"eslint-plugin-prettier": "^5.2.1"
3234
},
3335
"devDependencies": {
34-
"eslint": "^8.45.0",
35-
"prettier": "^3.0.0"
36+
"eslint": "^9.11.0",
37+
"prettier": "^3.3.3"
3638
},
3739
"peerDependencies": {
38-
"eslint": ">= 8.0.0",
40+
"eslint": ">= 8.21.0",
3941
"prettier": ">= 3.0.0"
4042
},
41-
"eslintConfig": {
42-
"extends": [
43-
"./index.js"
44-
]
45-
},
4643
"scripts": {
47-
"lint": "eslint *.js --fix"
44+
"lint": "eslint . --fix",
45+
"format": "prettier *.{js,md} --write"
4846
}
4947
}

0 commit comments

Comments
 (0)