Skip to content

tsingshaner/eslint-config

Repository files navigation

ESLint Config

A collection of ESLint configurations for different types of projects.

To use this configuration, it's highly recommended to include biome logo Biome as part of your linter tool for optimal results.

jsr package NPM Version LICENSE Linted with Biome Static Badge

📦 Installation

npm install --save-dev @qingshaner/eslint-config

🚀 Usage

// eslint.config.mjs

import { resolve } from 'node:path'

import { presetESLintConfig } from '@qingshaner/eslint-config'

const ROOT = import.meta.dirname // this require Node.js 20+

// Node.js < 20
// const ROOT = new URL('.', import.meta.url).pathname

export default presetESLintConfig({
  a11y: true,
  biome: true,
  ignores: [resolve(ROOT, '.gitignore')],
  jsonc: true,
  perfectionist: true,
  prettier: true,
  typescript: [ROOT],
  vue: true
})

Also provide a optional Biome configuration.

// biome.json

{
  "$schema": "node_modules/@biomejs/biome/configuration_schema.json",
  "extends": ["@qingshaner/eslint-config/biome"],
  "files": {
    "ignoreUnknown": true
  },
  "javascript": {
    "jsxRuntime": "transparent"
  }
}

🧩 Builtin Plugins

A11y

Include plugins

Biome

Disable Biome has implemented rules.

react-plugin-refresh, react-plugin-react-hooks is replaced by Biome.

JavaScript, TypeScript, CSS is formatted by Biome.

JSON or JSONC

antfu/sort/package-json is used to sort package.json. antfu/sort/tsonfig-json is used to sort *.tsconfig.json.

Include plugins

Perfectionist

Sort import statements, sort object properties.

Include plugins

Prettier

Format code with Prettier, if the file can't be formatted by Biome, it will be formatted by Prettier.

Incude plugins

React

For React project.

Include plugins

TypeScript

For TypeScript project.

Include plugins

UnoCSS

Include plugins

Vue

For Vue2 | Vue3 project.

Include plugins

✨ Inspiration

📄 License

MIT License © 2023-Present qingshaner