Skip to content

Commit

Permalink
Validate theme.json files against the JSON Schema (#221)
Browse files Browse the repository at this point in the history
* Install AJV validator

* Add validate script

* Update validateSchema

* Add lint-staged for theme.json schemas

* Update filename to file

* Add pre-commit hook

* Fix lint-staged

* Add schema url to the error output

* Leave error schema as undefined when missing

* Add error exit code for invalid commands

* Rewrite for latest ajv

* Revert to ajv@6

* Support both draft-04 and draft-07

* Add colored JSON output

* Add variations and font collection validation

* Fix glob for running validation in lint-staged
  • Loading branch information
ajlende authored Jun 27, 2024
1 parent 70c86d7 commit 299bb8c
Show file tree
Hide file tree
Showing 5 changed files with 756 additions and 31 deletions.
4 changes: 4 additions & 0 deletions .husky/pre-commit
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#!/usr/bin/env sh
. "$(dirname -- "$0")/_/husky.sh"

npx lint-staged
3 changes: 3 additions & 0 deletions .lintstagedrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"{**/theme.json,**/styles/*.json,**/assets/fonts/*.json}": "node ./theme-utils.mjs validate-schema"
}
Loading

0 comments on commit 299bb8c

Please sign in to comment.