Skip to content

Commit 30b46cf

Browse files
committed
Add support for linting TypeScript declaration files pre-commit
1 parent c6177ed commit 30b46cf

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

tools/git/hooks/pre-commit

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -234,6 +234,17 @@ run_lint() {
234234
fi
235235
fi
236236

237+
# Lint TypeScript declaration files...
238+
files=$(echo "${changed_files}" | grep '\.d\.ts$' | tr '\n' ' ')
239+
if [[ -n "${files}" ]]; then
240+
make TYPESCRIPT_DECLARATIONS_LINTER=dtslint FILES="${files}" lint-typescript-declaration-files > /dev/null >&2
241+
if [[ "$?" -ne 0 ]]; then
242+
echo '' >&2
243+
echo 'TypeScript declaration file lint errors.' >&2
244+
return 1
245+
fi
246+
fi
247+
237248
# Lint license headers...
238249
files=$(echo "${changed_files}" | tr '\n' ' ')
239250
if [[ -n "${files}" ]]; then

0 commit comments

Comments
 (0)