* chore(deps): upgrade prettier to v1.8.2 * chore: setup lint-docs script * docs: add `<!-- prettier-ignore -->`s * docs: format docs * Revert "docs: format docs" This reverts commit 6dba903987dddc498cb589ca311905f25b6aee53. * chore(prettierrc): set `--no-prose-wrap` * docs: format docs * Revert "docs: format docs" This reverts commit 139bd744b6921916be8fac4fa3bab83bae5d12df. * docs: tweak * docs: format docs * chore: rename .prettierrc * chore: rename back to .prettierrc * chore: split out third-party * refactor: fix linting * chore: do not split out third-party on website
1.7 KiB
id, title
| id | title |
|---|---|
| eslint | Integrating with ESLint |
If you are using ESLint, integrating Prettier to your workflow is straightforward.
There are two different ways you might want to integrate Prettier into ESLint. You may enable either one separately, or both.
Use ESLint to run Prettier
If you're already running ESLint in your project and would like to do all of your style checking with a single command execution, you can ask ESLint to run Prettier for you.
Just add Prettier as an ESLint rule using eslint-plugin-prettier.
yarn add --dev prettier eslint-plugin-prettier
// .eslintrc.json
{
"plugins": [
"prettier"
],
"rules": {
"prettier/prettier": "error"
}
}
Turn off ESLint's formatting rules
Whether you run Prettier via ESLint or run both tools separately, you probably only want to hear about each formatting issue once, and you especially don't want ESLint to complain about formatting "issues" which are simply a different preference than what Prettier does.
So you'll probably want to disable the conflicting rules (while keeping around other rules that Prettier doesn't care about). The easiest way to do this is to use eslint-config-prettier. It's a one liner that can be added on-top of any existing ESLint configuration.
$ yarn add --dev eslint-config-prettier
.eslintrc.json:
{
"extends": ["prettier"]
}
There are a few rules that this disables that you may want to turn back on as long as you don't use them with particular options which conflict with Prettier. See the docs for details.