Skip to content

Commit

Permalink
docs: eslint + definePage
Browse files Browse the repository at this point in the history
See #511
  • Loading branch information
posva committed Sep 16, 2024
1 parent 6e5ae6b commit 2126ea0
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 0 deletions.
12 changes: 12 additions & 0 deletions docs/guide/eslint.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,15 @@ If you are not using auto imports, you will need to tell ESlint about `vue-route
}
}
```

## `definePage()`

Since `definePage()` is a global macro, you need to tell ESlint about it. Add these lines to your eslint configuration:

```json{3}
{
"globals": {
"definePage": "readonly"
}
}
```
2 changes: 2 additions & 0 deletions docs/guide/extending-routes.md
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,8 @@ definePage({
</template>
```

If you are using ESLint, you will need [to declare it as a global variable](../guide/eslint.md#definepage).

::: danger
You cannot use variables in `definePage()` as its passed parameter gets extracted at build time and is removed from `<script setup>`. Similar to other macros like `definePageMeta()` in Nuxt.
:::
Expand Down

0 comments on commit 2126ea0

Please sign in to comment.