2021-10-31 22:58:00 +08:00
|
|
|
# @antfu/eslint-config
|
|
|
|
|
|
|
|
[![npm](https://img.shields.io/npm/v/@antfu/eslint-config)](https://npmjs.com/package/@antfu/eslint-config)
|
|
|
|
|
|
|
|
## Usage
|
|
|
|
|
|
|
|
### Install
|
|
|
|
|
|
|
|
```bash
|
|
|
|
pnpm add -D eslint @antfu/eslint-config
|
|
|
|
```
|
|
|
|
|
|
|
|
### Config `.eslintrc`
|
|
|
|
|
|
|
|
```json
|
|
|
|
{
|
2022-03-10 20:22:02 +08:00
|
|
|
"extends": "@antfu"
|
2021-10-31 22:58:00 +08:00
|
|
|
}
|
|
|
|
```
|
|
|
|
|
|
|
|
### Add script for package.json
|
|
|
|
|
|
|
|
For example:
|
|
|
|
|
|
|
|
```json
|
|
|
|
{
|
|
|
|
"scripts": {
|
2022-03-10 20:22:02 +08:00
|
|
|
"lint": "eslint ."
|
2021-10-31 22:58:00 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
```
|
|
|
|
|
2022-03-10 20:26:31 +08:00
|
|
|
### Config VS Code auto fix
|
2021-10-31 22:58:00 +08:00
|
|
|
|
|
|
|
Create `.vscode/settings.json`
|
|
|
|
|
|
|
|
```json
|
|
|
|
{
|
|
|
|
"prettier.enable": false,
|
|
|
|
"editor.codeActionsOnSave": {
|
|
|
|
"source.fixAll.eslint": true
|
|
|
|
}
|
|
|
|
}
|
|
|
|
```
|