build: make lint-js independent of local node
PR-URL: https://github.com/nodejs/node/pull/18272 Reviewed-By: Gibson Fahnestock <gibfahn@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com>
This commit is contained in:
parent
be0778b361
commit
13bc53fb26
30
Makefile
30
Makefile
@ -998,43 +998,33 @@ lint-md:
|
|||||||
endif
|
endif
|
||||||
|
|
||||||
LINT_JS_TARGETS = benchmark doc lib test tools
|
LINT_JS_TARGETS = benchmark doc lib test tools
|
||||||
LINT_JS_CMD = tools/node_modules/eslint/bin/eslint.js --cache \
|
|
||||||
--rulesdir=tools/eslint-rules --ext=.js,.mjs,.md \
|
run-lint-js = tools/node_modules/eslint/bin/eslint.js --cache \
|
||||||
$(LINT_JS_TARGETS)
|
--rulesdir=tools/eslint-rules --ext=.js,.mjs,.md $(LINT_JS_TARGETS)
|
||||||
|
run-lint-js-fix = $(run-lint-js) --fix
|
||||||
|
|
||||||
.PHONY: lint-js-fix
|
.PHONY: lint-js-fix
|
||||||
lint-js-fix:
|
lint-js-fix:
|
||||||
@if [ -x $(NODE) ]; then \
|
@$(call available-node,$(run-lint-js-fix))
|
||||||
$(NODE) $(LINT_JS_CMD) --fix; \
|
|
||||||
else \
|
|
||||||
node $(LINT_JS_CMD) --fix; \
|
|
||||||
fi
|
|
||||||
|
|
||||||
.PHONY: lint-js
|
.PHONY: lint-js
|
||||||
# Note that on the CI `lint-js-ci` is run instead.
|
# Note that on the CI `lint-js-ci` is run instead.
|
||||||
# Lints the JavaScript code with eslint.
|
# Lints the JavaScript code with eslint.
|
||||||
lint-js:
|
lint-js:
|
||||||
@echo "Running JS linter..."
|
@echo "Running JS linter..."
|
||||||
@if [ -x $(NODE) ]; then \
|
@$(call available-node,$(run-lint-js))
|
||||||
$(NODE) $(LINT_JS_CMD); \
|
|
||||||
else \
|
|
||||||
node $(LINT_JS_CMD); \
|
|
||||||
fi
|
|
||||||
|
|
||||||
jslint: lint-js
|
jslint: lint-js
|
||||||
@echo "Please use lint-js instead of jslint"
|
@echo "Please use lint-js instead of jslint"
|
||||||
|
|
||||||
|
run-lint-js-ci = tools/lint-js.js $(PARALLEL_ARGS) -f tap -o test-eslint.tap \
|
||||||
|
$(LINT_JS_TARGETS)
|
||||||
|
|
||||||
.PHONY: lint-js-ci
|
.PHONY: lint-js-ci
|
||||||
# On the CI the output is emitted in the TAP format.
|
# On the CI the output is emitted in the TAP format.
|
||||||
lint-js-ci:
|
lint-js-ci:
|
||||||
@echo "Running JS linter..."
|
@echo "Running JS linter..."
|
||||||
@if [ -x $(NODE) ]; then \
|
@$(call available-node,$(run-lint-js-ci))
|
||||||
$(NODE) tools/lint-js.js $(PARALLEL_ARGS) -f tap -o test-eslint.tap \
|
|
||||||
$(LINT_JS_TARGETS); \
|
|
||||||
else \
|
|
||||||
node tools/lint-js.js $(PARALLEL_ARGS) -f tap -o test-eslint.tap \
|
|
||||||
$(LINT_JS_TARGETS); \
|
|
||||||
fi
|
|
||||||
|
|
||||||
jslint-ci: lint-js-ci
|
jslint-ci: lint-js-ci
|
||||||
@echo "Please use lint-js-ci instead of jslint-ci"
|
@echo "Please use lint-js-ci instead of jslint-ci"
|
||||||
|
Loading…
x
Reference in New Issue
Block a user