【发布时间】:2021-09-03 03:14:44
【问题描述】:
some.JS.Code;
//ignore this line from linting etc.
##Software will do some stuff here, but for JS it's an Error##
hereGoesJs();
是否有可能从 Visual Studio Code 中的 linting 和格式化中排除一行? 因为我需要这条线,但代码的其他部分也需要 Linting 和 Formatting...
// I Tried
// eslint-disable-next-line no-use-before-define
// eslint-disable-line no-use-before-define
/*eslint-disable */
//suppress all warnings between comments
alert('foo');
/*eslint-enable */
// @ts-ignore
【问题讨论】:
-
是的。您应该查看 ESLint 文档。那里都有解释。
-
@Andy 我查找并尝试了,但它不起作用:/
-
将特定代码添加到您的问题以及您尝试过的内容中。
-
@Andy 我添加了我尝试过的内容
-
我第一次这样做时也有点困惑。我想为 8 行代码禁用一条规则,我花了几个小时尝试不同的 cmets 才能让它正确。无论如何,我很高兴我的回答有所帮助。 +1
标签: javascript typescript visual-studio-code prettier-eslint