@meludi/eslint-config-prettier
This package provides Prettier settings as an shareable configuration.
Installation
Install the package with:
$ npm i -D @meludi/eslint-config-prettier
Find out and install peerDependencies
.
$ npm info "@meludi/eslint-config-prettier@latest" peerDependencies
Entry points
- @meludi/eslint-config-prettier
- @meludi/eslint-config-prettier/vue
Usage
If you did not already have .eslintrc.js
and prettier.config.js
configuration files in the root of your project create them.
Add the following to your .eslintrc.js
:
// .eslintrc.js
module.exports = {
extends: [
// ... other configs
// Make sure to put prettier last, so it gets the chance to override other configs.
'@meludi/eslint-config-prettier',
// Vue
// '@meludi/eslint-config-prettier/vue',
],
};
Add the following to your prettier.config.js
:
// prettier.config.js
module.exports = require('@meludi/eslint-config-prettier/prettier.config');
NPM script
Add the following script to your package.json
for easy usage:
"scripts": {
"format": "prettier --write './**/*.{js,jsx,ts,tsx,vue,md,mdx,json}'"
}
Recommendation
Add the following config files to the root of your project:
VS Code
Copy .vscode.example to the root of your project and rename it to .vscode
.