eslint配置与格式化

// .eslintrc.js

module.exports = {
  root: true,
  env: {
    node: true,
  },
  extends: [
    "plugin:vue/essential",
    "eslint:recommended",
    "plugin:prettier/recommended",
  ],
  parserOptions: {
    parser: "@babel/eslint-parser",
  },
  rules: {
    "no-console": process.env.NODE_ENV === "production" ? "warn" : "off",
    "no-debugger": process.env.NODE_ENV === "production" ? "warn" : "off",
    "vue/multi-word-component-names": "off",
  },
};


//package.json

"scripts": {"lint": "vue-cli-service lint"}

"devDependencies": {
  "@babel/eslint-parser": "^7.18.9",
  "@vue/cli-plugin-eslint": "~5.0.0",
  "eslint": "^8.21.0",
  "eslint-config-prettier": "^8.5.0",
  "eslint-plugin-prettier": "^4.2.1",
  "eslint-plugin-vue": "^9.3.0",
  "prettier-eslint": "^15.0.1",
}
posted @ 2022-08-04 11:07  yoona-lin  阅读(468)  评论(0编辑  收藏  举报