【发布时间】:2020-10-19 02:51:23
【问题描述】:
我从事的大多数项目都只是启动,最多禁用一个让我烦恼的 linting 规则。也就是说我对 linting 和 linters 了解不多,除了 eslint 无处不在。
我现在正在处理的一个 Vue 项目(我最初没有构建)有四个 linting 模块,我现在想了解它们是否都是必需的,它们是否相互冲突或相互补充。我收到了很多黄色警告,这些警告没有用 --fix 标志修复,我想卸载所有东西并安装一个 linter 来统治它们。
项目 package.json 有这些:
{
"eslint": "^7.3.1",
"eslint-plugin-prettier": "^3.1.1",
"eslint-plugin-vue": "^6.2.2",
"lint-staged": "^10.2.7"
}
想法?
我的 eslintrc.js
module.exports = {
root: true,
env: {
node: true,
},
extends: ["plugin:vue/essential", "@vue/prettier"],
rules: {
"no-console": process.env.NODE_ENV === "production" ? "off" : "off",
"no-debugger": process.env.NODE_ENV === "production" ? "error" : "off",
"max-len": [0, 0, 0],
singleQuote: 0,
trailingComma: 0,
"no-unused-vars": 0,
"vue/no-unused-components": 0,
},
parserOptions: {
parser: "babel-eslint",
},
overrides: [
{
files: ["**/__tests__/*.{j,t}s?(x)", "**/tests/unit/**/*.spec.{j,t}s?(x)"],
env: {
jest: true,
},
},
],
};
【问题讨论】:
标签: javascript eslint prettier