Skip to content

Document recommended setup #7828

@lydell

Description

@lydell

Now that Prettier 2.0 has been released with its improved CLI, I think we should add a section do the docs showing a recommended example setup.

  1. Recommend using an editor extension that lets you run Prettier from your editor. Link to popular extensions. Maybe add some tips on how to configure for example prettier-vscode.
  2. Recommend adding an empty ({}) .prettierrc.json to signify to editor extensions that your project is using Prettier (with default settings).
  3. Recommend adding a .prettierignore if you don’t want to run Prettier on certain files. For example: *.html. Mention that this lets both editor extensions and the Prettier CLI know that you don’t want HTML files to be formatted, unlike putting a glob in some npm script or Makefile.
  4. Recommend using prettier --write . when you want to bulk format everything.
  5. Recommend using prettier --check . in CI.
  6. Maybe mention pre-commit hooks or something. I don’t use that myself so I don’t have a suggestion here.
  7. Maybe mention how to set up LF in git on Windows or something.

I think we should also de-emphasize eslint-plugin-prettier.

  • Prettier editor extensions are must faster than ESLint --autofix editor extensions.
  • Everything annoyingly becomes underlined with red in your editor.
  • The error messages kind of suggest fixing the Prettier formatting manually, which is like the opposite of the Prettier experience.
  • prettier --check . is so easy that you don’t really simplify your configuration by putting Prettier in your ESLint setup.

Note: We could probably fix #8464 at the same time.

Metadata

Metadata

Assignees

No one assigned

    Labels

    locked-due-to-inactivityPlease open a new issue and fill out the template instead of commenting.status:needs discussionIssues needing discussion and a decision to be made before action can be takentype:docsIssues about adding or improving documentation

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions