Reputation: 2488
For example this, at the top of a node.js source file:
#!/usr/bin/env node
...or unused local variables, etc.
Upvotes: 24
Views: 87306
Reputation: 99
You can select suggestion from PROBLEMS by hovering over the red x in the circle and then click on the lamp :
Upvotes: 3
Reputation: 828
You can do this via inline - e.g.: // eslint-disable-next-line [RULE]
on the line prior to the line of code you want it to ignore. The RULE
is optional, and will tell it to ignore a specific rule; if you don't specify one, it will tell it to ignore all rules.
Lots of other options available - see the docs for more detail: https://eslint.org/docs/user-guide/configuring#disabling-rules-with-inline-comments.
Upvotes: 0
Reputation: 7005
Late to the party but in VSCode you can write // @ts-ignore
just before the line you want to ignore.
It is important to notice that it will just ignore the line after the declaration.
There is more info about it in the official documentation.
Upvotes: 48
Reputation: 1109
You can tell jshint to ignore lines, or just certain rules. Here's how to ignore a line, from http://jshint.com/docs/
// Code here will be linted with JSHint.
/* jshint ignore:start */
// Code here will be ignored by JSHint.
/* jshint ignore:end */
Now, I'm just assuming that Code honors these directive.
Upvotes: 3
Reputation: 2364
For unused local variable, you can configure the user or the workspace settings.
From the preference menu item, choose user/workspace settings:
// Place your settings in this file to overwrite default and user settings.
{
// Unused local variable.
"javascript.validate.lint.unusedVariables": "ignore"
}
As for #!/usr/bin/env node
what is the undesirable behavior that you want disable?
Upvotes: 6