Skip to content

Commit 333d7dd

Browse files
joyeecheungBethGriggs
authored andcommitted
build: make lint-js independent of local node
PR-URL: #18272 Backport-PR-URL: #19190 Reviewed-By: Gibson Fahnestock <[email protected]> Reviewed-By: James M Snell <[email protected]>
1 parent d537f45 commit 333d7dd

File tree

1 file changed

+12
-20
lines changed

1 file changed

+12
-20
lines changed

Makefile

+12-20
Original file line numberDiff line numberDiff line change
@@ -1045,37 +1045,29 @@ lint-md:
10451045
endif
10461046

10471047
LINT_JS_TARGETS = benchmark doc lib test tools
1048-
LINT_JS_CMD = tools/eslint/bin/eslint.js --cache \
1049-
--rulesdir=tools/eslint-rules --ext=.js,.mjs,.md \
1050-
$(LINT_JS_TARGETS)
1048+
1049+
run-lint-js = tools/eslint/bin/eslint.js --cache \
1050+
--rulesdir=tools/eslint-rules --ext=.js,.mjs,.md $(LINT_JS_TARGETS)
1051+
run-lint-js-fix = $(run-lint-js) --fix
10511052

10521053
lint-js-fix:
1053-
@if [ -x $(NODE) ]; then \
1054-
$(NODE) $(LINT_JS_CMD) --fix; \
1055-
else \
1056-
node $(LINT_JS_CMD) --fix; \
1057-
fi
1054+
@$(call available-node,$(run-lint-js-fix))
10581055

10591056
lint-js:
10601057
@echo "Running JS linter..."
1061-
@if [ -x $(NODE) ]; then \
1062-
$(NODE) $(LINT_JS_CMD); \
1063-
else \
1064-
node $(LINT_JS_CMD); \
1065-
fi
1058+
@$(call available-node,$(run-lint-js))
10661059

10671060
jslint: lint-js
10681061
@echo "Please use lint-js instead of jslint"
10691062

1063+
run-lint-js-ci = tools/lint-js.js $(PARALLEL_ARGS) -f tap -o test-eslint.tap \
1064+
$(LINT_JS_TARGETS)
1065+
1066+
.PHONY: lint-js-ci
1067+
# On the CI the output is emitted in the TAP format.
10701068
lint-js-ci:
10711069
@echo "Running JS linter..."
1072-
@if [ -x $(NODE) ]; then \
1073-
$(NODE) tools/lint-js.js $(PARALLEL_ARGS) -f tap -o test-eslint.tap \
1074-
$(LINT_JS_TARGETS); \
1075-
else \
1076-
node tools/lint-js.js $(PARALLEL_ARGS) -f tap -o test-eslint.tap \
1077-
$(LINT_JS_TARGETS); \
1078-
fi
1070+
@$(call available-node,$(run-lint-js-ci))
10791071

10801072
jslint-ci: lint-js-ci
10811073
@echo "Please use lint-js-ci instead of jslint-ci"

0 commit comments

Comments
 (0)