本文共 949 字,大约阅读时间需要 3 分钟。
What can you do to disable one rule that is perhaps set automatically by your tooling?
如何禁用可能由您的工具自动设置的一个规则?
Consider the case where your tooling set the and rules.
考虑一下您的工具设置规则和规则的情况。
There might be a valid reason for production code, but in development mode, having the ability to access the and the is essential.
生产代码可能有正当的理由,但是在开发模式下,具有访问和能力至关重要。
You can disable one or more specific ESLint rules for a whole file by adding on a few lines:
您可以通过添加以下几行来为整个文件禁用一个或多个特定的ESLint规则:
/* eslint-disable no-debugger, no-console */console.log('test')
or you can just do so in a block, re-enabling it afterwards:
或者,您可以在一个代码块中这样做,然后再启用它:
/* eslint-disable no-debugger, no-console */console.log('test')/* eslint-enable no-alert, no-console */
Or you can disable the rule on a specific line:
或者,您可以在特定行上禁用该规则:
console.log('test') // eslint-disable-line no-console
debugger // eslint-disable-line no-debugger
alert('test') // eslint-disable-line no-alert
翻译自:
转载地址:http://xvqgb.baihongyu.com/