Skip to content

[@angular-eslint/prefer-standalone] The rule prefer-standalone should not be "fixable" #2206

@Blackbaud-SteveBrush

Description

@Blackbaud-SteveBrush

Description and reproduction of the issue

Our team manages hundreds of Angular applications; for each new version of Angular, we run Angular CLI's ng update. One of the v19 migration schematics from Angular sets standalone: false for any non-standalone components in the project. This works fine.

After the update, we run eslint --fix for all of the applications, and because prefer-standalone was recently added to the "recommended" ESLint config, it's "fix" script essentially undoes the update schematic and removes the standalone: false from the components, putting every application into a failure state (the applications will not build because their components are now considered standalone, but they aren't setup to work that way yet).

As I understand it, a "fixable" rule should make changes to the code that won't put it into a broken state? If it was truly fixable, wouldn't it also add the imports array, and remove the component from any modules that declare it?

I'm suggesting thatangular-eslint removes the "fix" script from the rule so that projects running --fix won't end up in a broken state.

Versions

package version
@angular-eslint/eslint-plugin 19.0.2
@typescript-eslint/parser 8.20.0
ESLint 9.18.0
node 20.12.2
Angular CLI: 19.0.7
Node: 20.12.2
Package Manager: npm 10.5.0
OS: darwin arm64

Package                         Version
---------------------------------------------------------
@angular-devkit/architect       0.1900.7
@angular-devkit/build-angular   19.0.7
@angular-devkit/core            19.0.7
@angular-devkit/schematics      19.0.7
@angular/cdk                    19.0.5
@angular/cli                    19.0.7
@schematics/angular             19.0.7
rxjs                            7.8.1
typescript                      5.7.3
zone.js                         0.15.0
  • I have tried restarting my IDE and the issue persists.
  • I have updated to the latest supported version of the packages and checked my ng version output per the instructions given here.

Metadata

Metadata

Assignees

No one assigned

    Labels

    BREAKING CHANGEThis is a breaking change and should only be released as part of a new major versionpackage: eslint-pluginAngular-specific TypeScript rules

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions