Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/vtrbo/eslint-config
🌿 My ESLint Config Presets.
https://github.com/vtrbo/eslint-config
eslint eslint-config
Last synced: 20 days ago
JSON representation
🌿 My ESLint Config Presets.
- Host: GitHub
- URL: https://github.com/vtrbo/eslint-config
- Owner: vtrbo
- License: mit
- Created: 2022-08-05T01:36:23.000Z (over 2 years ago)
- Default Branch: main
- Last Pushed: 2023-09-19T10:31:42.000Z (over 1 year ago)
- Last Synced: 2024-12-04T00:36:45.260Z (about 1 month ago)
- Topics: eslint, eslint-config
- Language: JavaScript
- Homepage:
- Size: 1.67 MB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# @vtrbo/eslint-config
[![npm](https://img.shields.io/npm/v/@vtrbo/eslint-config?color=444&label=npm)](https://npmjs.com/package/@vtrbo/eslint-config)
> Forked from [@antfu/eslint-config](https://github.com/antfu/eslint-config)
> Support vue, svelte, js, ts, markdown, json...
## Usage
### Install
```bash
pnpm add -D eslint @vtrbo/eslint-config
```### Config `.eslintrc`
```json
{
"extends": "@vtrbo"
}
```> You don't need `.eslintignore` normally as it has been provided by the preset.
### Add script for package.json
For example:
```json
{
"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": 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",
"svelte",
"html",
"markdown",
"json",
"jsonc",
"yaml"
]
}
```### TypeScript Aware Rules
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.
```js
// .eslintrc.js
const process = require('node:process')process.env.ESLINT_TSCONFIG = 'tsconfig.json'
module.exports = {
extends: '@vtrbo'
}
```### 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
pnpm add -D lint-staged simple-git-hooks
```## License
[MIT](./LICENSE) License © 2022-PRESENT [Victor Bo](https://github.com/vtrbo)