Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

Silence warnings when run under Mozilla's JS interpreter #115

Closed
wants to merge 1 commit into from

2 participants

@magcius

If JSLint is run under Mozilla's JS interpreter, it will spew out
some warnings like 'function blah does not always return a value'.
Explicitly add some return statements to shut Mozilla up.

@magcius magcius Silence warnings when run under Mozilla's JS interpreter
If JSLint is run under Mozilla's JS interpreter, it will spew out
some warnings like 'function blah does not always return a value'.
Explicitly add some return statements to shut Mozilla up.
30d3540
@douglascrockford

No thanks.

@magcius

Figured not, but I'm curious why -- is there a reason that you don't consider implicit undefined returns an error that JSLint should check for?

@douglascrockford

You would not believe how much whining I hear. I only want JSLint to warn about stuff that can matter. I have not seen where default returns is a problem. If you can show me the evidence, I will change my mind.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Mar 31, 2012
  1. @magcius

    Silence warnings when run under Mozilla's JS interpreter

    magcius authored
    If JSLint is run under Mozilla's JS interpreter, it will spew out
    some warnings like 'function blah does not always return a value'.
    Explicitly add some return statements to shut Mozilla up.
This page is out of date. Refresh to see the latest.
Showing with 10 additions and 2 deletions.
  1. +10 −2 jslint.js
View
12 jslint.js
@@ -1272,6 +1272,7 @@ var JSLINT = (function () {
character += length;
return first;
}
+ return null;
}
function string(x) {
@@ -1452,7 +1453,7 @@ var JSLINT = (function () {
switch (c) {
case '':
stop_at('unclosed_regexp', line, from);
- return;
+ return undefined;
case '/':
if (depth > 0) {
warn_at('unescaped_a', line, from + length, '/');
@@ -2850,6 +2851,7 @@ klass: do {
}
return token.string;
}
+ return null;
}
@@ -2873,7 +2875,7 @@ klass: do {
if (next_token.id === ';') {
warn('unexpected_a');
semicolon();
- return;
+ return undefined;
}
// Is this a labeled statement?
@@ -4649,6 +4651,7 @@ klass: do {
advance();
return true;
}
+ return false;
}
@@ -4661,6 +4664,7 @@ klass: do {
advance('(number)');
return true;
}
+ return false;
}
@@ -4669,6 +4673,7 @@ klass: do {
advance();
return true;
}
+ return false;
}
function css_color() {
@@ -4775,6 +4780,7 @@ klass: do {
advance();
return true;
}
+ return false;
} else {
return css_length();
}
@@ -4787,6 +4793,7 @@ klass: do {
advance();
return true;
}
+ return false;
} else {
return css_length();
}
@@ -4817,6 +4824,7 @@ klass: do {
}
comma();
}
+ return false;
}
Something went wrong with that request. Please try again.