Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion lib/rules/no-deprecated-router-transition-methods.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,11 @@ function getBaseFixSteps(fixer, context, currentClass) {
}

if (!routerServicePropertyName) {
const targetIndex = currentClass.node.arguments?.findIndex(arg => arg?.properties?.[0]) ?? 0
fixSteps.push(
currentClass.node.type === 'CallExpression'
? fixer.insertTextBefore(
currentClass.node.arguments[0].properties[0],
currentClass.node.arguments[targetIndex].properties[0],
`router: ${serviceInjectImportName}('router'),\n`
)
: fixer.insertTextBefore(
Expand Down
3 changes: 2 additions & 1 deletion lib/rules/no-implicit-injections.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,10 @@ const MODULE_TYPES = [
function fixService(fixer, currentClass, serviceInjectImportName, failedConfig) {
const serviceInjectPath = failedConfig.service;

const targetIndex = currentClass.node.arguments?.findIndex(arg => arg?.properties?.[0]) ?? 0
return currentClass.node.type === 'CallExpression'
? fixer.insertTextBefore(
currentClass.node.arguments[0].properties[0],
currentClass.node.arguments[targetIndex].properties[0],
`${failedConfig.propertyName}: ${serviceInjectImportName}('${serviceInjectPath}'),\n`
)
: fixer.insertTextBefore(
Expand Down