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

1.8 KiB
Raw Blame History

@vchikalkin/eslint-config-awesome 🎉

  • 🛠️ Most rules autofixable
  • 🎯 Designed to work with TypeScript, NextJS, React projects
  • 🏆 Powered by Canonical, SonarJS
  • ⚙️ Using ESLint Flat config

Requirements

🚀 Usage

📥 Install

pnpm add -D eslint typescript @vchikalkin/eslint-config-awesome

⚙️ Config eslint.config.js

Common usage:

const config = require('@vchikalkin/eslint-config-awesome');

module.exports = config['react-typescript'];

Extend config:

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:

{
  "scripts": {
    "lint": "eslint .",
    "lint:fix": "eslint . --fix"
  }
}

Config VS Code auto fix

Install VS Code ESLint extension, VS Code Prettier extension and create .vscode/settings.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"
  ]
}