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(type-utils): ensure external sources don't match for theFileSpecifier#6866

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

Conversation

RebeccaStevens
Copy link
Contributor

PR Checklist

Overview

This is an alternative to#6860 (closes#6860).

@typescript-eslint
Copy link
Contributor

Thanks for the PR,@RebeccaStevens!

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.

@netlify
Copy link

netlifybot commentedApr 8, 2023
edited
Loading

Deploy Preview fortypescript-eslint ready!

NameLink
🔨 Latest commit6f3bdbf
🔍 Latest deploy loghttps://app.netlify.com/sites/typescript-eslint/deploys/64340e2515ccf900080f4b86
😎 Deploy Previewhttps://deploy-preview-6866--typescript-eslint.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

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

@RebeccaStevens
Copy link
ContributorAuthor

@marekdedic How's this approach look to you?

@nx-cloud
Copy link

nx-cloudbot commentedApr 8, 2023
edited
Loading

☁️ Nx Cloud Report

CI is running/has finished running commands for commit6f3bdbf. As they complete they will appear below. Click to see the status, the terminal output, and the build insights.

📂 See all runs for this branch


✅ Successfully ran 30 targets

Sent with 💌 fromNxCloud.

@codecov
Copy link

codecovbot commentedApr 8, 2023
edited
Loading

Codecov Report

Merging#6866 (6f3bdbf) intov6 (a35a2bb) willdecrease coverage by0.02%.
The diff coverage is70.00%.

Additional details and impacted files
@@            Coverage Diff             @@##               v6    #6866      +/-   ##==========================================- Coverage   87.46%   87.45%   -0.02%==========================================  Files         374      374                Lines       12879    12892      +13       Branches     3811     3813       +2     ==========================================+ Hits        11265    11275      +10- Misses       1229     1231       +2- Partials      385      386       +1
FlagCoverage Δ
unittest87.45% <70.00%> (-0.02%)⬇️

Flags with carried forward coverage won't be shown.Click here to find out more.

Impacted FilesCoverage Δ
packages/type-utils/src/TypeOrValueSpecifier.ts83.33% <70.00%> (-5.96%)⬇️

... and2 files with indirect coverage changes

@marekdedic
Copy link
Contributor

marekdedic commentedApr 8, 2023
edited
Loading

Hi, thanks for the alternative proposal!

Reading quickly through this, I see this mainly builds on thets.getEffectiveTypeRoots() function, which I didn't know before - quick googling led mehere - I understand this description so that this would exclude all types declared in some@types/... package - however, if I understand it correctly, the type rootsdon't include folders for packages that ship their own types - so for example types from thevue package would still be found. Is that correct or am I missing something?

@marekdedic
Copy link
Contributor

Oh actually, I seeisSourceFileFromExternalLibrary there as well (previously thought that was thedefault library instead of external...) - reading the source code of that, I am confused - wouldn't this function alone do exactly what we want it to do - exclude stuff fromnode_modules? Or does that not include@types/... packages - then I'd understand the type roots bit :D

Sorry, if this does what I think it does then it's great, but as you see, I'm not that well versed with TS internals :/

@RebeccaStevens
Copy link
ContributorAuthor

RebeccaStevens commentedApr 8, 2023
edited
Loading

This approach actually relies more onprogram.isSourceFileFromExternalLibrary(declaration).

ts.getEffectiveTypeRoots() is a little extra to support custom type root paths. The function will return[/absolute/path/to/project/node_modules/@types] unlesstypeRoots is specified in thetsconfig.json file.

@marekdedic
Copy link
Contributor

Hmm, yes, that's what I thought in my second comment, sorry for the confusion. I am still not 100% why the type roots are needed - ifprogram.isSourceFileFromExternalLibrary(declaration) supports customnode_modules location, then typeRoots wouldn't be needed, right? And if it does, then this will be a half-measure -@types/ packages will be excluded, regular packages wouldn't, right?

Anyway, apart from this, LGTM.

@marekdedic
Copy link
Contributor

Could you please add a test for this?

@bradzacherbradzacher added the bugSomething isn't working labelApr 10, 2023
Copy link
Member

@JoshuaKGoldbergJoshuaKGoldberg left a comment
edited
Loading

Choose a reason for hiding this comment

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

Test coverage please? I see a missing line 😄

@JoshuaKGoldbergJoshuaKGoldberg added the awaiting responseIssues waiting for a reply from the OP or another party labelApr 16, 2023
@marekdedic
Copy link
Contributor

Oh, and just for the original question - IMHO, I prefer this to the alternative PR#6860

@JoshuaKGoldbergJoshuaKGoldberg deleted the branchtypescript-eslint:mainJuly 10, 2023 17:52
@JoshuaKGoldberg
Copy link
Member

JoshuaKGoldberg commentedJul 10, 2023
edited
Loading

This was unintentionally auto-closed when we merged thev6 branch 🙃 it'll berecreated reopened.

@JoshuaKGoldbergJoshuaKGoldberg changed the base branch fromv6 tomainJuly 10, 2023 21:11
@JoshuaKGoldberg
Copy link
Member

👋 Hey@RebeccaStevens! Just checking in, is this still something you have time for? No worries if not - I just don't want to leave it hanging.

@JoshuaKGoldbergJoshuaKGoldberg added the stalePRs or Issues that are at risk of being or have been closed due to inactivity for a prolonged period labelOct 17, 2023
@JoshuaKGoldberg
Copy link
Member

Closing this PR as it's been stale for a while without activity. Feel free to reopen@RebeccaStevens if you have time - but no worries if not!

If anybody wants to drive it forward, please do post your own PR - and if you use this as a start, consider adding a co-author at the end of your PR description. Thanks! 😊

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

@JoshuaKGoldbergJoshuaKGoldbergJoshuaKGoldberg requested changes

Assignees
No one assigned
Labels
awaiting responseIssues waiting for a reply from the OP or another partybugSomething isn't workingstalePRs or Issues that are at risk of being or have been closed due to inactivity for a prolonged period
Projects
None yet
Milestone
No milestone
Development

Successfully merging this pull request may close these issues.

Bug:typeMatchesSpecifierFileSpecifier checks in node modules
4 participants
@RebeccaStevens@marekdedic@JoshuaKGoldberg@bradzacher

[8]ページ先頭

©2009-2025 Movatter.jp