vchikalkin b3615e6f55 upgrade to ESLint 9 flat config
upgrade dependencies
2024-11-26 13:29:23 +03:00

85 lines
1.8 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

# @vchikalkin/eslint-config-awesome 🎉
- 🛠️ Most rules autofixable
- 🎯 Designed to work with TypeScript, NextJS, React projects
- 🏆 Powered by [Canonical](https://github.com/gajus/eslint-config-canonical), [SonarJS](https://github.com/SonarSource/eslint-plugin-sonarjs)
- ⚙️ Using ESLint **Flat** config
## Requirements
- [ESLint 9](https://github.com/eslint/eslint)
- [TypeScript 5](https://www.typescriptlang.org/)
## 🚀 Usage
### 📥 Install
```bash
pnpm add -D eslint typescript @vchikalkin/eslint-config-awesome
```
### ⚙️ Config `eslint.config.js`
Common usage:
```js
const config = require('@vchikalkin/eslint-config-awesome');
module.exports = config['react-typescript'];
```
Extend config:
```js
const config = require('@vchikalkin/eslint-config-awesome');
module.exports = [
...config['react-typescript'],
{
rules: {
'rule-name': 'off',
},
ignores: ['node_modules'],
},
//...other configs
];
```
### Add script for package.json
For example:
```json
{
"scripts": {
"lint": "eslint .",
"lint:fix": "eslint . --fix"
}
}
```
### ✨ Config VS Code auto fix
Install [VS Code ESLint extension](https://marketplace.visualstudio.com/items?itemName=dbaeumer.vscode-eslint), [VS Code Prettier extension](https://marketplace.visualstudio.com/items?itemName=esbenp.prettier-vscode) and create `.vscode/settings.json`
```json
{
"editor.codeActionsOnSave": {
"source.fixAll": "explicit",
"source.fixAll.eslint": "explicit",
"source.removeUnusedImports": "explicit"
},
"editor.defaultFormatter": "esbenp.prettier-vscode",
"editor.formatOnSave": true,
"eslint.lintTask.enable": true,
"eslint.validate": [
"javascript",
"javascriptreact",
"json",
"typescript",
"typescriptreact",
"yaml"
]
}
```