jpo
jpo

Reputation: 2660

JSHint: How do disable the check for unsafe characters for comments?

When using "unsafe characters" (e.g. umlauts) in comments I get the following error:

This character may get silently deleted by one or more browsers.

Is there any way to disable this check for comments (globally)?

Upvotes: 22

Views: 8406

Answers (3)

mmso
mmso

Reputation: 1

I solve this problem as follows ... in jshint.js change the lines

char = this.scanUnsafeChars();

if (char >= 0) {
     this.trigger("warning", 
     { code: "W100", line: this.line, character: char });
}

to

char = this.scanUnsafeChars();

if (char >= 0) {
  var inCommentW100 = this.inComment ||
    startsWith.call(inputTrimmed, "//") ||
    startsWith.call(inputTrimmed, "/*");

  if(!inCommentW100) {
     this.trigger("warning", 
        { code: "W100", line: this.line, character: char });
  }
}

Upvotes: 0

Fasani
Fasani

Reputation: 5759

I was able to fix this problem by saving the document as UTF-8.

I have several files all created the same way, three of them are giving me this error using gulp + jslint, I dont know why but I managed to get rid of the error in Sublime Text by going to:

File > Save with Encoding > UTF-8

Errors magically disappear!

Upvotes: 15

Morten Siebuhr
Morten Siebuhr

Reputation: 6108

I fixed it in one specific file by adding /* jshint -W100 */ in the top of the file.

To ignore it globally, I guess you have to add it somewhere in .jshintrc (though I don't know where).

Upvotes: 29

Related Questions