关于vue.js:eslint-常用配置禁用配置

.eslintrc.js文件配置
module.exports = {
root: true,
env: {

browser: true,
es6: true,
node: true

},
extends: [“plugin:vue/essential”, “@vue/prettier”, “@vue/typescript”],
parserOptions: {

parser: "babel-eslint"

},
rules: {

"no-console": process.env.NODE_ENV === "production" ? "error" : "off",
"prettier/prettier": "on",
"no-irregular-whitespace": 0, //这禁止掉 空格报错查看
"no-debugger": process.env.NODE_ENV === "production" ? "warn" : "off",
eqeqeq: 0, //三等号
"no-unused-vars": ["error", { vars: "all", args: "after-used" }], // 不能有申明后未被应用的变量
"no-trailing-spaces": "error", // 一行完结前面不要有空格
"space-before-function-paren": ["warn", "never"], // 函数定义时括号后面要不要有空格
"no-undef": "warn", // 不能有未定义的变量,定义之前必须有var或者let
"arrow-parens": "warn", // 箭头函数的参数要有()包裹
"spaced-comment": ["warn", "always"], // 正文前必须有空格
"no-whitespace-before-property": "error", // 禁止属性前有空格,如obj. a
"no-const-assign": "error", // 禁止批改const变量
"no-tabs": "warn", // 禁止应用tab
"no-unreachable": "warn", // 当有不能执行到的代码时
"eol-last": "warn", // 文件开端强制换行
"no-new": "error", // 禁止在应用new结构一个实例后不赋值
"no-self-assign": "warn",
"no-constant-condition": "warn",
"no-useless-escape": "warn",
"no-redeclare": "warn"

}
};

禁用以后文件
/ eslint-disable no-unused-vars /

禁用以后行
// eslint-disable-next-line no-unused-vars
// eslint-disable-next-line max-len
// eslint-disable-next-line vue/no-side-effects-in-computed-properties
// eslint-disable-next-line vue/no-dupe-keys

【腾讯云】轻量 2核2G4M,首年65元

阿里云限时活动-云数据库 RDS MySQL  1核2G配置 1.88/月 速抢

本文由乐趣区整理发布,转载请注明出处,谢谢。

您可能还喜欢...

发表回复

您的电子邮箱地址不会被公开。 必填项已用*标注

此站点使用Akismet来减少垃圾评论。了解我们如何处理您的评论数据