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],
}
]
})
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 theuseFactory
arguments which need to be in the same order.