Skip to content

Commit 76ff5bc

Browse files
committed
refactor!: update for integration with @rushstack/eslint-patch
1 parent 81390fc commit 76ff5bc

8 files changed

+699
-36
lines changed

Diff for: .gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
node_modules

Diff for: @typescript-eslint.js

-1
This file was deleted.

Diff for: README.md

+32-14
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,39 @@
1-
# Deprecated
2-
3-
Please [use `eslint-plugin-prettier` directly](https://github.com/prettier/eslint-plugin-prettier#recommended-configuration).
4-
5-
To migrate from `@vue/eslint-config-prettier`:
6-
1. `npm add -D eslint-config-prettier eslint-plugin-prettier`
7-
2. `npm remove @vue/eslint-config-prettier`
8-
3. Change `@vue/prettier` to `plugin:prettier/recommended` in your ESLint configuration
9-
4. If there's `@vue/prettier/@typescript-eslint` in the existing configuration, remove it.
10-
111
# @vue/eslint-config-prettier
122

13-
> eslint-config-prettier for Vue CLI
3+
> eslint-config-prettier for Vue
144
15-
This config is specifically designed to be used by Vue CLI setups
5+
This config is specifically designed to be used by `@vue/cli` & `create-vue` setups
166
and is not meant for outside use (it can be used but some adaptations
177
on the user side might be needed - for details see the config file).
188

199
A part of its design is that this config may implicitly depend on
20-
other parts of Vue CLI setups, such as `eslint-plugin-vue` being
21-
extended in the same resulting config.
10+
other parts of `@vue/cli`/`create-vue` setups.
11+
12+
## Installation
13+
14+
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+
16+
```sh
17+
npm add --dev @vue/eslint-config-prettier @rushstack/eslint-patch
18+
```
19+
20+
Please also make sure that you have `prettier` and `eslint` installed.
21+
22+
## Usage
23+
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.
25+
26+
```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+
}
35+
```
36+
37+
## Further Reading
38+
39+
The default config is based on the recommended configuration of [`eslint-plugin-prettier`](https://github.com/prettier/eslint-plugin-prettier/#recommended-configuration), which also depends on [`eslint-config-prettier`](https://github.com/prettier/eslint-config-prettier). Please refer to their corresponding documentations for more implementation details.

Diff for: index.js

+5-8
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,7 @@
11
module.exports = {
2-
plugins: ['prettier'],
3-
extends: [
4-
require.resolve('eslint-config-prettier'),
5-
require.resolve('eslint-config-prettier/vue')
6-
],
2+
plugins: ["prettier"],
3+
extends: ["plugin:prettier/recommended"],
74
rules: {
8-
'prettier/prettier': 'warn'
9-
}
10-
}
5+
"prettier/prettier": "warn",
6+
},
7+
};

Diff for: package.json

+19-6
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
11
{
22
"name": "@vue/eslint-config-prettier",
33
"version": "6.0.0",
4-
"description": "eslint-config-prettier for Vue CLI",
4+
"description": "eslint-config-prettier for Vue",
55
"main": "index.js",
6+
"files": ["index.js"],
67
"publishConfig": {
78
"access": "public"
89
},
@@ -12,7 +13,9 @@
1213
},
1314
"keywords": [
1415
"vue",
15-
"cli"
16+
"cli",
17+
"eslint",
18+
"prettier"
1619
],
1720
"author": "Evan You",
1821
"license": "MIT",
@@ -21,11 +24,21 @@
2124
},
2225
"homepage": "https://github.com/vuejs/eslint-config-prettier#readme",
2326
"dependencies": {
24-
"eslint-config-prettier": "^6.0.0"
27+
"eslint-config-prettier": "^8.3.0",
28+
"eslint-plugin-prettier": "^4.0.0"
29+
},
30+
"devDependencies": {
31+
"eslint": "^8.5.0",
32+
"prettier": "^2.5.1"
2533
},
2634
"peerDependencies": {
27-
"eslint": ">= 5.0.0",
28-
"eslint-plugin-prettier": "^3.1.0",
29-
"prettier": ">= 1.13.0"
35+
"eslint": ">= 7.28.0",
36+
"prettier": ">= 2.0.0"
37+
},
38+
"eslintConfig": {
39+
"extends": ["./index.js"]
40+
},
41+
"scripts": {
42+
"lint": "eslint index.js --fix"
3043
}
3144
}

0 commit comments

Comments
 (0)