1.0.0 • Published 6 months ago

@mistjs/eslint-config v1.0.0

Weekly downloads
-
License
-
Repository
-
Last release
6 months ago

@mistjs/eslint-config

npm

  • Single quotes, no semi
  • Auto fix for formatting (aimed to be used standalone without Prettier)
  • TypeScript, Vue, React out-of-box
  • Lint also for json, yaml, markdown
  • Sorted imports, dangling commas for cleaner commit diff
  • Reasonable defaults, best practices, only one-line of config

Usage

Install

pnpm add -D eslint @mistjs/eslint-config

Config eslint.config.js

ESM

import mist from "@mistjs/eslint-config";
export default mist({})

CJS

// eslint.config.js
const antfu = require('@antfu/eslint-config').default

module.exports = antfu()

You don't need .eslintignore normally as it has been provided by the preset.

Add script for package.json

For example:

{
  "scripts": {
    "lint": "eslint ."
  }
}

Config VS Code auto fix

Create .vscode/settings.json

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

  // Disable the default formatter, use eslint instead
  "prettier.enable": false,
  "editor.formatOnSave": false,

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

  // Silent the stylistic rules in you IDE, but still auto fix them
  "eslint.rules.customizations": [
    { "rule": "style/*", "severity": "off" },
    { "rule": "*-indent", "severity": "off" },
    { "rule": "*-spacing", "severity": "off" },
    { "rule": "*-spaces", "severity": "off" },
    { "rule": "*-order", "severity": "off" },
    { "rule": "*-dangle", "severity": "off" },
    { "rule": "*-newline", "severity": "off" },
    { "rule": "*quotes", "severity": "off" },
    { "rule": "*semi", "severity": "off" }
  ],

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

Fork

This repo is forked from antfu-eslint-config.

License

MIT