.jshintrc: Add the "forin" option & fix fallout

Also added few missing |hasOwnProperty| calls that JSHint didn't detect
because it only looks whether there is an |if| statement wrapping the
loop body.
redux
David Majda 11 years ago
parent f22d7aabb5
commit 95fd64ec15

@ -2,6 +2,7 @@
"curly": true,
"eqeqeq": true,
"evil": true,
"forin": true,
"laxbreak": true,
"noempty": true,
"nonew": true,

@ -70,8 +70,10 @@ function addExtraOptions(options, json) {
}
for (var key in extraOptions) {
if (extraOptions.hasOwnProperty(key)) {
options[key] = extraOptions[key];
}
}
}
/*

@ -48,8 +48,10 @@ module.exports = {
});
for (stage in passes) {
if (passes.hasOwnProperty(stage)) {
utils.each(passes[stage], runPass);
}
}
switch (options.output) {
case "parser": return eval(ast.code);

@ -24,8 +24,10 @@ module.exports = {
var converted = {}, stage;
for (stage in passes) {
if (passes.hasOwnProperty(stage)) {
converted[stage] = utils.values(passes[stage]);
}
}
return converted;
}

@ -69,33 +69,41 @@ var utils = {
keys: function(object) {
var result = [];
for (var key in object) {
if (object.hasOwnProperty(key)) {
result.push(key);
}
}
return result;
},
values: function(object) {
var result = [];
for (var key in object) {
if (object.hasOwnProperty(key)) {
result.push(object[key]);
}
}
return result;
},
clone: function(object) {
var result = {};
for (var key in object) {
if (object.hasOwnProperty(key)) {
result[key] = object[key];
}
}
return result;
},
defaults: function(object, defaults) {
for (var key in defaults) {
if (defaults.hasOwnProperty(key)) {
if (!(key in object)) {
object[key] = defaults[key];
}
}
}
},
/*

@ -15,8 +15,10 @@ describe("generated parser", function() {
* changed later.
*/
for (key in options) {
if (options.hasOwnProperty(key)) {
clonedOptions[key] = options[key];
}
}
describe(
"with options " + jasmine.pp(clonedOptions),
@ -123,6 +125,7 @@ describe("generated parser", function() {
} else {
if (details) {
for (key in details) {
if (details.hasOwnProperty(key)) {
if (!this.env.equals_(e[key], details[key])) {
this.message = buildKeyMessage(key, e[key]);
@ -131,6 +134,7 @@ describe("generated parser", function() {
}
}
}
}
return true;
}

@ -29,10 +29,12 @@ beforeEach(function() {
if (!isObject(value)) { return false; }
for (key in details) {
if (details.hasOwnProperty(key)) {
if (!(key in value)) { return false; }
if (!matchDetails(value[key], details[key])) { return false; }
}
}
return true;
} else {

@ -145,6 +145,7 @@ describe("PEG.js grammar parser", function() {
} else {
if (details) {
for (key in details) {
if (details.hasOwnProperty(key)) {
if (!this.env.equals_(e[key], details[key])) {
this.message = buildKeyMessage(key, e[key]);
@ -153,6 +154,7 @@ describe("PEG.js grammar parser", function() {
}
}
}
}
return true;
}

Loading…
Cancel
Save