feat(lint-json): Move the JSON validation code to its own package#4124
Open
feat(lint-json): Move the JSON validation code to its own package#4124
Conversation
tido64
approved these changes
May 6, 2026
Member
tido64
left a comment
There was a problem hiding this comment.
In a future iteration, we should provide a way to say "one of these fields must be set". This is required to replace our tsconfig.json validator.
Member
There was a problem hiding this comment.
Are we not publishing this package yet?
| if (!parent) { | ||
| context.error(valueMessage(path, value, undefined)); | ||
| } else { | ||
| const currentValue = parent[path[path.length - 1]]; |
Member
There was a problem hiding this comment.
The current index can be stored for reuse further down
Suggested change
| const currentValue = parent[path[path.length - 1]]; | |
| const index = path[path.length - 1]; | |
| const currentValue = parent[index]; |
Comment on lines
+22
to
+23
| "main": "lib/index.js", | ||
| "types": "lib/index.d.ts", |
Member
There was a problem hiding this comment.
Can you also provide an exports map?
tido64
reviewed
May 6, 2026
| */ | ||
| export function createJSONValidator( | ||
| jsonPath: string, | ||
| json: Record<string, JSONValue> | undefined, |
Member
There was a problem hiding this comment.
Can we replace all instances of Record<string, JSONValue>?
Suggested change
| json: Record<string, JSONValue> | undefined, | |
| json: JSONObject | undefined, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
This creates a new package for json linting with the validation code from the tools-packages PR. This should also address the PR feedback in the other PR.
The proto blocking I left as an exception as that is an error in the test code not a random user error and I prefer it to silent failures.
Test plan
Automated tests