@febase/prettier-config
v1.5.0
Published
Shared Prettier config
Downloads
30
Readme
Prettier Config
This package provides prettier
config for the Front-end projects.
Prettier and Linters
- Prettier Config:
Prettier
config for theFront-end
projects. - Prettier Config:
Prettier
config for theSvelte
projects. - Eslint Config Base:
Eslint
config for theJavascript
projects. - Eslint Config Typescript:
Eslint
config for theTypescript
projects. - Eslint Config React JS:
Eslint
config for theReact JS
projects. - Eslint Config React TS:
Eslint
config for theReact TS
projects. - Eslint Config Next JS:
Eslint
config for theNext JS
projects. - Eslint Config Next TS:
Eslint
config for theNext TS
projects. - Eslint Config Lit JS:
Eslint
config for theLit JS
projects. - Eslint Config Lit TS:
Eslint
config for theLit TS
projects. - Eslint Config Node ESM:
Eslint
config for theNode Esm
projects. - Eslint Config Svelte JS:
Eslint
config for theSvelte
projects. - Eslint Config Svelte TS:
Eslint
config for theSvelte TS
projects.
and more to come.
Usage
1. Install package
pnpm add -D prettier @febase/prettier-config
2. Add "prettier": "@febase/prettier-config"
to your package.json
.
{
"prettier": "@febase/prettier-config"
}
3. Add script to your package.json
.
{
"scripts": {
"format": "prettier --write ."
}
}
Configuration your VScode
.
In root your project's folder. Create .vscode
folder with structure:
.vscode
- settings.json
{
"editor.defaultFormatter": "esbenp.prettier-vscode",
"editor.formatOnSave": true
}
Setup git hooks
- Install packages and global setup
husky
,lint-staged
.
pnpm add -D husky lint-staged
pnpm dlx husky install
pnpm pkg set scripts.prepare="husky install"
pnpm dlx husky add .husky/pre-commit "pnpm dlx lint-staged"
- Add the following to your
package.json
:
{
"lint-staged": {
"*.{js,jsx,ts,tsx}": ["pnpm format", "pnpm lint:fix"],
"*.{json,css,md,html}": ["pnpm format"]
}
}
Note
- Monorepo: Just setup at the root repo.
- VScode:
Do not
use the below config. Because it may cause conflict order import with this config.
"editor.codeActionsOnSave": {
"source.organizeImports": true,
},