@kachkaev → prettier config
Works with Prettier v2, Compatible with Yarn PnP ans well as Classic Yarn / NPM.
Uses default options, except for setting { trailingComma: "all" }
.
Includes:
Adding to project
-
Install the package:
npm install -D @kachkaev/prettier-config ## or yarn add -D @kachkaev/prettier-config
-
Create
.prettierrc.js
with the following contents:module.exports = require("@kachkaev/prettier-config");
-
Create
.prettierignore
. For example,####################### ## Specific to Prettier ####################### ## Ignore all files (but still allow sub-folder scanning) * !*/ ## Allow certain file types !*.cjs !*.css !*.graphql !*.js !*.json !*.jsx !*.md !*.mjs !*.ts !*.tsx !*.yml ######################## ## Same as in .gitignore ######################## # (paste lines from .gitignore here)
-
Optionally, configure package scripts and a pre-commit hook to make sure that all project files are always formatted. See example in
njt
→package.json
.