0.1.0 • Published 6 months ago

eslint-config-yige-monorepo v0.1.0

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

Rascal's eslint config presets

  • Auto fix for formatting with prettier
  • TypeScript, Vue
  • Lint also for html, json, yaml, markdown
  • Reasonable defaults, best practices, only one-line of config
  • Default Alias mapping "@" => "src", "~" => "./"

Package

eslint-config-yige

this default config is equal to yige-ts

eslint-config-yige-base

this is base config, lint for js, html, json, yaml, markdown

eslint-config-yige-ts

this config extends the base config, and it also lint for ts

eslint-config-yige-vue

this config extends the ts config, and it also lint for vue3

eslint-config-yige-vue2

this config extends the ts config, and it also lint for vue2

Usage

Install

pnpm add -D eslint
pnpm add -D eslint-config-yige # for ts
pnpm add -D eslint-config-yige-base # base
pnpm add -D eslint-config-yige-ts # for ts
pnpm add -D eslint-config-yige-vue # for vue3
pnpm add -D eslint-config-yige-vue2 # for vue2

Config eslint (.eslintrc | .eslintrc.js | .eslintrc.json)

{
  "extends": "yige" // or yige-base, yige-ts, yige-vue, yige-vue2
}

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

Change import alias

{
  "settings": {
    "import/resolver": {
      "alias": {
        "map": [
          ["~", "."],
          ["@", "./src"]
        ],
        "extensions": [".js", ".jsx", ".mjs", ".ts", ".tsx", "mts", ".d.ts"]
      }
    }
  }
}

Add scripts for package.json

For example:

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

Eslint setting in VSCode

For example:

{
  "editor.codeActionsOnSave": {
    "source.fixAll.eslint": true // auto format on save
  },
  "editor.formatOnSave": false,
  "eslint.validate": ["json"],
  "[html][css][less][scss][sass][markdown][yaml][yml][jsonc]": {
    "editor.defaultFormatter": "esbenp.prettier-vscode",
    "editor.formatOnSave": true
  }
}
0.1.0

6 months ago