Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/zhou-tao/eslint-config
my general eslint config
https://github.com/zhou-tao/eslint-config
eslint eslint-config
Last synced: 28 days ago
JSON representation
my general eslint config
- Host: GitHub
- URL: https://github.com/zhou-tao/eslint-config
- Owner: zhou-tao
- License: mit
- Created: 2023-03-30T15:30:42.000Z (over 1 year ago)
- Default Branch: main
- Last Pushed: 2023-12-11T07:52:55.000Z (11 months ago)
- Last Synced: 2024-10-01T20:04:40.224Z (about 1 month ago)
- Topics: eslint, eslint-config
- Language: JavaScript
- Homepage:
- Size: 387 KB
- Stars: 4
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# @toryz/eslint-config
[![npm](https://img.shields.io/npm/v/@toryz/eslint-config?color=ffb&label=)](https://npmjs.com/package/@toryz/eslint-config)
Refer to [@antfu/eslint-config](https://github.com/antfu/eslint-config).
### Install
```bash
# 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`
```jsonc
{
"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`
```jsonc
{
// ...
"scripts": {
"lint": "eslint .",
"lint:fix": "eslint . --fix"
}
}
```##### VS Code support (auto fix)
Install [VS Code ESLint extension](https://marketplace.visualstudio.com/items?itemName=dbaeumer.vscode-eslint)
Add the following settings to your `settings.json`:
```jsonc
{
"prettier.enable": false,
"editor.formatOnSave": false,
"editor.codeActionsOnSave": {
"source.fixAll.eslint": "explicit",
"source.organizeImports": "never"
},// 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`:
```json
{
"simple-git-hooks": {
"pre-commit": "pnpm lint-staged"
},
"lint-staged": {
"*": "eslint --fix"
}
}
```and then
```bash
npm i -D lint-staged simple-git-hooks
```