Forked from @autfu/eslint-config
- Single quotes, no semi
- Auto fix for formatting (aimed to be used standalone without Prettier)
- Designed to work with TypeScript, Vue out-of-box
- Lint also for json, yaml, markdown
- Sorted imports, dangling commas
- Reasonable defaults, best practices, only one-line of config
- Style principle: Minimal for reading, stable for diff
pnpm add -D eslint @shadowsight9/eslint-config{
"extends": "@shadowsight9"
}You don't need
.eslintignorenormally as it has been provided by the preset.
For example:
{
"scripts": {
"lint": "eslint .",
"lint:fix": "eslint . --fix"
}
}Install VS Code ESLint extension
Add the following settings to your settings.json:
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
{ "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", "html", "markdown", "json", "jsonc", "yaml" ] } }