Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork2.8k
fix(utils): add missing fields to flat config types#7933
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 commentedNov 15, 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 configuration. |
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.
TIL "stringly"
karlhorky commentedNov 15, 2023
Nice, thanks! I'll check this out when this lands in |
JoshuaKGoldberg commentedNov 15, 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.
For visibility, we publish canary builds on every commit to (not saying you need to try them - just that if anybody urgently wants this ASAP, the canaries are an option 😄) |
karlhorky commentedNov 16, 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.
Ok thanks, I decided to try out the canary / alpha releases and upgraded to Notes: The reason I'm still casting like this is that I want a runtime error if // eslint-disable-next-line rest-spread-spacing -- Allow JSDoc casting.../** @type{Exclude<Exclude<import('@typescript-eslint/utils/ts-eslint').FlatConfig.Plugin['configs'],undefined>[string],undefined>}*/(/**@type {Exclude<import('@typescript-eslint/utils/ts-eslint').FlatConfig.Plugin['configs'], undefined>} */(jsxA11y.configs).recommended).rules, An alternative that I used lower down (to throw a more helpful error) is to first assign the potentially- constfirstConfig=config[0];if(!firstConfig||!firstConfig.plugins||!firstConfig.rules){thrownewError(`SafeQL configuration failedThe UpLeveled ESLint config object does not contain all of the properties: .plugins, .rules`,);}firstConfig.plugins['@ts-safeql']=awaitimport('@ts-safeql/eslint-plugin');firstConfig.rules['@ts-safeql/check-sql']=[// ... |
@karlhorky FYI you're doing things a little incorrectly here! If you have a look at#7935 you can see how I typed things. We can probably expose better types here though to make this easier. I.e. We should probably expose a type like You also should be using the compat tooling instead of deeply pulling apart the config. I still don't know the "best" way to do this style of "extend multiple configs for a given set of files. I asked on E ESLint discord (https://discord.com/channels/688543509199716507/1174310123791990866) but I got ignored... Might need try pinging again. |
karlhorky commentedNov 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.
Yeah, I'm aware I'm faking the types a bit in some places (this is to avoid having to know / keep updated on which plugins expose which type of config). Maybe I should open PRs to add types to each of the plugins I use... 🤔 so that I don't need to maintain them in my project - and then all consumers will have types. This ESLint config is pretty runtime-tested as is (in many student projects), so it's mostly just making the type system happy and reducing the faking to the least amount possible. But I will for sure watch all new things including#7935 and use anything to make it simpler! |
Uh oh!
There was an error while loading.Please reload this page.
Overview
This adds the missing fields from#7273
cc@karlhorky