Skip to content

Add Configurable Linting and Auto-Fix Support for Angular Language Service Issues #2128

Open
@SaranshChaudhary

Description

@SaranshChaudhary

Is your feature request related to a problem? Please describe.

Currently, while the Angular Language Service (ALS) provides diagnostics and quick fixes for code issues (like unused standalone imports or unused components), there is no built-in mechanism to automatically apply these fixes as part of a linting or formatting workflow.

🚀 feature request

Description

I’d like to have a feature within the Angular Language Service VSCode extension that integrates a configurable linting rule. This rule would detect and optionally auto-fix ALS-related issues (for example, removing unused standalone imports) during standard linting or formatting steps. Essentially, I’m looking for a way to automate the code actions that are currently only accessible through manual invocation, making it possible to run them on file save, during CI/CD pipelines, or as part of a code formatting command.

Feature Type

What does this bug affect

  • Angular Language Service VSCode extension

Describe the solution you'd like

I envision a new configuration option in the Angular Language Service extension’s settings, something like:

  • angular.languageService.autoFixOnSave: When set to true, it would apply ALS-supported fixes on file save.
  • angular.languageService.lintRules: A list of diagnostics or fix IDs (e.g., fixUnusedStandaloneImports) that the developer wants the ALS to apply automatically.

When enabled, as soon as I save a file or run a lint command (perhaps through a command like npx ng lint that integrates ALS actions), the extension would leverage the logic already present in the ALS to generate the necessary edits and apply them to the code. This would help maintain cleaner, more consistent codebases without requiring manual intervention for every minor fix.

Describe alternatives you've considered

  • Running Quick Fixes manually: Currently, I must trigger the Quick Fix (e.g., “Remove all unused imports”) from the code editor. This is not scalable for large codebases or part of an automated workflow.
  • External ESLint or TSLint plugins: Tools like ESLint can handle many similar tasks, but they may not have direct access to ALS’s Angular-specific logic, making them less effective for these particular Angular-related fixes.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions