如何解决忽略掉毛和格式化中的行 - VSC EsLint + Prettier
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
解决方法
是的,您有多种选择。
选项 #1 禁用特定规则:
/* eslint-disable no-var */
var x = 'apple sauce';
/* eslint-enable no-var */
选项 #2 禁用整个文件:
// Anything up here will still be affected by the linter.
/* eslint-disable */ // Disables everything from this point down
选项 #3 禁用单行:
// eslint-disable-next-line
var x = 'apple sauce';
// or you can do this:
var y = 'apple sauce'; // eslint-disable-line
涵盖主题“禁用 ESLint”的官方 ESLint 页面位于以下链接
https://eslint.org/docs/user-guide/configuring/rules#disabling-rules
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。