[英]disabling dot-notation in eslint
I'm having trouble disabling dot-notation in eslint. 我在禁用eslint中的点符号时遇到麻烦。 Below is my eslint config (for the toy example):
以下是我的eslint配置(用于玩具示例):
module.exports = {
"env": {
"browser": true
},
"extends": "eslint:recommended",
"rules": {
"indent": [
"error",
4
],
"dot-notation": 0,
"no-console": 0,
"linebreak-style": [
"error",
"unix"
],
"quotes": [
"error",
"double"
],
"semi": [
"error",
"always"
]
}
};
And here is my javascript: 这是我的JavaScript:
var x = { a: 3 };
console.log("x[a] = " + x["a"]);
According to this , 0
is the way to turn off this eslint option. 根据此 ,
0
是关闭此选项eslint的方式。 What am I doing wrong? 我究竟做错了什么?
Setting a rule value to 0
turns the rule off completely. 将规则值设置为
0
会完全关闭规则。 This means that ESLint will not complain if you try to use an indexer rather than dot notation. 这意味着,如果您尝试使用索引器而不是点表示法,则ESLint不会抱怨。 It sounds like you're expecting the rule to either throw a warning or error which means that you need either a value of
1
(or warn
) or 2
(or error
) depending on how you want ESLint to behave. 听起来您似乎希望规则抛出警告或错误,这意味着您需要根据ESLint的行为将其值设为
1
(或warn
)或2
(或error
)。
The "Configuring Rules" section of "Configuring ESLint" should make it a little more clear: “配置ESLint”的“配置规则”部分应使其更加清晰:
https://eslint.org/docs/user-guide/configuring#configuring-rules https://eslint.org/docs/user-guide/configuring#configuring-rules
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.