是否可以关闭整个文件的eslint规则?例如:
Is it possible to turn off the eslint rule for the whole file? Something such as:
// eslint-disable-file no-use-before-define(类似于eslint-disable-line。)它经常发生在我身上,在某个文件中,我打破了一个特定的对于该文件被认为是正常的许多地方的规则,但我不想禁用整个项目的规则,也不想禁用该特定文件的其他规则。
(Analogous to eslint-disable-line.) It happens to me quite often, that in a certain file, I'm breaking a specific rule on many places which is considered OK for that file, but I don't want to disable the rule for the whole project nor do I want to disable other rules for that specific file.
推荐答案您可以通过将配置置于文件顶部来关闭/更改文件的特定规则。
You can turn off/change a particular rule for a file by putting the configurations at the top of the file.
/* eslint no-use-before-define: 0 */ // --> OFF or /* eslint no-use-before-define: 2 */ // --> ON更多信息: eslint/docs/user-guide/configuring.html#configuring-rules
更多推荐
关闭特定文件的eslint规则
发布评论