@@ -998,43 +998,33 @@ lint-md:
998
998
endif
999
999
1000
1000
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
1004
1005
1005
1006
.PHONY : lint-js-fix
1006
1007
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 ) )
1012
1009
1013
1010
.PHONY : lint-js
1014
1011
# Note that on the CI `lint-js-ci` is run instead.
1015
1012
# Lints the JavaScript code with eslint.
1016
1013
lint-js :
1017
1014
@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 ) )
1023
1016
1024
1017
jslint : lint-js
1025
1018
@echo " Please use lint-js instead of jslint"
1026
1019
1020
+ run-lint-js-ci = tools/lint-js.js $(PARALLEL_ARGS ) -f tap -o test-eslint.tap \
1021
+ $(LINT_JS_TARGETS )
1022
+
1027
1023
.PHONY : lint-js-ci
1028
1024
# On the CI the output is emitted in the TAP format.
1029
1025
lint-js-ci :
1030
1026
@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 ) )
1038
1028
1039
1029
jslint-ci : lint-js-ci
1040
1030
@echo " Please use lint-js-ci instead of jslint-ci"
0 commit comments