Skip to content

Commit

Permalink
[[FIX]] Remove warning W100
Browse files Browse the repository at this point in the history
No justification could be found for this warning. See
#2741
  • Loading branch information
jugglinmike authored and rwaldron committed Jul 10, 2018
1 parent bcb3b23 commit ff71d3c
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 32 deletions.
17 changes: 0 additions & 17 deletions src/lex.js
Original file line number Diff line number Diff line change
Expand Up @@ -1516,13 +1516,6 @@ Lexer.prototype = {
this.input.search(/(\u00A0)/) : -1;
},

/*
* Scan for characters that get silently deleted by one or more browsers.
*/
scanUnsafeChars: function() {
return this.input.search(reg.unsafeChars);
},

/*
* Produce the next raw token or return 'null' if no tokens can be matched.
* This method skips over all space characters.
Expand Down Expand Up @@ -1615,16 +1608,6 @@ Lexer.prototype = {
}

this.input = this.input.replace(/\t/g, state.tab);
char = this.scanUnsafeChars();

if (char >= 0) {
this.triggerAsync(
"warning",
{ code: "W100", line: this.line, character: char },
checks,
function() { return true; }
);
}

// If there is a limit on line length, warn when lines get too
// long.
Expand Down
2 changes: 1 addition & 1 deletion src/messages.js
Original file line number Diff line number Diff line change
Expand Up @@ -188,7 +188,7 @@ var warnings = {
W097: "Use the function form of \"use strict\".",
W098: "'{a}' is defined but never used.",
W099: null,
W100: "This character may get silently deleted by one or more browsers.",
W100: null,
W101: "Line is too long.",
W102: null,
W103: "The '{a}' property is deprecated.",
Expand Down
4 changes: 0 additions & 4 deletions src/reg.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,6 @@
exports.unsafeString =
/@cc|<\/?|script|\]\s*\]|<\s*!|&lt/i;

// Unsafe characters that are silently deleted by one or more browsers (cx)
exports.unsafeChars =
/[\u0000-\u001f\u007f-\u009f\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/;

// Characters in strings that need escaping (nx and nxg)
exports.needEsc =
/[\u0000-\u001f&<"\/\\\u007f-\u009f\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/;
Expand Down
14 changes: 4 additions & 10 deletions tests/unit/parser.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,16 @@ var fs = require('fs');
var TestRun = require("../helpers/testhelper").setup.testRun;
var path = require("path");

/**
* The warning for this input was intentionally disabled after research into
* its justification produced no results.
*/
exports.unsafe = function (test) {
var code = [
"var a\u000a = 'Here is a unsafe character';",
];

TestRun(test)
.addError(1, 5, "This character may get silently deleted by one or more browsers.")
.test(code, {es3: true});

test.done();
Expand All @@ -26,36 +29,30 @@ exports.peekOverDirectives = function (test) {

TestRun(test)
// Within object literal
.addError(18, 15, "This character may get silently deleted by one or more browsers.")
.addError(18, 14, "Unexpected control character in regular expression.")
.addError(19, 14, "Unexpected escaped character '<' in regular expression.")
.addError(20, 81, "Line is too long.")
.addError(21, 15, "Control character in string: <non-printable>.")
.addError(21, 14, "This character may get silently deleted by one or more browsers.")
.addError(22, 14, "'Octal integer literal' is only available in ES6 (use 'esversion: 6').")
.addError(23, 14, "'Binary integer literal' is only available in ES6 (use 'esversion: 6').")
.addError(24, 14, "'template literal syntax' is only available in ES6 (use 'esversion: 6').")
.addError(25, 14, "'Sticky RegExp flag' is only available in ES6 (use 'esversion: 6').")

// Within array literal:
.addError(44, 4, "This character may get silently deleted by one or more browsers.")
.addError(44, 3, "Unexpected control character in regular expression.")
.addError(45, 3, "Unexpected escaped character '<' in regular expression.")
.addError(46, 81, "Line is too long.")
.addError(47, 4, "Control character in string: <non-printable>.")
.addError(47, 3, "This character may get silently deleted by one or more browsers.")
.addError(48, 3, "'Octal integer literal' is only available in ES6 (use 'esversion: 6').")
.addError(49, 3, "'Binary integer literal' is only available in ES6 (use 'esversion: 6').")
.addError(50, 3, "'template literal syntax' is only available in ES6 (use 'esversion: 6').")
.addError(51, 3, "'Sticky RegExp flag' is only available in ES6 (use 'esversion: 6').")

// Within grouping operator:
.addError(70, 4, "This character may get silently deleted by one or more browsers.")
.addError(70, 3, "Unexpected control character in regular expression.")
.addError(71, 3, "Unexpected escaped character '<' in regular expression.")
.addError(72, 81, "Line is too long.")
.addError(73, 4, "Control character in string: <non-printable>.")
.addError(73, 3, "This character may get silently deleted by one or more browsers.")
.addError(74, 3, "'Octal integer literal' is only available in ES6 (use 'esversion: 6').")
.addError(75, 3, "'Binary integer literal' is only available in ES6 (use 'esversion: 6').")
.addError(76, 3, "'template literal syntax' is only available in ES6 (use 'esversion: 6').")
Expand Down Expand Up @@ -574,9 +571,7 @@ exports.regexp = function (test) {
];

var run = TestRun(test)
.addError(1, 11, "This character may get silently deleted by one or more browsers.")
.addError(1, 10, "Unexpected control character in regular expression.")
.addError(2, 12, "This character may get silently deleted by one or more browsers.")
.addError(2, 10, "Unexpected control character in regular expression.")
.addError(3, 10, "Unexpected escaped character '<' in regular expression.")
.addError(4, 10, "Unexpected escaped character '<' in regular expression.")
Expand Down Expand Up @@ -723,7 +718,6 @@ exports.strings = function (test) {

var run = TestRun(test)
.addError(1, 10, "Control character in string: <non-printable>.")
.addError(1, 9, "This character may get silently deleted by one or more browsers.")
.addError(7, 12, "Unclosed string.")
.addError(7, 12, "Missing semicolon.");
run.test(code, {es3: true});
Expand Down

0 comments on commit ff71d3c

Please sign in to comment.