From 655359fac817ea2bb22e9e940a5d814ef4952be6 Mon Sep 17 00:00:00 2001 From: Kevin Partington Date: Sat, 29 Sep 2018 22:00:47 -0500 Subject: [PATCH] Chore: Makefile tweaks (#522) Simplify Jest calls, reorder some code to avoid lint disabling, and add check for unused disable comments --- Makefile.js | 38 +++++++++++++++++--------------------- 1 file changed, 17 insertions(+), 21 deletions(-) diff --git a/Makefile.js b/Makefile.js index 2cd8c66..ed73020 100644 --- a/Makefile.js +++ b/Makefile.js @@ -26,23 +26,6 @@ const OPEN_SOURCE_LICENSES = [ /MIT/, /BSD/, /Apache/, /ISC/, /WTF/, /Public Domain/ ]; -//------------------------------------------------------------------------------ -// Data -//------------------------------------------------------------------------------ - -const NODE_MODULES = "./node_modules/", - - // Utilities - intentional extra space at the end of each string - JEST = `${NODE_MODULES}jest/bin/jest.js`, - - // Files - MAKEFILE = "./Makefile.js", - /* eslint-disable no-use-before-define */ - JS_FILES = "parser.js", - TEST_FILES = find("tests/lib/").filter(fileType("js")).join(" "), - TOOLS_FILES = find("tools/").filter(fileType("js")).join(" "); - /* eslint-enable no-use-before-define */ - //------------------------------------------------------------------------------ // Helpers //------------------------------------------------------------------------------ @@ -59,6 +42,19 @@ function fileType(extension) { }; } +//------------------------------------------------------------------------------ +// Data +//------------------------------------------------------------------------------ + +const JEST = "jest", + LINT_OPTIONS = "--report-unused-disable-directives", + + // Files + MAKEFILE = "./Makefile.js", + JS_FILES = "parser.js", + TEST_FILES = find("tests/lib/").filter(fileType("js")).join(" "), + TOOLS_FILES = find("tools/").filter(fileType("js")).join(" "); + //------------------------------------------------------------------------------ // Tasks //------------------------------------------------------------------------------ @@ -72,25 +68,25 @@ target.lint = function() { lastReturn; echo("Validating Makefile.js"); - lastReturn = nodeCLI.exec("eslint", MAKEFILE); + lastReturn = nodeCLI.exec("eslint", MAKEFILE, LINT_OPTIONS); if (lastReturn.code !== 0) { errors++; } echo("Validating JavaScript files"); - lastReturn = nodeCLI.exec("eslint", JS_FILES); + lastReturn = nodeCLI.exec("eslint", JS_FILES, LINT_OPTIONS); if (lastReturn.code !== 0) { errors++; } echo("Validating JavaScript test files"); - lastReturn = nodeCLI.exec("eslint", TEST_FILES); + lastReturn = nodeCLI.exec("eslint", TEST_FILES, LINT_OPTIONS); if (lastReturn.code !== 0) { errors++; } echo("Validating JavaScript tools files"); - lastReturn = nodeCLI.exec("eslint", TOOLS_FILES); + lastReturn = nodeCLI.exec("eslint", TOOLS_FILES, LINT_OPTIONS); if (lastReturn.code !== 0) { errors++; }