Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(jsonschema): add $schema property #942

Merged
merged 3 commits into from
Feb 21, 2025
Merged

Conversation

mst-mkt
Copy link
Contributor

@mst-mkt mst-mkt commented Jan 30, 2025

⚡ Summary

In the current jsonschema, specifying $schema results in a warning as shown in the following image.

This is because "additionalProperties": false and there is no $schema in properties.

image

To resolve this, the $schema property was added.
This approach has been observed in other projects as well, such as @biomejs/biome.

    "properties": {
+     "$schema": {
+       "type": "string"
+     },
    },

I am not very familiar with Go, so I would appreciate any corrections or suggestions.

☑️ Checklist

  • Check locally
  • Add tests
  • Add documentation

@mrexox
Copy link
Member

mrexox commented Feb 21, 2025

Hey! Could you help me understand how does it biome use the $schema field? And are you adding this field to lefthook.json? Currently lefthook does not handle $schema parameter internally

@mst-mkt
Copy link
Contributor Author

mst-mkt commented Feb 21, 2025

@mrexox Thank you for your comment

Could you help me understand how does Biome use the $schema field?

The $schema field is not specifically used by Biome itself. It's a standard JSON Schema keyword that enables editor support in tools like VSCode, providing features such as auto-completion and validation when editing configuration files. I mentioned Biome only as an example of a project that includes $schema in its schema definition.

And are you adding this field to lefthook.json? Currently lefthook does not handle $schema parameter internally

Yes, I'm adding the $schema property to improve editor support, not for Lefthook's internal use. While Lefthook itself doesn't process this field, having it in the schema enables better tooling support in editors like VSCode and JetBrains IDEs.

information about specifying $schema, you can refer to:


Also, I made a mistake that caused a lint error, which I corrected.

@mrexox mrexox merged commit a4ae15c into evilmartians:master Feb 21, 2025
20 checks passed
@mrexox
Copy link
Member

mrexox commented Feb 21, 2025

Thank you for bringing this PR!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants