Skip to content
This repository was archived by the owner on Jan 19, 2019. It is now read-only.

Chore: Makefile tweaks #522

Merged
merged 1 commit into from
Sep 30, 2018
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
38 changes: 17 additions & 21 deletions Makefile.js
Original file line number Diff line number Diff line change
Expand Up @@ -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
//------------------------------------------------------------------------------
Expand All @@ -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
//------------------------------------------------------------------------------
Expand All @@ -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++;
}
Expand Down