From aefcb563306e99aa032464f6be6bc32e9656761d Mon Sep 17 00:00:00 2001 From: XhmikosR Date: Fri, 28 Dec 2018 17:57:17 +0200 Subject: Minor lint tweaks. --- Gruntfile.js | 2 -- tasks/bootlint.js | 13 +++---------- 2 files changed, 3 insertions(+), 12 deletions(-) diff --git a/Gruntfile.js b/Gruntfile.js index f3fa1b6..48ac214 100644 --- a/Gruntfile.js +++ b/Gruntfile.js @@ -9,7 +9,6 @@ 'use strict'; module.exports = function(grunt) { - // Project configuration. grunt.initConfig({ jshint: { @@ -136,5 +135,4 @@ module.exports = function(grunt) { // By default, run all tests. grunt.registerTask('default', 'test'); - }; diff --git a/tasks/bootlint.js b/tasks/bootlint.js index fcd6656..f3a9325 100644 --- a/tasks/bootlint.js +++ b/tasks/bootlint.js @@ -26,7 +26,7 @@ module.exports = function(grunt) { function getDisabledIdsForFilepath(filepath) { // Relaxerror defined as array without filepaths - if (options.relaxerror instanceof Array) { + if (Array.isArray(options.relaxerror)) { return options.relaxerror; } @@ -38,7 +38,7 @@ module.exports = function(grunt) { const paths = options.relaxerror[key]; // handle 'E001': true, 'E001': [] - if (!(paths instanceof Array) || paths.length === 0) { + if (!Array.isArray(paths) || paths.length === 0) { return true; } @@ -56,17 +56,14 @@ module.exports = function(grunt) { // Iterate over all specified file groups. this.files.forEach((f) => { - f.src.filter((filepath) => { if (!grunt.file.exists(filepath)) { grunt.log.warn(`Source file "${filepath}" not found.`); return false; } return true; - }) .forEach((filepath) => { - const src = grunt.file.read(filepath); const reporter = (lint) => { const isError = lint.id[0] === 'E'; @@ -82,7 +79,6 @@ module.exports = function(grunt) { totalErrCount++; output = true; }); - } if (!output) { @@ -91,11 +87,10 @@ module.exports = function(grunt) { } if (!options.showallerrors) { - if (isError && options.stoponerror || isWarning && options.stoponwarning) { + if ((isError && options.stoponerror) || (isWarning && options.stoponwarning)) { grunt.fail.warn('Too many bootlint errors.'); } } - }; const disabledIds = getDisabledIdsForFilepath(filepath); @@ -117,8 +112,6 @@ module.exports = function(grunt) { } else { grunt.log.ok(`${totalFileCount} ${fileStr} lint free.`); } - }); - }); }; -- cgit v1.2.3