0.1.5 • Published 6 months ago

@yx1126/eslint-config v0.1.5

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

@yx1126/eslint-config

Usage

Install

pnpm add -D eslint @yx1126/eslint-config

Config .eslintrc

{
    "extends": "@yx1126/eslint-config"
}

Add script for package.json

For example:

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

VS Code support (auto fix)

Install VS Code ESLint extension

Add the following settings to your settings.json:

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

TypeScript Aware Rules

Type aware rules are enabled when a tsconfig.eslint.json is found in the project root, which will introduce some stricter rules into your project. If you want to enable it while have no tsconfig.eslint.json in the project root, you can change tsconfig name by modifying ESLINT_TSCONFIG env.

// .eslintrc.js
const process = require("node:process");

process.env.ESLINT_TSCONFIG = "tsconfig.json";

module.exports = {
    extends: "@yx1126/eslint-config"
}

License

MIT License © 2023 Ch Yang