Skip to content

Commit 13bc53f

Browse files
committed
build: make lint-js independent of local node
PR-URL: #18272 Reviewed-By: Gibson Fahnestock <[email protected]> Reviewed-By: James M Snell <[email protected]>
1 parent be0778b commit 13bc53f

File tree

1 file changed

+10
-20
lines changed

1 file changed

+10
-20
lines changed

Makefile

+10-20
Original file line numberDiff line numberDiff line change
@@ -998,43 +998,33 @@ lint-md:
998998
endif
999999

10001000
LINT_JS_TARGETS = benchmark doc lib test tools
1001-
LINT_JS_CMD = tools/node_modules/eslint/bin/eslint.js --cache \
1002-
--rulesdir=tools/eslint-rules --ext=.js,.mjs,.md \
1003-
$(LINT_JS_TARGETS)
1001+
1002+
run-lint-js = tools/node_modules/eslint/bin/eslint.js --cache \
1003+
--rulesdir=tools/eslint-rules --ext=.js,.mjs,.md $(LINT_JS_TARGETS)
1004+
run-lint-js-fix = $(run-lint-js) --fix
10041005

10051006
.PHONY: lint-js-fix
10061007
lint-js-fix:
1007-
@if [ -x $(NODE) ]; then \
1008-
$(NODE) $(LINT_JS_CMD) --fix; \
1009-
else \
1010-
node $(LINT_JS_CMD) --fix; \
1011-
fi
1008+
@$(call available-node,$(run-lint-js-fix))
10121009

10131010
.PHONY: lint-js
10141011
# Note that on the CI `lint-js-ci` is run instead.
10151012
# Lints the JavaScript code with eslint.
10161013
lint-js:
10171014
@echo "Running JS linter..."
1018-
@if [ -x $(NODE) ]; then \
1019-
$(NODE) $(LINT_JS_CMD); \
1020-
else \
1021-
node $(LINT_JS_CMD); \
1022-
fi
1015+
@$(call available-node,$(run-lint-js))
10231016

10241017
jslint: lint-js
10251018
@echo "Please use lint-js instead of jslint"
10261019

1020+
run-lint-js-ci = tools/lint-js.js $(PARALLEL_ARGS) -f tap -o test-eslint.tap \
1021+
$(LINT_JS_TARGETS)
1022+
10271023
.PHONY: lint-js-ci
10281024
# On the CI the output is emitted in the TAP format.
10291025
lint-js-ci:
10301026
@echo "Running JS linter..."
1031-
@if [ -x $(NODE) ]; then \
1032-
$(NODE) tools/lint-js.js $(PARALLEL_ARGS) -f tap -o test-eslint.tap \
1033-
$(LINT_JS_TARGETS); \
1034-
else \
1035-
node tools/lint-js.js $(PARALLEL_ARGS) -f tap -o test-eslint.tap \
1036-
$(LINT_JS_TARGETS); \
1037-
fi
1027+
@$(call available-node,$(run-lint-js-ci))
10381028

10391029
jslint-ci: lint-js-ci
10401030
@echo "Please use lint-js-ci instead of jslint-ci"

0 commit comments

Comments
 (0)