Skip to content

Rule for this usage in beforeRouteEnter #1417

Closed
@przemyslawjanpietrzak

Description

@przemyslawjanpietrzak

I would like to propose rule for checking if method beforeRouteEnter uses this in her body. Error Cannot read property 'someMethod' of undefined can be very dangerous especially when only 1 method has no access to this.

[ ] Enforces code style (layout)
[X ] Warns about a potential error (problem)
[ ] Suggests an alternate way of doing something (suggestion)
[ ] Other (please specify:)

<script>

export default {
	beforeRouteEnter(to, from, next) {
		this.someMethod();
	},
</script>

Additional context
docs: https://router.vuejs.org/guide/advanced/navigation-guards.html#in-component-guards

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions