Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork2.8k
feat: fork json schema types for better compat with ESLint rule validation#6963
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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
Uh oh!
There was an error while loading.Please reload this page.
Conversation
Thanks for the PR,@bradzacher! typescript-eslint is a 100% community driven project, and we are incredibly grateful that you are contributing to that community. The core maintainers work on this in their personal time, so please understand that it may not be possible for them to review your work immediately. Thanks again! 🙏Please, if you or your company is finding typescript-eslint valuable, help us sustain the project by sponsoring it transparently onhttps://opencollective.com/typescript-eslint. |
netlifybot commentedApr 27, 2023 • edited
Loading Uh oh!
There was an error while loading.Please reload this page.
edited
Uh oh!
There was an error while loading.Please reload this page.
✅ Deploy Preview fortypescript-eslint ready!
To edit notification comments on pull requests, go to yourNetlify site settings. |
nx-cloudbot commentedApr 27, 2023 • edited
Loading Uh oh!
There was an error while loading.Please reload this page.
edited
Uh oh!
There was an error while loading.Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
🔥 looks great! I wonder if we could export this as our own types so other ESLint projects (maybe ESLint itself, if they want a devDependency to help with types) could use it? Given that it's already exported by@typescript-eslint/utils
I think it's fine to stay as-is.
Uh oh!
There was an error while loading.Please reload this page.
@JoshuaKGoldberg /@armano2 I just pushed a new commit (178cf35) that further strictifies the types to a discriminated union.
The downside to doing this is that you can be significantly less flexible in how you write schemas. For reference, you now must always define a If you guys think it's better to just stick to the spec and be loose - more than happy to revert the schema changes. It's really hard to judge the impact of such a change, given that we don't know how all our consumers define schemas - but I'd think they're not too crazy? |
178cf35
to08bceb7
Compare08bceb7
to24a27af
CompareOof this hurts me though 😞. It seems like it'd be very annoying to have to write out the
Maybe there's a happy medium we can go for? Only require |
The flip side is that the explicit |
codecovbot commentedJun 17, 2023 • edited
Loading Uh oh!
There was an error while loading.Please reload this page.
edited
Uh oh!
There was an error while loading.Please reload this page.
Codecov Report
Additional details and impacted files@@ Coverage Diff @@## v6 #6963 +/- ##==========================================+ Coverage 87.50% 87.61% +0.10%========================================== Files 376 375 -1 Lines 12937 12923 -14 Branches 3821 3821 ==========================================+ Hits 11321 11322 +1+ Misses 1231 1216 -15 Partials 385 385
Flags with carried forward coverage won't be shown.Click here to find out more.
|
BREAKING CHANGE:
@typescript-eslint/utils
now only exports the v4 JSON schema types - the only version ESLint validates rules with.Removed the unsafe
[string]: any
indexer from theJSONSchema4
type to help ensure invalid properties aren't used.This was something I noticed whilst working on our schema enhancements - we re-exported all these types that were mostly useless for lint rules because ESLint is hard-locked to v4 of the schema. So I decided to remove those newer schema types from the export.
I was going to leave it there, but then I remember that I had added a local patch that strictified the types by removing the unsafe indexer (which helped us catch bugs in our schemas). So I decided we can just fork the types entirely and apply my patch so all consumers get that same benefit.