Commit 7eca2d37 authored by Robert Knight's avatar Robert Knight

Add lint checks for curly braces and return values in Array callbacks

Checking for return values in Array callbacks found several incorrect
uses of Array.map() where Array.forEach() should have been used.
parent 67676f2d
...@@ -11,7 +11,9 @@ ...@@ -11,7 +11,9 @@
"Promise": false, "Promise": false,
}, },
"rules": { "rules": {
"array-callback-return": "error",
"block-scoped-var": "error", "block-scoped-var": "error",
"curly": "error",
"eqeqeq": "error", "eqeqeq": "error",
"no-console": [ "no-console": [
"error", "error",
......
...@@ -121,7 +121,7 @@ gulp.task('build-app-js', ['build-vendor-js'], function () { ...@@ -121,7 +121,7 @@ gulp.task('build-app-js', ['build-vendor-js'], function () {
}); });
gulp.task('watch-app-js', ['build-vendor-js'], function () { gulp.task('watch-app-js', ['build-vendor-js'], function () {
appBundleConfigs.map(function (config) { appBundleConfigs.forEach(function (config) {
createBundle(config, {watch: true}); createBundle(config, {watch: true});
}); });
}); });
......
...@@ -121,7 +121,7 @@ function threadAnnotations(annotations) { ...@@ -121,7 +121,7 @@ function threadAnnotations(annotations) {
// Collect the set of threads which have no parent as // Collect the set of threads which have no parent as
// children of the thread root // children of the thread root
var roots = []; var roots = [];
Object.keys(threads).map(function (id) { Object.keys(threads).forEach(function (id) {
if (!threads[id].parent) { if (!threads[id].parent) {
// Top-level threads are collapsed by default // Top-level threads are collapsed by default
threads[id].collapsed = true; threads[id].collapsed = true;
......
'use strict'; 'use strict';
/* eslint curly: "off" */
/** This software is released under the MIT license: /** This software is released under the MIT license:
Permission is hereby granted, free of charge, to any person obtaining a copy Permission is hereby granted, free of charge, to any person obtaining a copy
......
...@@ -81,10 +81,9 @@ function stripUnnecessaryReturns(js) { ...@@ -81,10 +81,9 @@ function stripUnnecessaryReturns(js) {
for (var i=0; i < stripReturnPatterns.length; i++) { for (var i=0; i < stripReturnPatterns.length; i++) {
if (remainder.match(stripReturnPatterns[i])) { if (remainder.match(stripReturnPatterns[i])) {
return remainder; return remainder;
} else {
return remainder;
} }
} }
return line;
} else { } else {
return line; return line;
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment