Skip to content

Repository files navigation

@mylesb/prettier-config

Myles' shared Prettier configuration for (hopefully) all his projects.

A single source of truth for code formatting, so every project stays consistent without copy-pasting settings around.

Settings

Option Value Meaning
trailingComma "all" Trailing commas wherever possible (incl. function args).
tabWidth 2 Two spaces per indentation level.
singleQuote false Use double quotes.

Everything else falls back to Prettier's defaults.

Installation

npm install --save-dev @mylesb/prettier-config prettier

Requires Prettier >=3.0.0.

Usage

Reference it from package.json

The simplest option — point Prettier at the package by name:

{
  "prettier": "@mylesb/prettier-config"
}

Extend it from a config file

If you need to add or override a few options, re-export the shared config and spread it:

// prettier.config.mjs
import mylesPrettierConfig from "@mylesb/prettier-config";

/** @type {import("prettier").Config} */
export default {
  ...mylesPrettierConfig,
  // your overrides here
};

Formatting

Once configured, run Prettier as usual:

# Check that files are formatted
npx prettier . -c

# Format files in place
npx prettier . --write

License

MIT © Myles Braithwaite

About

myles' shared Prettier configuration for (hopefully) all his projects.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Used by

Contributors

Languages