Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

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

Merged
bradzacher merged 1 commit intomainfromupdate-flat-config-types
Nov 15, 2023

Conversation

bradzacher
Copy link
Member

@bradzacherbradzacher commentedNov 15, 2023
edited
Loading

Overview

This adds the missing fields from#7273

cc@karlhorky

TheHuman2022 reacted with thumbs up emojikarlhorky reacted with heart emojikarlhorky reacted with eyes emoji
@bradzacherbradzacher added the bugSomething isn't working labelNov 15, 2023
@typescript-eslint
Copy link
Contributor

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.

@netlifyNetlify
Copy link

netlifybot commentedNov 15, 2023
edited
Loading

Deploy Preview fortypescript-eslint ready!

NameLink
🔨 Latest commit79500fe
🔍 Latest deploy loghttps://app.netlify.com/sites/typescript-eslint/deploys/655421581acdee00078934f2
😎 Deploy Previewhttps://deploy-preview-7933--typescript-eslint.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.
Lighthouse
Lighthouse
1 paths audited
Performance: 90 (🔴 down 8 from production)
Accessibility: 100 (no change from production)
Best Practices: 92 (no change from production)
SEO: 98 (no change from production)
PWA: 80 (no change from production)
View the detailed breakdown and full score reports

To edit notification comments on pull requests, go to yourNetlify site configuration.

Copy link
Member

@JoshuaKGoldbergJoshuaKGoldberg left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

TIL "stringly"

TheHuman2022 reacted with thumbs up emoji
@bradzacherbradzacher merged commit533861a intomainNov 15, 2023
@bradzacherbradzacher deleted the update-flat-config-types branchNovember 15, 2023 02:13
@karlhorky
Copy link

Nice, thanks! I'll check this out when this lands in@typescript-eslint/utils@6.11.1 or@typescript-eslint/utils@6.12.0

TheHuman2022 reacted with thumbs up emoji

@JoshuaKGoldberg
Copy link
Member

JoshuaKGoldberg commentedNov 15, 2023
edited
Loading

For visibility, we publish canary builds on every commit tomain:https://main--typescript-eslint.netlify.app/users/releases#canary.

(not saying you need to try them - just that if anybody urgently wants this ASAP, the canaries are an option 😄)

TheHuman2022 reacted with thumbs up emojikarlhorky and TheHuman2022 reacted with heart emoji

@karlhorky
Copy link

karlhorky commentedNov 16, 2023
edited
Loading

Ok thanks, I decided to try out the canary / alpha releases and upgraded to@typescript-eslint/*@6.11.1-alpha.20 here, and simplified some types:

upleveled/eslint-config-upleveled@bb2a860#diff-e727e4bdf3657fd1d798edcd6b099d6e092f8573cba266154583a746bba0f346

Notes:

The reason I'm still casting like this is that I want a runtime error ifeslint-plugin-jsx-a11y stops distributingconfigs.recommended.rules.

// 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-undefined config object to a variable and then do some manual testing on it and throw if it's not the right shape, which will narrow the type and allow usage without casting:

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']=[// ...

@bradzacher
Copy link
MemberAuthor

@karlhorky FYI you're doing things a little incorrectly here!
Specifically the type of the plugin isn't aFlatConfig.Plugin because the plugin doesn't support flat configs yet.

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 likeFlatConfig.ClassicPlugin<T> whereT can be used to define the shared configs.

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 reacted with thumbs up emoji

@karlhorky
Copy link

karlhorky commentedNov 17, 2023
edited
Loading

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!

@github-actionsgithub-actionsbot locked asresolvedand limited conversation to collaboratorsNov 25, 2023
Sign up for freeto subscribe to this conversation on GitHub. Already have an account?Sign in.
Reviewers

@JoshuaKGoldbergJoshuaKGoldbergJoshuaKGoldberg approved these changes

Assignees
No one assigned
Labels
bugSomething isn't working
Projects
None yet
Milestone
No milestone
Development

Successfully merging this pull request may close these issues.

3 participants
@bradzacher@karlhorky@JoshuaKGoldberg

[8]ページ先頭

©2009-2025 Movatter.jp