Skip to content

vue-doctor/ecosystem/router-no-string-push ​

Pass a route object (e.g. { name: 'user', params: { id } }) instead of a path built with string interpolation to router.push/replace.

PropertyValue
CategoryEcosystem
Default Severitywarning
Confidencelow
FixableNo
Engineoxlint
Sincev1.1.0
Frameworksvue, nuxt
Test filesNot checked (which files)

Why it matters ​

Pass a route object (e.g. { name: 'user', params: { id } }) instead of a path built with string interpolation to router.push/replace.

How to fix ​

Review the finding and update the code according to best practices below.

Agent Guidance ​

Replace a path assembled with a template literal or + in router.push/replace by a route location object, such as { name: 'user', params: { id } }, so params are encoded. Static paths like '/login' are fine.


Rule source: vue-doctor/ecosystem/router-no-string-push

Released under the MIT License.