@@ -974,6 +974,7 @@ bench-ci: bench
974
974
lint-md-clean :
975
975
$(RM ) -r tools/remark-cli/node_modules
976
976
$(RM ) -r tools/remark-preset-lint-node/node_modules
977
+ $(RM ) tools/.* mdlintstamp
977
978
978
979
lint-md-build :
979
980
@if [ ! -d tools/remark-cli/node_modules ]; then \
@@ -983,10 +984,25 @@ lint-md-build:
983
984
echo " Markdown linter: installing remark-preset-lint-node into tools/" ; \
984
985
cd tools/remark-preset-lint-node && ../../$(NODE ) ../../$(NPM ) install; fi
985
986
986
- lint-md : lint-md-build
987
- @echo " Running Markdown linter..."
988
- $(NODE ) tools/remark-cli/cli.js -q -f \
989
- ./* .md doc src lib benchmark tools/doc/ tools/icu/
987
+ LINT_MD_TARGETS = src lib benchmark tools/doc tools/icu
988
+ LINT_MD_ROOT_DOCS := $(wildcard * .md)
989
+ LINT_MD_FILES := $(shell find $(LINT_MD_TARGETS ) -type f \
990
+ -not -path '* node_modules* ' -name '* .md') $(LINT_MD_ROOT_DOCS )
991
+ LINT_DOC_MD_FILES = $(shell ls doc/** /* .md)
992
+
993
+ tools/.docmdlintstamp : $(LINT_DOC_MD_FILES )
994
+ @echo " Running Markdown linter on docs..."
995
+ @$(NODE ) tools/remark-cli/cli.js -q -f $(LINT_DOC_MD_FILES )
996
+ @touch $@
997
+
998
+ tools/.miscmdlintstamp : $(LINT_MD_FILES )
999
+ @echo " Running Markdown linter on misc docs..."
1000
+ @$(NODE ) tools/remark-cli/cli.js -q -f $(LINT_MD_FILES )
1001
+ @touch $@
1002
+
1003
+ tools/.mdlintstamp : tools/.miscmdlintstamp tools/.docmdlintstamp
1004
+
1005
+ lint-md : | lint-md-build tools/.mdlintstamp
990
1006
991
1007
LINT_JS_TARGETS = benchmark doc lib test tools
992
1008
LINT_JS_CMD = tools/eslint/bin/eslint.js --cache \
@@ -1048,10 +1064,13 @@ LINT_CPP_FILES = $(filter-out $(LINT_CPP_EXCLUDE), $(wildcard \
1048
1064
# and the actual filename is generated so it won't match header guards
1049
1065
ADDON_DOC_LINT_FLAGS =-whitespace/ending_newline,-build/header_guard
1050
1066
1051
- lint-cpp :
1067
+ lint-cpp : tools/.cpplintstamp
1068
+
1069
+ tools/.cpplintstamp : $(LINT_CPP_FILES )
1052
1070
@echo " Running C++ linter..."
1053
- @$(PYTHON ) tools/cpplint.py $( LINT_CPP_FILES )
1071
+ @$(PYTHON ) tools/cpplint.py $?
1054
1072
@$(PYTHON ) tools/check-imports.py
1073
+ @touch $@
1055
1074
1056
1075
lint-addon-docs : test/addons/.docbuildstamp
1057
1076
@echo " Running C++ linter on addon docs..."
@@ -1087,6 +1106,10 @@ lint:
1087
1106
lint-ci : lint
1088
1107
endif
1089
1108
1109
+ lint-clean :
1110
+ $(RM ) tools/.* lintstamp
1111
+ $(RM ) .eslintcache
1112
+
1090
1113
.PHONY : $(TARBALL ) -headers \
1091
1114
all \
1092
1115
bench \
@@ -1127,6 +1150,7 @@ endif
1127
1150
install-bin \
1128
1151
install-includes \
1129
1152
lint \
1153
+ lint-clean \
1130
1154
lint-ci \
1131
1155
lint-cpp \
1132
1156
lint-js \
0 commit comments