1.3.0 • Published 1 year ago
@febase/prettier-config-svelte v1.3.0
Prettier Config
This package provides prettier config for the Svelte projects.
Prettier and Linters
- Prettier Config:
Prettierconfig for theFront-endprojects. - Prettier Config:
Prettierconfig for theSvelteprojects. - Eslint Config Base:
Eslintconfig for theJavascriptprojects. - Eslint Config Typescript:
Eslintconfig for theTypescriptprojects. - Eslint Config React JS:
Eslintconfig for theReact JSprojects. - Eslint Config React TS:
Eslintconfig for theReact TSprojects. - Eslint Config Next JS:
Eslintconfig for theNext JSprojects. - Eslint Config Next TS:
Eslintconfig for theNext TSprojects. - Eslint Config Lit JS:
Eslintconfig for theLit JSprojects. - Eslint Config Lit TS:
Eslintconfig for theLit TSprojects. - Eslint Config Node ESM:
Eslintconfig for theNode Esmprojects. - Eslint Config Svelte JS:
Eslintconfig for theSvelteprojects. - Eslint Config Svelte TS:
Eslintconfig for theSvelte TSprojects.
and more to come.
Usage
1. Install package
pnpm add -D prettier @febase/prettier-config-svelte2. Add "prettier": "@febase/prettier-config-svelte" to your package.json.
{
"prettier": "@febase/prettier-config-svelte"
}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,svelte}": ["pnpm format", "pnpm lint:fix"],
"*.{json,css,md,html}": ["pnpm format"]
}
}Note
- Monorepo: Just setup at the root repo.
- VScode:
Do notuse the below config. Because it may cause conflict order import with this config.
"editor.codeActionsOnSave": {
"source.organizeImports": true,
},