vue-auto-track
Version:
auto tracking for vue
51 lines (50 loc) • 3.74 kB
JavaScript
module.exports = {
// 默认情况下,ESLint 会在所有父级目录里寻找配置文件,一直到根目录。如果你想要你所有项目都遵循一个特定的约定时,这将会很有用,但有时候会导致意想不到的结果。为了将 ESLint 限制到一个特定的项目,在你项目根目录下的 package.json 文件或者 .eslintrc.* 文件里的 eslintConfig 字段下设置 "root": true。ESLint 一旦发现配置文件中有 "root": true,它就会停止在父级目录中寻找。
root: true,
// 脚本在执行期间访问的额外的全局变量
// 当访问未定义的变量时,no-undef 规则将发出警告。如果你想在一个文件里使用全局变量,推荐你定义这些全局变量,这样 ESLint 就不会发出警告了。你可以使用注释或在配置文件中定义全局变量。
globals: {
window: true,
document: true,
uni: true,
},
env: {
// 预定义的全局变量,这里是浏览器环境
browser: true,
es6: true,
node: true,
},
parserOptions: {
ecmaVersion: 7,
sourceType: "module",
},
parser: "babel-eslint",
rules: {
"no-console": "warn", // 警告console
"no-debugger": "warn", // 禁止debugger
//"semi": ["error", "never"], // 禁止分号
// "no-tabs": "error", // 禁止使用tab
"no-unreachable": "error", // 当有不能执行到的代码时
// "eol-last": "error", // 文件末尾强制换行
// "no-new": "error", // 禁止在使用new构造一个实例后不赋值
quotes: ["warn", "backtick"], // 引号类型 `` "" ''
"no-unused-vars": ["warn", { vars: "all", args: "after-used" }], // 不能有声明后未被使用的变量
// "no-trailing-spaces": "error", // 一行结束后面不要有空格
"no-undef": "warn", // 不能有未定义的变量,定义之前必须有var或者let
curly: ["error", "all"], // 必须使用 if(){} 中的{}
// "generator-star-spacing": "error", // allow async-await
// "space-before-function-paren": ["error", "never"], // 禁止函数名前有空格,如function Test (aaa,bbb)
// "space-in-parens": ["error", "never"], // 禁止圆括号有空格,如Test( 2, 3 )
// "space-infix-ops": "error", //在操作符旁边必须有空格, 如 a + b而不是a+b
// "space-before-blocks": ["error", "always"], // 语句块之前必须有空格 如 ) {}
"spaced-comment": ["error", "always"], // 注释前必须有空格
// "arrow-body-style": ["error", "always"], // 要求箭头函数必须有大括号 如 a => {}
// "arrow-parens": ["error", "always"], //要求箭头函数的参数必有用括弧包住,如(a) =>{}
"arrow-spacing": ["error", { before: true, after: true }], // 定义箭头函数的箭头前后都必须有空格
"no-const-assign": "error", // 禁止修改const变量
"template-curly-spacing": ["error", "never"], // 禁止末班字符串中的{}中的变量出现空格,如以下错误`${ a }`
// "no-multi-spaces": "error", // 禁止多个空格,只有一个空格的地方必须只有一个
"no-whitespace-before-property": "error", // 禁止属性前有空格,如obj. a
// "keyword-spacing": ["error", { "before": true, "after": true }] //关键字前后必须有空格 如 } else {
},
};