Skip to content

Commit

Permalink
build,tools: add lint-js-doc target
Browse files Browse the repository at this point in the history
Add a build target to lint JS code in Markdown files only.

PR-URL: #35708
Reviewed-By: Rich Trott <[email protected]>
Reviewed-By: Michael Dawson <[email protected]>
  • Loading branch information
aduh95 authored and BethGriggs committed Dec 10, 2020
1 parent ed82a06 commit 1fdcdce
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -1195,23 +1195,26 @@ tools/.mdlintstamp: $(LINT_MD_FILES)

.PHONY: lint-md
# Lints the markdown documents maintained by us in the codebase.
lint-md: | tools/.mdlintstamp
lint-md: lint-js-doc | tools/.mdlintstamp


LINT_JS_TARGETS = .eslintrc.js benchmark doc lib test tools

run-lint-js = tools/node_modules/eslint/bin/eslint.js --cache \
--report-unused-disable-directives --ext=.js,.mjs,.md $(LINT_JS_TARGETS)
--report-unused-disable-directives --ext=$(EXTENSIONS) $(LINT_JS_TARGETS)
run-lint-js-fix = $(run-lint-js) --fix

.PHONY: lint-js-fix
lint-js-fix:
@$(call available-node,$(run-lint-js-fix))

.PHONY: lint-js
.PHONY: lint-js-doc
# Note that on the CI `lint-js-ci` is run instead.
# Lints the JavaScript code with eslint.
lint-js:
lint-js: EXTENSIONS=.js,.mjs,.md
lint-js-doc: EXTENSIONS=.md
lint-js lint-js-doc:
@if [ "$(shell $(node_use_openssl))" != "true" ]; then \
echo "Skipping $@ (no crypto)"; \
else \
Expand Down

0 comments on commit 1fdcdce

Please sign in to comment.