I'm building a website using Cherrpy, and I have in my code lines such as if (vacant < parseInt({{warnLevel}}),10) {
. {{warnLevel}}
is replaced by a variable I pass from a Python script, allowing me to set variables externally. However, this results in a lot of errors, as, although this works, VSCode doesn't recognise this as valid JS. Is there a way I can disable JS validation for a specific line? I've tried // @ts-ignore
as suggested here but it doesn't seem to work.
Asked
Active
Viewed 680 times
2
2 Answers
1
You can just add either
// eslint-disable-line
at the end of a line
or
// eslint-disable-next-line
on the line before
more details here
note there is no reason to install an extra extension. The eslint extension already offers these options
note you can configure any rules you want by adding comments

gman
- 100,619
- 31
- 269
- 393
0
install eslint-disable-snippets extention for this purpose.
you can include snippets for ignoring; a block, the current line, or the next line.

gman
- 100,619
- 31
- 269
- 393

mh. bitarafan
- 886
- 9
- 16
-
This looks good, what specifically would I use to disable this error? Can I just set it to ignore all? – clubby789 Aug 08 '19 at 10:37
-
1you should put youre code between /* eslint-disable \*/ /* eslint-enable */ to ignore all errors – mh. bitarafan Aug 08 '19 at 10:39
-
The errors are still showing up. This is JS embedded in HTML, if that matters – clubby789 Aug 08 '19 at 10:42
-
this extention seems to work in js files try it in an external javascript file and tell me the results – mh. bitarafan Aug 08 '19 at 10:53
-
Still getting the warnings. Edit: I figured it out lol, I had to install ESLint and disable the built in validation – clubby789 Aug 08 '19 at 10:57
-
nice. happy to hear – mh. bitarafan Aug 08 '19 at 11:06