---
title: "@nuxt/eslint-plugin"
description: "ESLint plugin of additional rules for Nuxt."
canonical_url: "https://nuxt.com/modules/eslint/plugin"
---
# @nuxt/eslint-plugin

> ESLint plugin of additional rules for Nuxt.

ESLint plugin of additional rules for Nuxt.

::tip
Usually, you don't need to use this package directly. It's already included in the [ESLint Module](https://nuxt.com/modules/eslint) and the [ESLint Config](https://nuxt.com/modules/eslint/config).
::

::note
The source code of this package is in [`packages/eslint-plugin`](https://github.com/nuxt/eslint/tree/main/packages/eslint-plugin) on GitHub.
::

## Rules

All the rules are enabled by the [ESLint Module](https://nuxt.com/modules/eslint) and the [ESLint Config](https://nuxt.com/modules/eslint/config), except `nuxt/nuxt-config-keys-order` which is enabled with [stylistic rules](https://nuxt.com/modules/eslint/recipes#eslint-stylistic).

To use them in your own config, register the plugin under the `nuxt` name:

```js [eslint.config.mjs]
import nuxt from '@nuxt/eslint-plugin'

export default [
  {
    plugins: { nuxt },
    rules: {
      'nuxt/prefer-import-meta': 'error'
    }
  }
]
```

### `nuxt/prefer-import-meta`

Enforces the use of `import.meta.*` over `process.*` for the Nuxt environment flags (`client`, `browser`, `server`, `nitro`, `dev`, `test` and `prerender`), for example `import.meta.client` instead of `process.client`. Auto-fixable.

```json
{
  "rules": {
    "nuxt/prefer-import-meta": "error"
  }
}
```

### `nuxt/no-page-meta-runtime-values`

`definePageMeta()` is extracted from the page at build time and runs before the component setup. This rule disallows values that need a runtime context at the top level: composable calls such as `useRoute()`, `ref()` or `inject()`, `this` and `await`. Static values and imported or top-level variables are fine, and composables can still be called inside the `middleware` and `validate` functions.

```ts [pages/index.vue]
// ❌ Not available when the page meta is extracted
definePageMeta({ name: useRoute().name })

// ✅ Runs at navigation time
definePageMeta({
  middleware: () => {
    const route = useRoute()
  }
})
```

It is enabled for the files in your pages directories.

### `nuxt/no-nuxt-config-test-key`

Disallows setting the `test` key to a boolean in your Nuxt config, as the test environment is detected automatically.

```ts [nuxt.config.ts]
export default defineNuxtConfig({
  test: true // ❌
})
```

### `nuxt/nuxt-config-keys-order`

Sorts the top-level keys of your Nuxt config, and of its environment overrides such as `$production`, in a recommended order. Auto-fixable.

```json
{
  "rules": {
    "nuxt/nuxt-config-keys-order": "error"
  }
}
```


## Sitemap

See the full [sitemap](https://nuxt.com/sitemap.md) for all pages.
