@wpazderski/prettier-config
v2.0.1
Published
Common Prettier configs
Readme
@wpazderski/prettier-config
Common Prettier configs
Installation and usage
Start by installing this package and prettier, for example with pnpm:
pnpm i -D @wpazderski/prettier-config prettierThen create .prettierrc.js file:
import { <CONFIG_NAME> } from "@wpazderski/prettier-config/<CONFIG_NAME>.js";
/** @type {import("prettier").Config} */
const config = {
...<CONFIG_NAME>,
// Custom options
};
export default config;Replace <CONFIG_NAME> with chosen config (see Available configs section), for example:
import { base } from "@wpazderski/prettier-config/base.js";
/** @type {import("prettier").Config} */
const config = {
...base,
// Custom options
};
export default config;Now you can run Prettier as usual, for example:
pnpm exec prettier . --checkAvailable configs
Currently only one config is provided - base.
Merging configs
A mergeConfigs helper is provided for combining multiple configs.
Later configs override earlier ones for scalar options; the plugins and overrides arrays are concatenated (and plugins is de-duplicated):
import { base } from "@wpazderski/prettier-config/base.js";
import { mergeConfigs } from "@wpazderski/prettier-config/mergeConfigs.js";
export default mergeConfigs(base, {
printWidth: 100,
});Related projects
See https://pazderski.dev/projects/ for other projects that provide various configs, utils, tools and examples.
