Skip to content
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 our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Lint/UnusedGenericOrUnion #537

Open
wants to merge 10 commits into
base: master
Choose a base branch
from

Conversation

nobodywasishere
Copy link
Contributor

Similar to Lint/UnusedLiteral and Lint/UnusedComparison. Not too fond of the name so any suggestions are welcome.

@Sija Sija added the rule label Jan 15, 2025
@Sija Sija added this to the 1.7.0 milestone Jan 15, 2025
@Sija Sija requested review from veelenga and Sija January 15, 2025 17:18
@nobodywasishere
Copy link
Contributor Author

Lint/UnusedTypeOrConstant may be a better name

@nobodywasishere nobodywasishere changed the title Add Lint/UnusedPathGenericOrUnion Add Lint/UnusedTypeOrConstant Jan 18, 2025
@straight-shoota
Copy link
Contributor

I'd reconsider the original name. This rule is about references to types, i.e. a path. The term UnusedType would suggest a type that's never references.

Also I'm not sure it makes sense to include paths to constants because they actually have the side effect of initializing the constant's value.

@nobodywasishere
Copy link
Contributor Author

There's no way to differentiate paths that point to class names vs constants without semantic analysis, so we'll need to drop support for paths in general then. I'll rename to Lint/UnusedGenericOrUnion

@nobodywasishere nobodywasishere force-pushed the nobody/unused-path-generic-or-union branch from 1bdfbc9 to bb1ef05 Compare January 20, 2025 18:19
@nobodywasishere nobodywasishere changed the title Add Lint/UnusedTypeOrConstant Add Lint/GenericOrUnion Jan 20, 2025
@nobodywasishere nobodywasishere changed the title Add Lint/GenericOrUnion Add Lint/UnusedGenericOrUnion Jan 20, 2025
These are the only other nodes allowed in type unions (excluding "self?", as it can point to a method)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants