Skip to content

Commit c54b13a

Browse files
authored
Add FAQ about conflicts with Prettier. (#1135)
1 parent 47be926 commit c54b13a

File tree

1 file changed

+46
-0
lines changed

1 file changed

+46
-0
lines changed

docs/user-guide/README.md

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -218,3 +218,49 @@ See also: "[How to use a custom parser?](#how-to-use-a-custom-parser)" section.
218218
2. Make sure your tool is set to lint `.vue` files.
219219
- CLI targets only `.js` files by default. You have to specify additional extensions with the `--ext` option or glob patterns. E.g. `eslint "src/**/*.{js,vue}"` or `eslint src --ext .vue`. If you use `@vue/cli-plugin-eslint` and the `vue-cli-service lint` command - you don't have to worry about it.
220220
- If you are having issues with configuring editor, please read [editor integrations](#editor-integrations)
221+
222+
### Conflict with [Prettier].
223+
224+
If the [Prettier] conflicts with the shareable config provided by this plugin, use [eslint-config-prettier] to resolve it.
225+
226+
Example **.eslintrc.js**:
227+
228+
```js
229+
module.exports = {
230+
// ...
231+
extends: [
232+
// ...
233+
// 'eslint:recommended',
234+
// ...
235+
'plugin:vue/vue3-recommended',
236+
// ...
237+
"prettier",
238+
"prettier/vue",
239+
// "prettier/@typescript-eslint", // required if you are using @typescript-eslint.
240+
// Other settings may be required depending on the plugin you are using. See the eslint-config-prettier documentation for more details.
241+
],
242+
// ...
243+
}
244+
```
245+
246+
If the [Prettier] conflicts with the rule you have set, turn off that rule.
247+
248+
Example **.eslintrc.js**:
249+
250+
When the `vue/html-indent` rule conflict with [Prettier].
251+
252+
```diff
253+
module.exports = {
254+
// ...
255+
rules: {
256+
// ...
257+
- "vue/html-indent": "error",
258+
+ "vue/html-indent": "off",
259+
// ...
260+
},
261+
// ...
262+
}
263+
```
264+
265+
[prettier]: https://prettier.io/
266+
[eslint-config-prettier]: https://github.com/prettier/eslint-config-prettier

0 commit comments

Comments
 (0)