Use the package manager pnpm to install the prettier configuration and related packages in the root project.
pnpm add --save-dev --save-exact --workspace-root --workspace prettier-config
pnpm add --save-dev --save-exact --workspace-root prettier
Create a prettier configuration file in ES module format. Import the configuration from prettier-config and export as default.
import baseConfig from 'prettier-config';
export default baseConfig;
Prettier can be integrated with editors, executed in the Git commit-msg hook to check or format staged files, and the CLI tool can be used directly or in scripts.
pnpm prettier *.* **/*.* --check