Skip to content

Commit 655359f

Browse files
platinumazureJamesHenry
authored andcommitted
Chore: Makefile tweaks (eslint#522)
Simplify Jest calls, reorder some code to avoid lint disabling, and add check for unused disable comments
1 parent bedcd10 commit 655359f

File tree

1 file changed

+17
-21
lines changed

1 file changed

+17
-21
lines changed

Makefile.js

Lines changed: 17 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -26,23 +26,6 @@ const OPEN_SOURCE_LICENSES = [
2626
/MIT/, /BSD/, /Apache/, /ISC/, /WTF/, /Public Domain/
2727
];
2828

29-
//------------------------------------------------------------------------------
30-
// Data
31-
//------------------------------------------------------------------------------
32-
33-
const NODE_MODULES = "./node_modules/",
34-
35-
// Utilities - intentional extra space at the end of each string
36-
JEST = `${NODE_MODULES}jest/bin/jest.js`,
37-
38-
// Files
39-
MAKEFILE = "./Makefile.js",
40-
/* eslint-disable no-use-before-define */
41-
JS_FILES = "parser.js",
42-
TEST_FILES = find("tests/lib/").filter(fileType("js")).join(" "),
43-
TOOLS_FILES = find("tools/").filter(fileType("js")).join(" ");
44-
/* eslint-enable no-use-before-define */
45-
4629
//------------------------------------------------------------------------------
4730
// Helpers
4831
//------------------------------------------------------------------------------
@@ -59,6 +42,19 @@ function fileType(extension) {
5942
};
6043
}
6144

45+
//------------------------------------------------------------------------------
46+
// Data
47+
//------------------------------------------------------------------------------
48+
49+
const JEST = "jest",
50+
LINT_OPTIONS = "--report-unused-disable-directives",
51+
52+
// Files
53+
MAKEFILE = "./Makefile.js",
54+
JS_FILES = "parser.js",
55+
TEST_FILES = find("tests/lib/").filter(fileType("js")).join(" "),
56+
TOOLS_FILES = find("tools/").filter(fileType("js")).join(" ");
57+
6258
//------------------------------------------------------------------------------
6359
// Tasks
6460
//------------------------------------------------------------------------------
@@ -72,25 +68,25 @@ target.lint = function() {
7268
lastReturn;
7369

7470
echo("Validating Makefile.js");
75-
lastReturn = nodeCLI.exec("eslint", MAKEFILE);
71+
lastReturn = nodeCLI.exec("eslint", MAKEFILE, LINT_OPTIONS);
7672
if (lastReturn.code !== 0) {
7773
errors++;
7874
}
7975

8076
echo("Validating JavaScript files");
81-
lastReturn = nodeCLI.exec("eslint", JS_FILES);
77+
lastReturn = nodeCLI.exec("eslint", JS_FILES, LINT_OPTIONS);
8278
if (lastReturn.code !== 0) {
8379
errors++;
8480
}
8581

8682
echo("Validating JavaScript test files");
87-
lastReturn = nodeCLI.exec("eslint", TEST_FILES);
83+
lastReturn = nodeCLI.exec("eslint", TEST_FILES, LINT_OPTIONS);
8884
if (lastReturn.code !== 0) {
8985
errors++;
9086
}
9187

9288
echo("Validating JavaScript tools files");
93-
lastReturn = nodeCLI.exec("eslint", TOOLS_FILES);
89+
lastReturn = nodeCLI.exec("eslint", TOOLS_FILES, LINT_OPTIONS);
9490
if (lastReturn.code !== 0) {
9591
errors++;
9692
}

0 commit comments

Comments
 (0)