Skip to content

Commit

Permalink
Remove support for single-line special comments (except for //jshint)
Browse files Browse the repository at this point in the history
Single-line special comments make more harm than good. Closes jshintGH-881.
  • Loading branch information
valueof authored and jugglinmike committed Oct 21, 2014
1 parent 56466a6 commit 6ce06ed
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
6 changes: 6 additions & 0 deletions src/stable/lex.js
Original file line number Diff line number Diff line change
Expand Up @@ -445,6 +445,12 @@ Lexer.prototype = {
return;
}

// Don't recognize any special comments other than jshint for single-line
// comments. This introduced many problems with legit comments.
if (label === "//" && str !== "jshint") {
return;
}

if (body.substr(0, str.length) === str) {
isSpecial = true;
label = label + str;
Expand Down
2 changes: 1 addition & 1 deletion tests/stable/unit/core.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ exports.testCustomGlobals = function (test) {

// Regression test (GH-665)
code = [
"//global bar",
"/*global bar*/",
"foo = {};",
"bar = {};"
];
Expand Down

0 comments on commit 6ce06ed

Please sign in to comment.