关闭特定文件的eslint规则

编程入门 行业动态 更新时间:2024-10-21 19:33:09
本文介绍了关闭特定文件的eslint规则的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

是否可以关闭整个文件的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规则

本文发布于:2023-11-01 01:31:54,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1547856.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:规则   文件   eslint

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!