- A "prettier" key in your package.json file.
- A
.prettierrc
file written in JSON or YAML.
- A
.prettierrc.json
, .prettierrc.yml
, .prettierrc.yaml
, or .prettierrc.json5
file.
- A
.prettierrc.js
, or prettier.config.js
file that exports an object using export default or module.exports (depends on the type value in your package.json).
- A
.prettierrc.mjs
, or prettier.config.mjs
file that exports an object using export default.
- A
.prettierrc.cjs
, or prettier.config.cjs
file that exports an object using module.exports.
- A
.prettierrc.toml
file.
{
// ~/.config/Code/User/settings.json or .vscode/settings.json
// Extension ID: esbenp.prettier-vscode
// ...
"prettier.trailingComma": "es5",
"prettier.tabWidth": 4,
"prettier.useTabs": false,
"prettier.semi": true,
"prettier.singleQuote": true,
"prettier.endOfLine": "lf",
// ...
}
{
"trailingComma": "es5",
"tabWidth": 4,
"semi": false,
"singleQuote": true
}
// prettier.config.js or .prettierrc.js
module.exports = {
trailingComma: "es5",
tabWidth: 4,
semi: false,
singleQuote: true,
};
// .prettierrc.mjs or change "type" to "module" in package.json
const config = {
trailingComma: "es5",
tabWidth: 4,
useTabs: false,
semi: true,
singleQuote: true,
endOfLine: "lf",
}
export default config;
# .prettierrc or .prettierrc.yaml
trailingComma: "es5"
tabWidth: 4
semi: false
singleQuote: true
# .prettierrc.toml
trailingComma = "es5"
tabWidth = 4
semi = false
singleQuote = true