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

feat(eslint-plugin): [no-unused-var] handle implicit exports in declaration files#8611

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

jakebailey
Copy link
Collaborator

PR Checklist

Overview

This modifies the unused variable analysis to ignore declarations that are "implicitly" exported. Roughly, this means declaration files which do not contain any exports, recursively into namespaces, excludingexport import ... = ... which doesn't count.

This PR is not yet complete; I'm missing:

  • Look forexport {} blocks, including empty ones (which probably don't show up in scope)
  • Check other ambient contexts like globals (need to query for that, and figure out the rules)
  • Consider whether I should actually move this into the rule and do things like those which useambientDeclarationSelector
  • Consider whether this analysis can actually replaceambientDeclarationSelector entirely (if not vice versa)

I'm mainly having trouble at the moment debugging a single test; addingonly to the test doesn't seem to really work and one of my tests fails for a reason I haven't figured out yet.

That and my continued issues withnx, where it always tells me that the tests pass, so I have to disable it, which can only be done via the checked in config file☹️

JoshuaKGoldberg reacted with heart emoji
@typescript-eslint
Copy link
Contributor

Thanks for the PR,@jakebailey!

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 commentedMar 6, 2024
edited
Loading

Deploy Preview fortypescript-eslint ready!

NameLink
🔨 Latest commitf9f18c5
🔍 Latest deploy loghttps://app.netlify.com/sites/typescript-eslint/deploys/65e8f850e46f9400093786ac
😎 Deploy Previewhttps://deploy-preview-8611--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: 99 (🟢 up 9 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.

@nx-cloudNx Cloud
Copy link

nx-cloudbot commentedMar 6, 2024
edited
Loading

☁️ Nx Cloud Report

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

📂 See all runs for this CI Pipeline Execution


🟥 Failed Commands
nx test eslint-plugin --coverage=false
✅ Successfully ran 28 targets

Sent with 💌 fromNxCloud.

@jakebaileyjakebailey changed the titlefeat(eslint-plugin): [no-unused-var] Handle implicit exports in declaration filesfeat(eslint-plugin): [no-unused-var] handle implicit exports in declaration filesMar 6, 2024
}

for (const variable of scope.variables) {
if (isExported(variable) && !isExportImportEquals(variable)) {
Copy link
Member

Choose a reason for hiding this comment

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

declarenamespaceFoo{constx=1;exportconsty=3;}Foo.x;Foo.y;

Theexport doesn't always restrict other implicit, ambient exports, right?

Copy link
CollaboratorAuthor

Choose a reason for hiding this comment

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

Hm, the rules for this are super annoying. What I have currently may just be true only for declaration files, but "ambient" ones with declare (in ts files only?) may have different rules?

Copy link
Member

@bradzacherbradzacherNov 10, 2024
edited
Loading

Choose a reason for hiding this comment

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

It looks like these rules apply to both ts files and dts files as well
playground? Or did I misunderstand you?

It looks likeexport = is invalid in anamespace but I think that's the only case that invalidates this logic ondeclared namespaces.

So I think this entire function can just be updated to also short-circuit onif (namespace.declare) { return namespace_has_export_equals }

Copy link
CollaboratorAuthor

Choose a reason for hiding this comment

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

There are more issues than just this one IIRC; I've been so busy with other stuff that I haven't been able to sit down and actually fix this PR, sorry.

I'm also not 100% sure what works and doesn't work in the playground when it comes to d.ts files; not really something we often play with; I've been meaning to figure out something better for testing this

If it's bugging you all to stay open, I can close it, though if someone else attempts it too I'd love to review it and double check everything (but I don't think anyone's working on it besides me)

Copy link
Member

Choose a reason for hiding this comment

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

Nah Josh just pinged me cos I didn't respond :P
No rush at all.

@JoshuaKGoldberg
Copy link
Member

👋 just checking in@jakebailey, are you waiting on us for anything?

@JoshuaKGoldbergJoshuaKGoldberg added awaiting responseIssues waiting for a reply from the OP or another party stalePRs or Issues that are at risk of being or have been closed due to inactivity for a prolonged period labelsJun 2, 2024
@jakebailey
Copy link
CollaboratorAuthor

I honestly don't remember, I think I was blocked on "man the rules are complicated to implement" and finding time to figure them out to try again here.

@JoshuaKGoldberg
Copy link
Member

👍 should we close this out then? (do you know if you'll have time + priority soon?)

@jakebailey
Copy link
CollaboratorAuthor

5.5 just closed so I'll probably have more time now, but I guess I don't know why closing it is helpful... Only been 2 months and I only stopped because I had some very high priority work elsewhere.

JoshuaKGoldberg reacted with thumbs up emoji

@jakebailey
Copy link
CollaboratorAuthor

Or course if someone else wants to attempt it, be my guest, but I do want to see this fixed so I can run it on DT.

JoshuaKGoldberg reacted with thumbs up emoji

@JoshuaKGoldberg
Copy link
Member

Staying open it is!

We're just going through the backlog & trying to trim it down as much as we reasonably can.

@JoshuaKGoldbergJoshuaKGoldberg removed the stalePRs or Issues that are at risk of being or have been closed due to inactivity for a prolonged period labelJun 2, 2024
@JoshuaKGoldberg
Copy link
Member

JoshuaKGoldberg commentedFeb 17, 2025
edited
Loading

cc@ronami from#10714: should we close out this PR as superseded by that one?

ronami reacted with thumbs up emoji

@jakebailey
Copy link
CollaboratorAuthor

Sure; I'll go look at that when I have a chance. It'd be nice to be able to enable this rule on DT.

JoshuaKGoldberg and ronami reacted with thumbs up emoji

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

@bradzacherbradzacherbradzacher left review comments

Assignees
No one assigned
Labels
awaiting responseIssues waiting for a reply from the OP or another party
Projects
None yet
Milestone
No milestone
Development

Successfully merging this pull request may close these issues.

[no-unused-vars] False positives with members of exported namespace in .d.ts file
3 participants
@jakebailey@JoshuaKGoldberg@bradzacher

[8]ページ先頭

©2009-2025 Movatter.jp