Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
376 views
in Technique[技术] by (71.8m points)

javascript - 关闭特定文件的eslint规则(Turning off eslint rule for a specific file)

Is it possible to turn off the eslint rule for the whole file?(是否可以关闭整个文件的eslint规则?)

Something such as:(像这样的东西:) // eslint-disable-file no-use-before-define (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.((类似于eslint-disable-line。)它经常发生在我身上,在某个文件中,我打破了许多地方的特定规则,对于该文件被认为是正常的,但我不想禁用整个项目的规则,我也不想禁用该特定文件的其他规则。)   ask by Tomas Kulich translate from so

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

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 More info: http://eslint.org/docs/user-guide/configuring.html#configuring-rules(更多信息: http//eslint.org/docs/user-guide/configuring.html#configuring-rules)

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...