How do I hide a certain warning?
如何隐藏某个警告?
在极少数情况下,您需要破坏规则并隐藏生成的警告standard
。
JavaScript标准样式在引擎盖下使用ESLint,您可以像通常直接使用ESLint一样隐藏警告。
要获得详细输出(以便您可以找到要忽略的特定规则名称),请运行:
$ standard --verboseError: Use JavaScript Standard Style routes/error.js:20:36: 'file' was used before it was defined. (no-use-before-define)
禁用特定行的所有规则
:
file = 'I know what I am doing' // eslint-disable-line
或者,禁用只
的"no-use-before-define"
规则:
file = 'I know what I am doing' // eslint-disable-line no-use-before-define
或者,禁用多行
"no-use-before-define"
规则:
/* eslint-disable no-use-before-define */console.log('offending code goes here...')console.log('offending code goes here...')console.log('offending code goes here...')/* eslint-enable no-use-before-define */