Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

New Rule: disallow using deprecated next argument in NavigationGuard #2426

Open
roydukkey opened this issue Mar 12, 2024 · 0 comments
Open

Comments

@roydukkey
Copy link

Please describe what the rule should do:

The rule should warn/error when the next argument is used on Vue Router navigation gaurds.

What category should the rule belong to?

[ ] Enforces code style (layout)
[ ] Warns about a potential error (problem)
[x] Suggests an alternate way of doing something (suggestion)
[x] Other: the feature is deprecated

Provide 2-3 code examples that this rule should warn about:

// BAD
router.beforeEach((to, from, next) => {
  if (to.name !== 'Login' && !isAuthenticated) {
    next({ name: 'Login' })
  } else {
    next()
  }
})
// GOOD
router.beforeEach((to) => {
  if (to.name !== 'Login' && !isAuthenticated) {
    return { name: 'Login' };
  }
})

Additional context

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant