Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 9a41ced

Browse filesBrowse files
Trottcodebytere
authored andcommitted
build: only lint markdown files that have changed (POSIX-only)
Update Makefile so that only markdown files that have changed will be linted. Currently, if one file in doc/api has changed, all files in doc/api are linted. On Windows, the lint-md task currently lints all files regardless of whether any files has changed, and that behavior is unchanged here. A further improvement is that when tools/lint-md.js is rebuilt, the timestamp file is removed so that all files are linted again. This is because rebuilding lint-md.js can introduce new rules or modify existing rules, so re-linting everything helps make sure that accidental breakage doesn't slip by unnoticed. PR-URL: #31923 Reviewed-By: Anna Henningsen <anna@addaleax.net>
1 parent 3849474 commit 9a41ced
Copy full SHA for 9a41ced

File tree

Expand file treeCollapse file tree

1 file changed

+15
-19
lines changed
Open diff view settings
Filter options
Expand file treeCollapse file tree

1 file changed

+15
-19
lines changed
Open diff view settings
Collapse file

‎Makefile‎

Copy file name to clipboardExpand all lines: Makefile
+15-19Lines changed: 15 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1165,6 +1165,7 @@ bench-addons-clean:
11651165

11661166
.PHONY: lint-md-rollup
11671167
lint-md-rollup:
1168+
$(RM) tools/.*mdlintstamp
11681169
cd tools/node-lint-md-cli-rollup && npm install
11691170
cd tools/node-lint-md-cli-rollup && npm run build-node
11701171

@@ -1177,28 +1178,23 @@ lint-md-clean:
11771178
lint-md-build:
11781179
$(warning "Deprecated no-op target 'lint-md-build'")
11791180

1180-
LINT_MD_DOC_FILES = $(shell find doc -type f -name '*.md')
1181-
run-lint-doc-md = tools/lint-md.js -q -f $(LINT_MD_DOC_FILES)
1182-
# Lint all changed markdown files under doc/
1183-
tools/.docmdlintstamp: $(LINT_MD_DOC_FILES)
1184-
@echo "Running Markdown linter on docs..."
1185-
@$(call available-node,$(run-lint-doc-md))
1186-
@touch $@
1181+
ifeq ("$(wildcard tools/.mdlintstamp)","")
1182+
LINT_MD_NEWER =
1183+
else
1184+
LINT_MD_NEWER = -newer tools/.mdlintstamp
1185+
endif
11871186

1188-
LINT_MD_TARGETS = src lib benchmark test tools/doc tools/icu
1189-
LINT_MD_ROOT_DOCS := $(wildcard *.md)
1190-
LINT_MD_MISC_FILES := $(shell find $(LINT_MD_TARGETS) -type f \
1191-
! -path '*node_modules*' ! -path 'test/fixtures/*' -name '*.md') \
1192-
$(LINT_MD_ROOT_DOCS)
1193-
run-lint-misc-md = tools/lint-md.js -q -f $(LINT_MD_MISC_FILES)
1194-
# Lint other changed markdown files maintained by us
1195-
tools/.miscmdlintstamp: $(LINT_MD_MISC_FILES)
1196-
@echo "Running Markdown linter on misc docs..."
1197-
@$(call available-node,$(run-lint-misc-md))
1187+
LINT_MD_TARGETS = doc src lib benchmark test tools/doc tools/icu $(wildcard *.md)
1188+
LINT_MD_FILES = $(shell find $(LINT_MD_TARGETS) -type f \
1189+
! -path '*node_modules*' ! -path 'test/fixtures/*' -name '*.md' \
1190+
$(LINT_MD_NEWER))
1191+
run-lint-md = tools/lint-md.js -q -f --no-stdout $(LINT_MD_FILES)
1192+
# Lint all changed markdown files maintained by us
1193+
tools/.mdlintstamp: $(LINT_MD_FILES)
1194+
@echo "Running Markdown linter..."
1195+
@$(call available-node,$(run-lint-md))
11981196
@touch $@
11991197

1200-
tools/.mdlintstamp: tools/.miscmdlintstamp tools/.docmdlintstamp
1201-
12021198
.PHONY: lint-md
12031199
# Lints the markdown documents maintained by us in the codebase.
12041200
lint-md: | tools/.mdlintstamp

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.