no-warning-comments
不允许在评论中使用指定的警告词
开发人员经常向不完整或需要审查的代码添加注释。在您认为代码已准备好生产之前,您很可能希望修复或查看代码,然后删除注释。
// TODO: do something
// FIXME: this is not a good idea
规则详情
此规则报告包含其配置中指定的任何预定义术语的注释。
选项
此规则有一个选项对象字面量:
"terms"
:要匹配的可选术语数组。默认为["todo", "fixme", "xxx"]
。术语不区分大小写,并且作为整个单词进行匹配:fix
将匹配FIX
但不匹配fixing
。术语可以由多个单词组成:really bad idea
。"location"
:可选字符串,用于配置在您的评论中检查匹配的位置。默认为"start"
。从第一个非装饰字符开始,忽略decoration
中指定的空格、换行符和字符。另一个值是注释中的匹配anywhere
。"decoration"
:当位置为"start"
时,在注释开头忽略的可选字符数组。默认为[]
。忽略此属性中的任何空格序列或字符。当位置为"anywhere"
时,此选项将被忽略。
DEeGaPZYN/qvQ57woeA7tg3qV71Jo/slTX0SaJNeHkN6TV6JIuy+8NsGtGD0AtAJjBmx2ApehfhnALgnYs0GpWrqi16HFjAJlh4KWh3GLVhnkV7KjvCFsNmBzh7dovbAab6xfou/EiLfWnjHUoENvQ==
/*eslint no-warning-comments: "error"*/
/*
FIXME
*/
function callback(err, results) {
if (err) {
console.error(err);
return;
}
// TODO
}
DEeGaPZYN/qvQ57woeA7tg3qV71Jo/slTX0SaJNeHkN6TV6JIuy+8NsGtGD0AtAJjBmx2ApehfhnALgnYs0GpWrqi16HFjAJlh4KWh3GLVhkALiIxeSHR8Ap9yotpN+pcOEccb9yzPM6MkA46ILlTQ==
/*eslint no-warning-comments: "error"*/
function callback(err, results) {
if (err) {
console.error(err);
return;
}
// NOT READY FOR PRIME TIME
// but too bad, it is not a predefined warning term
}
terms and location
xCGxZooRYisCdewTaLdLpqMRfUfo69yJ4gNBpiDglhi9WMmbTdjxJC/2feAq9wzNc9344P1bQKq+NtDCArAZQvh9fUQU+HlHwuhu54vbuRbN19MO2ggVHQ7OHi8R16ogqdUyopiJsjZKNQjHf7rPkeT3WP1uMPuAqDxLs3sP+RA=
/*eslint no-warning-comments: ["error", { "terms": ["todo", "fixme", "any other term"], "location": "anywhere" }]*/
// TODO: this
// todo: this too
// Even this: TODO
/*
* The same goes for this TODO comment
* Or a fixme
* as well as any other term
*/
xCGxZooRYisCdewTaLdLpqMRfUfo69yJ4gNBpiDglhi9WMmbTdjxJC/2feAq9wzNc9344P1bQKq+NtDCArAZQvh9fUQU+HlHwuhu54vbuRaf3niCPoI0PJSvePpqxt86frcWzgqf3ACBgaUuBkbiAV2a4EB6GTKYh8/r8jAH5No=
/*eslint no-warning-comments: ["error", { "terms": ["todo", "fixme", "any other term"], "location": "anywhere" }]*/
// This is to do
// even not any other term
// any other terminal
/*
* The same goes for block comments
* with any other interesting term
* or fix me this
*/
装饰字符
AkAl0PsmnclSG5NkI7ZlsOmGwMGVZwhvKYUUXWuqVEl9PXbLY8PURgAvdw6LZqnP5ngh8rtn/LaPXP9/bcE+o45rOmAlzXFxUXAO96xELUQ=
/*eslint no-warning-comments: ["error", { "decoration": ["*"] }]*/
//***** todo decorative asterisks are ignored *****//
/**
* TODO new lines and asterisks are also ignored in block comments.
*/
AkAl0PsmnclSG5NkI7ZlsIJaQh3WNulLLnrvH48+iMnyNdwppziTiz8awwAeE8/NUq15CGDfJXb4QUUbGVaJMjVPyYgBJXDmKWTZ/y9FDQ8=
/*eslint no-warning-comments: ["error", { "decoration": ["/", "*"] }]*/
////// TODO decorative slashes and whitespace are ignored //////
//***** todo decorative asterisks are also ignored *****//
/**
* TODO new lines are also ignored in block comments.
*/
AkAl0PsmnclSG5NkI7ZlsIJaQh3WNulLLnrvH48+iMnyNdwppziTiz8awwAeE8/NRMccLXaXmdKaVxXjEKF44Wv/4CMdG24iClAWn5kzYWI=
/*eslint no-warning-comments: ["error", { "decoration": ["/", "*"] }]*/
//!TODO preceded by non-decoration character
/**
*!TODO preceded by non-decoration character in a block comment
*/
何时不使用
- QERJgm7qapZwz/JhnFqS+mvrIviOYwDtvKtiN0c1MKXiTwl2ymTDjv/OiHbNjV2ithSVtkcM/ZnqkcsgJ/9V0CV1tL+Arl3GH9Bzlth+6If5TKFZyR/YYlzchTN2kCGvMIemyfx8Nc8WU6CGJmTolnRHYdvo4FMNAeD7Wtq9/dEcZGXQiiKvx8R1INC0Nu8JAmHLxY/oRZd7MyjgKufl300ukLVg0hxcogGbFn2bOp0ZO0RQZmtSrxXXtTyw4E6xUj4KGrMDPDxWUO+07p28oVeKTPg/Db6iiy03e+yz0dHlBx+ajSW0HSPKqn8QvZnfBJZaBZZatSgDxXY+/1CWn357a6DKKG4i2rVXkbdmM08357G1S0J2wPlLDO0+wxbKNBW26tL9CAk04tWlvP8+XXhg6PPsl38t9f4kjhH9mawXsz03BHzFFLhcwr1X5CLBBh3i6vSPalXi6XR5qoS31Jyxj4seugiY7pv6Mae/dKNHWvga31RMg2dBbmKaZf3TX7cOXg2yLEFxHG1UTqI+0BituIKdhz9oZvtzBiyaJg/GwwhWGu6++hm5QQstJiYiU20NPP2+rbg+ojRrgGSsDFhem3a9VUxVRopRjEIZpm+4XpU5fva+xhN0RM+pwmqaW4qmJIXsWOIo3VSJyHhYesygw0exHO5nd9aeDaaxjpkV2YCEXLSyxHtYWO7Igrof