vue/no-this-in-before-route-enter
eslint-plugin-vue
No autofix
eslint.config.js
import vue from "eslint-plugin-vue";
export default [
{
plugins: { vue },
rules: {
"vue/no-this-in-before-route-enter": "error",
},
},
];export default {
beforeRouteEnter(to, from, next) {
this.a; // Error: 'this' is not available
next();
}
}export default {
beforeRouteEnter(to, from, next) {
// anything without `this`
}
}Examples from the Oxlint documentation.
No tracked preset enables this rule, so it has no reach yet.
None of the tracked presets enable this rule. Turn it on with the config below.
vue/no-this-in-before-route-enter
eslint-plugin-vue
import vue from "eslint-plugin-vue";
export default [
{
plugins: { vue },
rules: {
"vue/no-this-in-before-route-enter": "error",
},
},
];vue/no-this-in-before-route-enter
vue plugin · correctness
{
"plugins": [
"vue"
],
"rules": {
"vue/no-this-in-before-route-enter": "error"
}
}nursery/noVueThisInBeforeRouteEnter
nursery · since 2.6.5
{
"linter": {
"rules": {
"nursery": {
"noVueThisInBeforeRouteEnter": "error"
}
}
}
}Require components to be the default export
Enforce consistent style for props destructuring
Require ref and shallowRef functions to be strongly typed
Enforce declaration style of defineProps and defineModel
Enforce declaration style of defineEmits