2016-11-30 34 views
7

我得到一个错误(eslint): Line 199 exceeds maximum line length of 120. (max-len)JSX内联eslint评论

为什么这个内嵌注释不起作用?

{/* eslint-disable-next-line max-len */} 
<Chip ref="code" style={styles.chip}backgroundColor={this.state.filterSelected['School Code'] && blue300}onTouchTap={this.handleTouchTap} > 
      <Avatar size={32}>C</Avatar> 
      School Code 
</Chip> 
+1

注释应该做工精细,误差在第二的长度如你的eslint配置中指定的那样 –

回答

11

eslint-disable-lineeslint-disable-next-line仅在内部注释。

目前在eslint

一个开放的问题,这所以,你必须把它写成如下:

{ 
    // eslint-disable-next-line max-len 
}<Chip ref="code" style={styles.chip}backgroundColor={this.state.filterSelected['School Code'] && blue300}onTouchTap={this.handleTouchTap} > 
      <Avatar size={32}>C</Avatar> 
      School Code 
</Chip> 
+3

关联的问题已被关闭 - 但是,似乎很多人发现分辨率不够完整 - 如果是这样,你可以赞成这个评论:https://github.com/ eslint/eslint /问题/ 7030#issuecomment-290866531 –