1.1.1 • Published 3 months ago

@kainstar/eslint-config v1.1.1

Weekly downloads
-
License
MIT
Repository
github
Last release
3 months ago

@kainstar/eslint-config

npm package Build Status Downloads Issues Commitizen Friendly Semantic Release

ESLint config for kainstar projects

Thanks antfu's eslint-config, this project references it a lot, and do some changes to fit my needs.

  • All plugins as dependencies, don't need to install them manually
  • TypeScript is basic, so remove or off some rules that can be checked by the TypeScript compiler.
  • Stop check style (should use stylelint) and other file types not used usually.

Usage

Install

pnpm i -D eslint @kainstar/eslint-config

Create config file

With "type": "module" in package.json (recommended):

// eslint.config.js
import kainstar from '@kainstar/eslint-config';

export default kainstar();

VS Code support (auto fix)

Install VS Code ESLint extension

Add the following settings to your .vscode/settings.json:

{
  // Enable the ESlint flat config support
  "eslint.experimental.useFlatConfig": true,

  // Auto fix
  "editor.codeActionsOnSave": {
    "source.fixAll.eslint": "explicit",
    "source.organizeImports": "never",
  },

  // Silent the stylish related rules in you IDE, but still auto fix them
  "eslint.rules.customizations": [
    { "rule": "prettier/prettier", "severity": "off" },
    { "rule": "*-indent", "severity": "off" },
    { "rule": "*-spacing", "severity": "off" },
    { "rule": "*-order", "severity": "off" },
    { "rule": "*-newline", "severity": "off" },
  ],

  // Enable eslint for all supported languages
  "eslint.validate": [
    "javascript",
    "javascriptreact",
    "typescript",
    "typescriptreact",
    "vue",
    "html",
    "markdown",
    "yaml",
  ],
}