@toryz/eslint-config
v0.1.4
Published
toryz general eslint configuration
Downloads
23
Readme
@toryz/eslint-config
Refer to @antfu/eslint-config.
Install
# for vue
pnpm add eslint @toryz/eslint-config -D
# for react
pnpm add eslint @toryz/eslint-config-react -D
# for svelte
pnpm add eslint @toryz/eslint-config-svelte -D
Usage
add .eslintrc.json
{
"root": true,
"extends": "@toryz",
"rules": {
// your custom rules
}
}
Tips: if you working on react or svelte, please use @toryz/react
or @toryz/svelte
to instead it.
add scripts in package.json
{
// ...
"scripts": {
"lint": "eslint .",
"lint:fix": "eslint . --fix"
}
}
VS Code support (auto fix)
Install VS Code ESLint extension
Add the following settings to your settings.json
:
{
"prettier.enable": false,
"editor.formatOnSave": false,
"editor.codeActionsOnSave": {
"source.fixAll.eslint": true,
"source.organizeImports": false
},
// The following is optional.
// It's better to put under project setting `.vscode/settings.json`
// to avoid conflicts with working with different eslint configs
// that does not support all formats.
"eslint.validate": [
"javascript",
"javascriptreact",
"typescript",
"typescriptreact",
"vue",
"svelte",
"html",
"markdown",
"json",
"jsonc",
"yml",
"yaml"
]
}
Lint Staged
If you want to apply lint and auto-fix before every commit, you can add the following to your package.json
:
{
"simple-git-hooks": {
"pre-commit": "pnpm lint-staged"
},
"lint-staged": {
"*": "eslint --fix"
}
}
and then
npm i -D lint-staged simple-git-hooks