docs: update

This commit is contained in:
Anthony Fu 2023-03-24 10:08:38 +01:00
parent 4ef978a092
commit e17d2f8f52

View File

@ -3,7 +3,7 @@
[![npm](https://img.shields.io/npm/v/@antfu/eslint-config?color=a1b858&label=)](https://npmjs.com/package/@antfu/eslint-config)
- Single quotes, no semi
- Auto fix for formatting (aimed to be used standalone without Prettier)
- 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
@ -68,9 +68,51 @@ module.exports = {
}
```
## Extended Reading
### Lint Staged
Learn more about the context - [Why I don't use Prettier](https://antfu.me/posts/why-not-prettier).
If you want to apply lint and auto-fix before every commit, you can add the following to your `package.json`:
```json
{
"simple-git-hooks": {
"pre-commit": "pnpm lint-staged"
},
"lint-staged": {
"*": "eslint --fix"
}
}
```
and then
```bash
npm i -D lint-staged simple-git-hooks
```
## FAQ
### Prettier?
[Why I don't use Prettier](https://antfu.me/posts/why-not-prettier)
### How to lint CSS?
This config does NOT lint CSS. I personally use [UnoCSS](https://github.com/unocss/unocss) so I don't write CSS. If you still prefer CSS, you can use [stylelint](https://stylelint.io/) for CSS linting.
### I prefer XXX...
Sure, you can override the rules in your `.eslintrc` file.
```jsonc
{
"extends": "@antfu",
"rules": {
// your rules...
}
}
```
Or you can always fork this repo and make your own.
## Check Also