-
Notifications
You must be signed in to change notification settings - Fork 26.3k
feat(compiler): add diagnostic for unused standalone imports #57605
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
Conversation
c77400d
to
c55f855
Compare
Pushed a change to add an automatic code fix to the language service. |
959b2bd
to
2082a98
Compare
* Whether the rule to check for unused standalone declarations is enabled. | ||
* Used to disable it conditionally in internal builds. | ||
*/ | ||
export const UNUSED_STANDALONE_DECLARATIONS_RULE_ENABLED = true; |
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.
Context for this is that the new rule is somewhat breaking internally. This flag is in a separate file so we can easily apply a patch to disable it.
Caretaker note: these changes require a new patch internally. The patch is in cl/670184686 |
2082a98
to
662e5eb
Compare
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.
Reviewed-for: public-api
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.
reviewed-for: public-api
Adds a new diagnostic that will report cases where a declaration is in the `imports` array, but isn't being used anywhere. The diagnostic is reported as a warning by default and can be controlled using the following option in the tsconfig: ``` { "angularCompilerOptions": { "extendedDiagnostics": { "checks": { "unusedStandaloneImports": "suppress" } } } } ``` **Note:** I'll look into a codefix for the language service in a follow-up. Fixes angular#46766.
Adds an automatic code fix to the language service that will remove unused standalone imports.
662e5eb
to
aeda915
Compare
This PR was merged into the repository by commit 8da9fb4. The changes were merged into the following branches: main |
This issue has been automatically locked due to inactivity. Read more about our automatic conversation locking policy. This action has been performed automatically by a bot. |
Adds a new diagnostic that will report cases where a declaration is in the
imports
array, but isn't being used anywhere. The diagnostic is reported as a warning by default and can be controlled using the following option in the tsconfig:Fixes #46766.