忽略 linting 和格式化的行 - VSCODE EsLint + Prettier
Ignore lines from linting and formating - 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 代码中的 linting 和格式化中排除一行?
因为我需要这条线,但代码的其他部分也需要检查和格式化...
// 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 页面位于下方link
https://eslint.org/docs/user-guide/configuring/rules#disabling-rules
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 代码中的 linting 和格式化中排除一行? 因为我需要这条线,但代码的其他部分也需要检查和格式化...
// 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