From 0c6143656ce992accd8bedbf20c0ea25d3679a67 Mon Sep 17 00:00:00 2001 From: Antoine du Hamel Date: Mon, 19 Oct 2020 12:44:48 +0200 Subject: [PATCH 1/3] build,tools: add lint-js-doc target Add a build target to lint JS code in Markdown files only. PR-URL: https://github.com/nodejs/node/pull/35708 Reviewed-By: Rich Trott Reviewed-By: Michael Dawson --- Makefile | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/Makefile b/Makefile index 08386412bf0e1c..4f397c82f65bc5 100644 --- a/Makefile +++ b/Makefile @@ -1194,13 +1194,13 @@ 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 @@ -1208,9 +1208,12 @@ 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 \ From b90e1353be02d2cc097d478040e399c52d3db0f1 Mon Sep 17 00:00:00 2001 From: Antoine du Hamel Date: Mon, 19 Oct 2020 14:34:27 +0200 Subject: [PATCH 2/3] build: add vcbuilt test-doc target PR-URL: https://github.com/nodejs/node/pull/35708 Reviewed-By: Rich Trott Reviewed-By: Michael Dawson --- vcbuild.bat | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/vcbuild.bat b/vcbuild.bat index 527de7ee39664e..516726a6697f14 100644 --- a/vcbuild.bat +++ b/vcbuild.bat @@ -99,6 +99,7 @@ if /i "%1"=="build-addons" set build_addons=1&goto arg-ok if /i "%1"=="build-js-native-api-tests" set build_js_native_api_tests=1&goto arg-ok if /i "%1"=="build-node-api-tests" set build_node_api_tests=1&goto arg-ok if /i "%1"=="test-addons" set test_args=%test_args% addons&set build_addons=1&goto arg-ok +if /i "%1"=="test-doc" set test_args=%test_args% %CI_DOC%&set doc=1&&set lint_js=1&set lint_md=1&goto arg-ok if /i "%1"=="test-js-native-api" set test_args=%test_args% js-native-api&set build_js_native_api_tests=1&goto arg-ok if /i "%1"=="test-node-api" set test_args=%test_args% node-api&set build_node_api_tests=1&goto arg-ok if /i "%1"=="test-benchmark" set test_args=%test_args% benchmark&goto arg-ok @@ -683,7 +684,7 @@ set exit_code=1 goto exit :help -echo vcbuild.bat [debug/release] [msi] [doc] [test/test-all/test-addons/test-js-native-api/test-node-api/test-benchmark/test-internet/test-pummel/test-simple/test-message/test-tick-processor/test-known-issues/test-node-inspect/test-check-deopts/test-npm/test-async-hooks/test-v8/test-v8-intl/test-v8-benchmarks/test-v8-all] [ignore-flaky] [static/dll] [noprojgen] [projgen] [small-icu/full-icu/without-intl] [nobuild] [nosnapshot] [noetw] [ltcg] [licensetf] [sign] [ia32/x86/x64/arm64] [vs2019] [download-all] [lint/lint-ci/lint-js/lint-md] [lint-md-build] [package] [build-release] [upload] [no-NODE-OPTIONS] [link-module path-to-module] [debug-http2] [debug-nghttp2] [clean] [cctest] [no-cctest] [openssl-no-asm] [experimental-quic] +echo vcbuild.bat [debug/release] [msi] [doc] [test/test-all/test-addons/test-doc/test-js-native-api/test-node-api/test-benchmark/test-internet/test-pummel/test-simple/test-message/test-tick-processor/test-known-issues/test-node-inspect/test-check-deopts/test-npm/test-async-hooks/test-v8/test-v8-intl/test-v8-benchmarks/test-v8-all] [ignore-flaky] [static/dll] [noprojgen] [projgen] [small-icu/full-icu/without-intl] [nobuild] [nosnapshot] [noetw] [ltcg] [licensetf] [sign] [ia32/x86/x64/arm64] [vs2019] [download-all] [lint/lint-ci/lint-js/lint-md] [lint-md-build] [package] [build-release] [upload] [no-NODE-OPTIONS] [link-module path-to-module] [debug-http2] [debug-nghttp2] [clean] [cctest] [no-cctest] [openssl-no-asm] [experimental-quic] echo Examples: echo vcbuild.bat : builds release build echo vcbuild.bat debug : builds debug build From 30e9fab8667746115f0076617469e866d564f053 Mon Sep 17 00:00:00 2001 From: Antoine du Hamel Date: Mon, 19 Oct 2020 12:58:55 +0200 Subject: [PATCH 3/3] doc: recommend test-doc instead of lint-md The documentation style guide used to recommend checking changes in the docs by running `make lint-md`. This leaves out some important checks which are contained in the `test-doc` build target. This commit also replaces `lint` by `lint-md` in the list of `test-doc`'s prerequisites. PR-URL: https://github.com/nodejs/node/pull/35708 Reviewed-By: Rich Trott Reviewed-By: Michael Dawson --- Makefile | 2 +- doc/guides/doc-style-guide.md | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Makefile b/Makefile index 4f397c82f65bc5..9883e35582f95e 100644 --- a/Makefile +++ b/Makefile @@ -580,7 +580,7 @@ test-hash-seed: all $(NODE) test/pummel/test-hash-seed.js .PHONY: test-doc -test-doc: doc-only lint ## Builds, lints, and verifies the docs. +test-doc: doc-only lint-md ## Builds, lints, and verifies the docs. @if [ "$(shell $(node_use_openssl))" != "true" ]; then \ echo "Skipping test-doc (no crypto)"; \ else \ diff --git a/doc/guides/doc-style-guide.md b/doc/guides/doc-style-guide.md index b44206ff9e2791..ee039e9e8363eb 100644 --- a/doc/guides/doc-style-guide.md +++ b/doc/guides/doc-style-guide.md @@ -16,7 +16,7 @@ this guide. * Documents should be word-wrapped at 80 characters. * `.editorconfig` describes the preferred formatting. * A [plugin][] is available for some editors to apply these rules. -* Check changes to documentation with `make lint-md`. +* Check changes to documentation with `make test-doc -j` or `vcbuild test-doc`. * [Use US spelling][]. * [Use serial commas][]. * Avoid first-person pronouns (_I_, _we_).