@@ -1077,43 +1077,33 @@ lint-md:
1077
1077
endif
1078
1078
1079
1079
LINT_JS_TARGETS = benchmark doc lib test tools
1080
- LINT_JS_CMD = tools/node_modules/eslint/bin/eslint.js --cache \
1081
- --rulesdir=tools/eslint-rules --ext=.js,.mjs,.md \
1082
- $(LINT_JS_TARGETS )
1080
+
1081
+ run-lint-js = tools/node_modules/eslint/bin/eslint.js --cache \
1082
+ --rulesdir=tools/eslint-rules --ext=.js,.mjs,.md $(LINT_JS_TARGETS )
1083
+ run-lint-js-fix = $(run-lint-js ) --fix
1083
1084
1084
1085
.PHONY : lint-js-fix
1085
1086
lint-js-fix :
1086
- @if [ -x $( NODE) ]; then \
1087
- $(NODE ) $(LINT_JS_CMD ) --fix; \
1088
- else \
1089
- node $(LINT_JS_CMD ) --fix; \
1090
- fi
1087
+ @$(call available-node,$(run-lint-js-fix ) )
1091
1088
1092
1089
.PHONY : lint-js
1093
1090
# Note that on the CI `lint-js-ci` is run instead.
1094
1091
# Lints the JavaScript code with eslint.
1095
1092
lint-js :
1096
1093
@echo " Running JS linter..."
1097
- @if [ -x $( NODE) ]; then \
1098
- $(NODE ) $(LINT_JS_CMD ) ; \
1099
- else \
1100
- node $(LINT_JS_CMD ) ; \
1101
- fi
1094
+ @$(call available-node,$(run-lint-js ) )
1102
1095
1103
1096
jslint : lint-js
1104
1097
@echo " Please use lint-js instead of jslint"
1105
1098
1099
+ run-lint-js-ci = tools/lint-js.js $(PARALLEL_ARGS ) -f tap -o test-eslint.tap \
1100
+ $(LINT_JS_TARGETS )
1101
+
1106
1102
.PHONY : lint-js-ci
1107
1103
# On the CI the output is emitted in the TAP format.
1108
1104
lint-js-ci :
1109
1105
@echo " Running JS linter..."
1110
- @if [ -x $( NODE) ]; then \
1111
- $(NODE ) tools/lint-js.js $(PARALLEL_ARGS ) -f tap -o test-eslint.tap \
1112
- $(LINT_JS_TARGETS ) ; \
1113
- else \
1114
- node tools/lint-js.js $(PARALLEL_ARGS ) -f tap -o test-eslint.tap \
1115
- $(LINT_JS_TARGETS ) ; \
1116
- fi
1106
+ @$(call available-node,$(run-lint-js-ci ) )
1117
1107
1118
1108
jslint-ci : lint-js-ci
1119
1109
@echo " Please use lint-js-ci instead of jslint-ci"
0 commit comments