Skip to content

Commit

Permalink
build: make lint-js independent of local node
Browse files Browse the repository at this point in the history
PR-URL: #18272
Backport-PR-URL: #19190
Reviewed-By: Gibson Fahnestock <gibfahn@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
  • Loading branch information
joyeecheung authored and BethGriggs committed Apr 10, 2018
1 parent d537f45 commit 333d7dd
Showing 1 changed file with 12 additions and 20 deletions.
32 changes: 12 additions & 20 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -1045,37 +1045,29 @@ lint-md:
endif

LINT_JS_TARGETS = benchmark doc lib test tools
LINT_JS_CMD = tools/eslint/bin/eslint.js --cache \
--rulesdir=tools/eslint-rules --ext=.js,.mjs,.md \
$(LINT_JS_TARGETS)

run-lint-js = tools/eslint/bin/eslint.js --cache \
--rulesdir=tools/eslint-rules --ext=.js,.mjs,.md $(LINT_JS_TARGETS)
run-lint-js-fix = $(run-lint-js) --fix

lint-js-fix:
@if [ -x $(NODE) ]; then \
$(NODE) $(LINT_JS_CMD) --fix; \
else \
node $(LINT_JS_CMD) --fix; \
fi
@$(call available-node,$(run-lint-js-fix))

lint-js:
@echo "Running JS linter..."
@if [ -x $(NODE) ]; then \
$(NODE) $(LINT_JS_CMD); \
else \
node $(LINT_JS_CMD); \
fi
@$(call available-node,$(run-lint-js))

jslint: lint-js
@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
# On the CI the output is emitted in the TAP format.
lint-js-ci:
@echo "Running JS linter..."
@if [ -x $(NODE) ]; then \
$(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
@$(call available-node,$(run-lint-js-ci))

jslint-ci: lint-js-ci
@echo "Please use lint-js-ci instead of jslint-ci"
Expand Down

0 comments on commit 333d7dd

Please sign in to comment.