no-with
NOTE: this rule is part of the
推荐 rule set.Enable full set in
deno.json:{
"lint": {
"rules": {
"tags": ["推荐"]
}
}
}Enable full set using the Deno CLI:
deno lint --rules-tags=推荐
This rule can be explictly included to or excluded from the rules present in the current tag by adding it to the
include or exclude array in deno.json:{
"lint": {
"rules": {
"include": ["no-with"],
"exclude": ["no-with"]
}
}
}不允许使用 with 语句。
with 语句不被推荐,因为它可能是导致困惑的错误和兼容性问题的源头。有关更多详情,请参阅 with - JavaScript | MDN。
无效示例:
with (someVar) {
console.log("foo");
}