Reputation: 673
In WebStorm I want to use my custom configuration from .prettierrc
file for code formatting.
It can change by the time I want to sync.
For example pressing Ctrl + Alt + P and Ctrl + Alt + L let my WebStorm formatting.
Upvotes: 0
Views: 5725
Reputation: 354
If anyone wants to use configuration from other directory than root (let's say configs/.prettierrc
), you can do this:
configs/.prettierrc
change source config to .cjs
file:/** @type {import('prettier').Config} */
module.exports = {
// ... your rules
};
.prettierrc.cjs
file and export source config from there:module.exports = require("./configs/.prettierrc.cjs");
Restart IDE and that should do the trick.
Upvotes: 1
Reputation: 93868
Just place your .prettierrc
in the project root and set up Prettier as the default formatter - this should do the thing
Upvotes: 2