This project is based on @antfu/eslint-config repository.
- Single quotes, semi
- Auto fix for formatting
- Designed to work with TypeScript, Vue out-of-box
- Lint also for json, yaml, markdown
- Sorted imports, dangling commas for cleaner commit diff
- Reasonable defaults, best practices, only one-line of config
# npm
npm i -D eslint @antoniogiroz/eslint-config
{
"extends": "@antoniogiroz"
}
Or if you prefer you can point to a specific config.
You need to add
/eslint-config-{config}
{
"extends": "@antoniogiroz/eslint-config-react"
}
You don't need
.eslintignore
normally as it has been provided by the preset.
For example:
{
"scripts": {
"lint": "eslint . --cache",
"lint:fix": "eslint . --fix"
}
}
Type aware rules are enabled when a tsconfig.eslint.json
is found in the project root, which will introduce some stricter rules into your project. If you want to enable it while have no tsconfig.eslint.json
in the project root, you can change tsconfig name by modifying ESLINT_TSCONFIG
env.
// .eslintrc.js
process.env.ESLINT_TSCONFIG = 'tsconfig.json'
module.exports = {
extends: '@antoniogiroz'
}
Install VS Code ESLint extension and create .vscode/settings.json
{
"prettier.enable": false,
"editor.formatOnSave": false,
"editor.codeActionsOnSave": {
"source.fixAll.eslint": true
}
}