Skip to content

Commit abc51e4

Browse files
committed
Add support for linting REPL help files pre-commit
1 parent 28c1ee2 commit abc51e4

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

tools/git/hooks/pre-commit

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,9 @@ lint_filenames="${root}/lib/node_modules/@stdlib/_tools/lint/filenames/bin/cli"
3434
# Define the path to a utility for linting package.json files:
3535
lint_package_json="${root}/lib/node_modules/@stdlib/_tools/lint/pkg-json/bin/cli"
3636

37+
# Define the path to a utility for linting REPL help files:
38+
lint_repl_help="${root}/lib/node_modules/@stdlib/_tools/lint/repl-help/bin/cli"
39+
3740
# Define the path to ESLint configuration file for linting examples:
3841
eslint_examples_conf="${root}/etc/eslint/.eslintrc.examples.js"
3942

@@ -120,6 +123,17 @@ run_lint() {
120123
fi
121124
fi
122125

126+
# Lint REPL help files...
127+
files=$(echo "${changed_files}" | grep 'repl\.txt$' )
128+
if [[ -n "${files}" ]]; then
129+
echo "${files}" | "${lint_repl_help}" >&2
130+
if [[ "$?" -ne 0 ]]; then
131+
echo '' >&2
132+
echo 'REPL help lint errors.' >&2
133+
return 1
134+
fi
135+
fi
136+
123137
# Lint JavaScript source files...
124138
files=$(echo "${changed_files}" | grep '\.js$' | grep -v -e '/examples' -e '/test' -e '/benchmark' -e '^dist/' | tr '\n' ' ')
125139
if [[ -n "${files}" ]]; then

0 commit comments

Comments
 (0)