@dnd-mapp/config-prettier
v1.1.0
Published
Prettier configuration shared across D&D Mapp projects.
Maintainers
Readme
@dnd-mapp/config-prettier
Shared Prettier config for all D&D Mapp projects.
Requirements
- Prettier 3 is a peer dependency and must be installed in your project.
Installation
pnpm add --save-dev prettier @dnd-mapp/config-prettierUsage
Reference the config from a .prettierrc file in your project root.
"@dnd-mapp/config-prettier"To add your own options, re-export the config from a prettier.config.js file instead.
import config from '@dnd-mapp/config-prettier';
export default {
...config,
printWidth: 100,
};Available configs
| Config | Import path | Description |
|:-------------------|:---------------------------------------------|:------------------------------------------------|
| base | @dnd-mapp/config-prettier/base | The default config for any project |
| organize-imports | @dnd-mapp/config-prettier/organize-imports | Extends base with the organize imports plugin |
The package root, @dnd-mapp/config-prettier, resolves to base.
Every config ships with type declarations. Each one is typed as a Prettier Config, so it works in a prettier.config.ts file.
organize-imports
This config includes everything from base and adds prettier-plugin-organize-imports. The plugin sorts and removes unused imports when Prettier formats a file.
The plugin is an optional peer dependency, so install it together with typescript, which it requires. The supported versions are prettier-plugin-organize-imports 4 and typescript 6.
pnpm add --save-dev prettier prettier-plugin-organize-imports typescript @dnd-mapp/config-prettierThen re-export the config from a prettier.config.js file.
export { default } from '@dnd-mapp/config-prettier/organize-imports';What base sets
| Option | Value | Description |
|:--------------|:---------------|:-------------------------------------------------|
| printWidth | 120 | Wraps code at 120 columns |
| quoteProps | 'consistent' | Quotes object properties only if one requires it |
| singleQuote | true | Uses single quotes instead of double quotes |
The config has one override. Files that match *.yaml or *.yml use double quotes, so singleQuote is false for them.
The config does not set tabWidth. Prettier reads it from the .editorconfig file in your project, so set indent_size there.
Changelog
Notable changes for consumers of this package are listed in the changelog.
Contributing
Contributions are welcome. See the contributing guide for details.
License
MIT © D&D Mapp
