Skip to content

Commit

Permalink
ci(jsonlint): add JSON linting (#838)
Browse files Browse the repository at this point in the history
Closes #836
  • Loading branch information
tiborsimko committed Nov 14, 2024
1 parent 4b8edd0 commit 8f4c9ff
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 0 deletions.
14 changes: 14 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -232,3 +232,17 @@ jobs:
run: |
sudo apt-get install shfmt
./run-tests.sh --check-shfmt
lint-jsonlint:
runs-on: ubuntu-24.04
steps:
- name: Checkout
uses: actions/checkout@v4

- name: Setup Node
uses: actions/setup-node@v4

- name: Lint JSON files
run: |
npm install jsonlint --global
./run-tests.sh --check-jsonlint
6 changes: 6 additions & 0 deletions run-tests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,10 @@ check_shfmt() {
shfmt -d .
}

check_jsonlint() {
find . -name "*.json" -exec jsonlint -q {} \+
}

check_all() {
check_commitlint
check_shellcheck
Expand All @@ -105,6 +109,7 @@ check_all() {
check_markdownlint
check_prettier
check_shfmt
check_jsonlint
}

if [ $# -eq 0 ]; then
Expand All @@ -127,5 +132,6 @@ case $arg in
--check-markdownlint) check_markdownlint ;;
--check-prettier) check_prettier ;;
--check-shfmt) check_shfmt ;;
--check-jsonlint) check_jsonlint ;;
*) echo "[ERROR] Invalid argument '$arg'. Exiting." && exit 1 ;;
esac

0 comments on commit 8f4c9ff

Please sign in to comment.