Skip to content

Commit 6d88acd

Browse files
committed
build: add linting against EditorConfig to pre-commit hook
1 parent 0f83c70 commit 6d88acd

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

tools/git/hooks/pre-commit

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@ skip_shell="${SKIP_LINT_SHELL}"
4545
skip_typescript_declarations="${SKIP_LINT_TYPESCRIPT_DECLARATIONS}"
4646
skip_typescript_tests="${SKIP_LINT_TYPESCRIPT_TESTS}"
4747
skip_license_headers="${SKIP_LINT_LICENSE_HEADERS}"
48+
skip_editorconfig="${SKIP_LINT_EDITORCONFIG}"
4849

4950
# Determine root directory:
5051
root=$(git rev-parse --show-toplevel)
@@ -140,6 +141,15 @@ run_lint() {
140141
return 1
141142
fi
142143
fi
144+
# Lint against EditorConfig:
145+
if [[ -z "${skip_editorconfig}" ]]; then
146+
make FILES="${changed_files}" lint-editorconfig-files > /dev/null >&2
147+
if [[ "$?" -ne 0 ]]; then
148+
echo '' >&2
149+
echo 'EditorConfig lint errors.' >&2
150+
return 1
151+
fi
152+
fi
143153
# Lint Markdown files...
144154
if [[ -z "${skip_markdown}" ]]; then
145155
files=$(echo "${changed_files}" | grep '\.md$' | tr '\n' ' ')

0 commit comments

Comments
 (0)