[Linter]Error running jscs


So I was working on my standard boiler plate of html and added my cdn’s with fallback code then after i have implemented that code i keep getting error running jscs pop up messages every time i do a small change, even if its a space it pops up, when i checked the dev tools i see this message right here

i am very new, so forgive me if the solution is as simple to you then it is to me. This constant pop up is annoying and dont understand why it pops up.


I don’t know anything about that error message, but I’m curious what line 17 is. Does it always say line 17?

Most likely, the linter package runs when it sees an editor.onDidChange() or an editor.onDidStopChanging() event. The error message is spawned when linter attempts to consult the external linter program to see if there are any errors in the code.


So every time i hit enter for a new line that line 17 changes and looked at what line it is that it corresponds with and this is the line of code on my html document.

<script>window.jQuery || document.write('<script type="text/javascript" src="assets/js/libs/jquery-3.2.1.min.js"><\/script>')</script> This is code on that line from the error message, which is fallback code for jquery if my cdn isn’t working


If you remove that line, do you still get the error?


Yeah it then moves to my next fallback code for bootstrap in case the cdn fails.


If you remove all the fallback script tags, does the error still appear?


Yes so when i removed all my fallback code the error does not pop up any more.


But i do not have a fallback script code for if for some reason the cdn’s go down


I’m not suggesting that you publish your site without those tags. I’m trying to help you figure out why the message is appearing. Right now, it seems like the solution is to do whatever linting you need to do without those script tags, then add them before you publish. I’m not sure you really even need to use linter-jshint to check HTML files. You should keep almost all of your JavaScript in external files and link to them.


Yeah that might be the best approach thank you for you patients and time i do appreciate it al ot.


No problem. I’m sure there’s a fix for this bug somewhere, but I don’t know anything about the software that package depends on. But figuring out cases where the bug doesn’t show up and using those to work around the anomaly, that’s easy. :slight_smile:


In your example code JSCS stumbles over the escaping of the / character (column 115).

Why is it running on your html file anyway? I think linter-jscs isn’t meant to lint html files?


I wrote fallback code in case jquery cdn is offline, and in that case it would run in a local file of jquery after checking the condition. I didn’t understand why it was linting my html file.


Well, I checked and linter-jscs also lints html files, though this is not mentioned in the readme.
Unfortunately and this might be where the problem comes from, JSCS might be a bit outdated?
You are probably better off using an newer linter, linter-eslint or linter-jshint perhaps (the latter has an option to lint html/php also).