首页
学习
活动
专区
工具
TVP
发布
精选内容/技术社群/优惠产品,尽在小程序
立即前往

How do I hide a certain warning?

如何隐藏某个警告?

在极少数情况下,您需要破坏规则并隐藏生成的警告standard

JavaScript标准样式在引擎盖下使用ESLint,您可以像通常直接使用ESLint一样隐藏警告。

要获得详细输出(以便您可以找到要忽略的特定规则名称),请运行:

代码语言:javascript
复制
$ standard --verboseError: Use JavaScript Standard Style  routes/error.js:20:36: 'file' was used before it was defined. (no-use-before-define)

禁用特定行的所有规则

代码语言:javascript
复制
file = 'I know what I am doing' // eslint-disable-line

或者,禁用"no-use-before-define"规则:

代码语言:javascript
复制
file = 'I know what I am doing' // eslint-disable-line no-use-before-define

或者,禁用多行"no-use-before-define"规则:

代码语言:javascript
复制
/* 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 */

扫码关注腾讯云开发者

领取腾讯云代金券