1.0.0 • Published 1 year ago

@ltteng/eslint-config v1.0.0

Weekly downloads
-
License
MIT
Repository
github
Last release
1 year ago

@ltteng/eslint-config

Flat ESLint config for JavaScript, TypeScript, Vue 2, Vue 3, Prettier.

Forked from sxzz/eslint-config

Features

  • Format with Prettier.
  • Designed to work with TypeScript, Vue 2 and 3 out-of-box.
  • Support JSON(5), YAML, Markdown...
  • Sort imports, package.json, tsconfig.json...
  • ESLint Flat config.
  • Reasonable defaults, best practices, only one-line of config.

Install

npm i -D @ltteng/eslint-config

Require Node.js >= 18.18, and ESLint >= 8.56.0.

Usage

import { ltteng } from '@ltteng/eslint-config'
export default ltteng(
  [
    /* your custom config */
  ],
  // Features: it'll detect installed dependency and enable necessary features automatically
  {
    prettier: true,
    markdown: true,
    vue: true, // auto detection
    unocss: false, // auto detection
  },
)

Presets

// eslint.config.js
import {
  // Includes
  // - `presetBasic` (JS+TS) support
  // - `presetLangsExtensions` (markdown, yaml, jsonc) support
  // - Vue support
  // - UnoCSS support (`uno.config.ts` is required)
  // - Prettier support
  presetAll,
  presetBasic, // Includes `presetJavaScript` and typescript support
  presetJavaScript, // Ignore common files and include javascript support
  presetJsonc, // Includes basic json(c) file support and sorting json keys
  presetLangsExtensions, // Includes markdown, yaml + `presetJsonc` support
} from '@ltteng/eslint-config'

export default presetAll

See preset.ts for more details.

VSCode

{
  "editor.codeActionsOnSave": {
    "source.fixAll.eslint": "explicit",
    "source.organizeImports": "never"
  },
  "eslint.experimental.useFlatConfig": true,
  "eslint.validate": [
    "javascript",
    "javascriptreact",
    "typescript",
    "typescriptreact",
    "vue",
    "html",
    "markdown",
    "json",
    "jsonc",
    "yaml"
  ]
}

License

MIT License © 2024-PRESENT LiTENGTENG