Einride's default Prettier config
Install @einride/prettier-config
as a dev dependency:
yarn add @einride/prettier-config --dev
Make sure Prettier is also installed in your project.
Add @einride/prettier-config
to your .prettierrc.mjs
file:
import einridePrettierConfig from "@einride/prettier-config"
export default {
...einridePrettierConfig,
}
Specific settings can be overridden by adding them after @einride/prettier-config
:
import einridePrettierConfig from "@einride/prettier-config"
export default {
...einridePrettierConfig,
semi: true,
}
Add a formatting scripts to the scripts
section of your package.json
:
{
"scripts": {
"format": "prettier --write .",
"format-check": "prettier --check ."
}
}
Running yarn format
will format all your files according to the config specified in
.prettierrc.mjs
.
Running yarn format-check
will return exit code 1 when there are formatting issues, which makes it
a good fit for CI.
Add a .prettierignore
file to ignore files from being formatted:
src/gen # ignores files in src/gen directory from being formatted
node_modules
is ignored by default.
See Contributing Guide.
MIT