config-prettier
v0.3.0
Published
My personal prettier configuration for my projects
Downloads
276
Maintainers
Readme
Badges
Config-Prettier
Config-Prettier is a JavaScript package that provides a set of best practice configurations for Prettier, a code formatter that helps you maintain consistent code style in your projects. This package aims to simplify the setup process for Prettier by providing a predefined configuration and a set of recommended plugins.
Features
- Consistent and opinionated code formatting rules.
- Preconfigured to work with popular plugins.
- Easy installation and integration into your projects.
Installation
npm install --save-dev config-prettier
Usage/Examples
Once Config-Prettier is installed, you can add it to your project's package.json
file to set up Prettier scripts. Here's an example of how to add the scripts to your package.json
:
"scripts": {
// ...
"lint:check": "prettier --check \"**/*.{js,ts,tsx,md,mdx,json}\"",
"lint:fix": "prettier --write \"**/*.{js,ts,tsx,md,mdx,json}\""
},
"prettier": "config-prettier",
// ...
The lint:check
script will check your code for Prettier formatting violations, and the lint:fix
script will automatically fix them.
.prettierrc.cjs
module.exports = {
...require('config-prettier'),
// Override rules if needed, check https://prettier.io/docs
};
This configuration file extends the rules defined in Config-Prettier and allows you to override them if necessary.
Plugins
Config-Prettier depends on several Prettier plugins to enhance its functionality. You do not need to install these plugins separately; they are included with Config-Prettier by default.:
- prettier-plugin-prisma
- prettier-plugin-sort-json
- prettier-plugin-tailwindcss
- prettier-plugin-package-perfection
With Config-Prettier and its bundled plugins in place, your project's code formatting will adhere to best practices and remain consistent throughout development. Happy coding!