Skip to content

mpx-ecology/eslint-config

Repository files navigation

@mpxjs/eslint-config

基于eslint-plugin-mpx插件,集成js和ts的推荐(recommended)配置

Usage

Install

# js版本
pnpm add -D eslint @mpxjs/eslint-config
# ts版本
pnpm add -D eslint @mpxjs/eslint-config-ts

Config .eslintrc

{
  "extends": "@mpxjs"
}

ts .eslintrc

{
  "extends": "@mpxjs/eslint-config-ts"
}

Add script for package.json

For example:

{
  "scripts": {
    "lint": "eslint --ext .js,.ts,.mpx src",
    "lint:fix": "eslint --fix --ext .js,.ts,.mpx src"
  }
}

Config VS Code auto fix

Create .vscode/settings.json

{
  "prettier.enable": false,
  "editor.codeActionsOnSave": {
    "source.fixAll.eslint": true
  }
}