@yutengjing/eslint-config-typescript

eslint config for typescript project


Keywords
eslint, eslint-config, standard, comments, import, json, jsonc, markdown, node, promise, unicorn, yml, yaml, prettier, typescript, react, vue
License
MIT
Install
npm install @yutengjing/eslint-config-typescript@1.2.4

Documentation

@yutengjing/eslint-config

npm (scoped) npm test

Usage

Install

eslint is peerDependencies, make sure you had already installed eslint

# pnpm
pnpm add -D @yutengjing/eslint-config-typescript

# npm
npm add -D @yutengjing/eslint-config-typescript

# yarn
yarn add -D @yutengjing/eslint-config-typescript

# bun
bun add -d @yutengjing/eslint-config-typescript

Integrate

add this preset to .eslintrc or .eslintrc.js

{
  "extends": "@yutengjing/eslint-config-typescript"
}

or you can simply add it to package.json:

{
  "eslintConfig": {
    "extends": "@yutengjing/eslint-config-typescript"
  }
}

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

Add script for package.json

For example:

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

Config VS Code auto fix

Install VS Code ESLint extension and create .vscode/settings.json

{
  "eslint.enable": true,
  "eslint.validate": [
    "javascript",
    "javascriptreact",
    "typescript",
    "typescriptreact",
    "vue",
    "json",
    "json5",
    "jsonc",
    "markdown",
    "yml",
    "yaml",
    "html"
  ],
  "editor.codeActionsOnSave": {
    "source.fixAll.eslint": "explicit"
  }
}

@yutengjing/eslint-plugin

Some useful personal eslint rules:

check the source code or rule docs for details.

Thanks

Related