Eslint参考手册
规则 | Rules
no-inline-comments
一些风格指南不允许与代码在同一行上发表评论。如果注释紧跟在同一行上的代码之后,代码可能变得难以阅读。另一方面,在代码之后立即发表评论有时更快更明显。
规则细节
此规则不允许与代码在同一行上发表评论。
此规则的错误代码示例:
/*eslint no-inline-comments: "error"*/
var a = 1; // declaring a to 1
function getRandomNumber(){
return 4; // chosen by fair dice roll.
// guaranteed to be random.
}
/* A block comment before code */ var b = 2;
var c = 3; /* A block comment after code */
此规则的正确代码示例:
/*eslint no-inline-comments: "error"*/
// This is a comment above a line of code
var foo = 5;
var bar = 5;
//This is a comment below a line of code
版本
该规则在 ESLint 0.10.0 中引入。
资源
- Rule source
- Documentation source
规则 | Rules相关

ESLint 是一个代码规范和错误检查工具,有以下几个特性。所有东西都是可以插拔的。你可以调用任意的 rule api 或者 formatter api 去打包或者定义 rule or formatter。任意的 rule 都是独立的。没有特定的 coding style,你可以自己配置。
主页 | https://eslint.org/ |
源码 | https://github.com/eslint/eslint |
发布版本 | 4.12.0 |