Skip to content

sort-module-metadata-arrays breaks factory provider injection  #198

Open
@fpd007

Description

The sort-module-metadata-arrays rule break the factory provider injection.

The rule suggests (or auto-fixes) to change the order of the inject array, but it does not change the order of the useFactory arguments which need to be in the same order.

@Module({
    providers: [
        {
            provide: 'EXAMPLE_PROVIDER',
            useFactory: (bProvider: BProvider, aProvider: AProvider): unknown => {
                return new WhatEver();
            },
        // autofix would swap the order here but leave the useFactory above as is, which silently breaks code
        inject: [BProvider, AProvider],
        }
    ]
})

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions