# eslint-plugin-nuxt

> ESLint plugin for Nuxt.js

Latest version **4.0.0** (published 2022-08-31) · MIT license · 0 weekly downloads

## Install

```sh
npm install eslint-plugin-nuxt
pnpm add eslint-plugin-nuxt
yarn add eslint-plugin-nuxt
bun add eslint-plugin-nuxt
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 4.0.0 |
| Published | 2022-08-31 |
| First published | 2018-12-05 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 3 |
| Unpacked size | 41.2 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 130 |
| Author | Clark Du |
| Maintainers | antfu, atinux, pi0, clarkdo, danielroe |
| Keywords | nuxt, eslint, eslintplugin |

## Links

- npm: https://www.npmjs.com/package/eslint-plugin-nuxt
- Repository: https://github.com/nuxt/eslint-plugin-nuxt
- Homepage: https://github.com/nuxt/eslint-plugin-nuxt#readme
- Issues: https://github.com/nuxt/eslint-plugin-nuxt/issues
- npm.io page: https://npm.io/package/eslint-plugin-nuxt

## Dependencies (3)

- [semver](https://npm.io/package/semver.md) ^7.3.7
- [eslint-plugin-vue](https://npm.io/package/eslint-plugin-vue.md) ^9.4.0
- [vue-eslint-parser](https://npm.io/package/vue-eslint-parser.md) ^9.0.3

## Alternatives

- [eslint-plugin-sonarjs](https://npm.io/package/eslint-plugin-sonarjs.md) — 2.9M weekly downloads
- [eslint-config-expo](https://npm.io/package/eslint-config-expo.md) — 1.5M weekly downloads
- [@matter/protocol](https://npm.io/package/@matter/protocol.md) — 63.5K weekly downloads
- [@eventcatalog/linter](https://npm.io/package/@eventcatalog/linter.md) — 24.8K weekly downloads
- [@inrupt/eslint-config-base](https://npm.io/package/@inrupt/eslint-config-base.md) — 4.5K weekly downloads

## Recent versions

- 4.0.0 (latest) — 2022-08-31
- 3.2.0 — 2022-03-13
- 3.1.0 — 2021-11-28
- 3.0.0 — 2021-10-24
- 2.0.0 — 2020-11-14
- 1.0.0 — 2020-05-12
- 0.5.2 — 2020-03-20
- 0.5.1 — 2020-02-09
- 0.5.0 — 2019-11-09
- 0.4.3 — 2019-03-12
- 0.4.2 — 2019-02-21
- 0.4.0 — 2019-02-21
- 0.3.0 — 2018-12-19
- 0.2.0 — 2018-12-10
- 0.1.3 — 2018-12-10
- … 4 more at https://npm.io/package/eslint-plugin-nuxt/versions

## README

# eslint-plugin-nuxt

[![Standard JS][standard-js-src]][standard-js-href]
[![Circle CI][circle-ci-src]][circle-ci-href]
[![npm version][npm-version-src]][npm-version-href]
[![npm downloads][npm-downloads-src]][npm-downloads-href]

[standard-js-src]: https://flat.badgen.net/badge/code%20style/standard/green
[standard-js-href]: https://standardjs.com
[circle-ci-src]: https://flat.badgen.net/circleci/github/nuxt/eslint-plugin-nuxt
[circle-ci-href]: https://circleci.com/gh/nuxt/eslint-plugin-nuxt
[codecov-src]: https://flat.badgen.net/codecov/c/github/nuxt/eslint-plugin-nuxt
[codecov-href]: https://codecov.io/gh/nuxt/eslint-plugin-nuxt
[npm-version-src]: https://flat.badgen.net/npm/v/eslint-plugin-nuxt/latest
[npm-version-href]: https://npmjs.com/package/eslint-plugin-nuxt
[npm-downloads-src]: https://flat.badgen.net/npm/dt/eslint-plugin-nuxt
[npm-downloads-href]: https://npmjs.com/package/eslint-plugin-nuxt

:sparkles: ESLint plugin for Nuxt.js

## :cd: Installation

You'll first need to install [ESLint](http://eslint.org):

```sh
$ npm i eslint --save-dev
success Saved 1 new dependencies
```

Next, install `eslint-plugin-nuxt`:

```sh
$ npm install eslint-plugin-nuxt --save-dev
success Saved 1 new dependencies
```

**Note:** If you installed ESLint globally (using the `-g` flag) then you must also install `eslint-plugin-nuxt` globally.

## :rocket: Usage

Add `nuxt` to the plugins section of your `.eslintrc` configuration file. You can omit the `eslint-plugin-` prefix:

1. Use our preset to extend recommended defaults:

```json
{
  "extends": [
    "plugin:nuxt/recommended"
  ]
}
```

2. Or specify individual rules manually:

```json
{
    "plugins": [
        "nuxt"
    ],
    "rules": {
        "nuxt/rule-name": 2
    }
}
```

## :gear: Configs

This plugin provides four predefined configs:

- `plugin:nuxt/base` - Settings and rules to enable correct ESLint parsing
- `plugin:nuxt/recommended` - Above, plus rules to enforce subjective community defaults to ensure consistency

## :bulb: Rules

<!--RULES_TABLE_START-->

### Base Rules

```json
{
  "extends": "plugin:nuxt/base"
}
```

|    | Rule ID | Description |
|:---|:--------|:------------|
|  | [nuxt/no-env-in-context](./docs/rules/no-env-in-context.md) | Disallow `context.isServer/context.isClient` in `asyncData/fetch/nuxtServerInit` |
|  | [nuxt/no-env-in-hooks](./docs/rules/no-env-in-hooks.md) | Disallow `process.server/process.client` in client only Vue lifecycle hooks like: `mounted, beforeMount, updated...` |
|  | [nuxt/no-globals-in-created](./docs/rules/no-globals-in-created.md) | Disallow `window/document` in `created/beforeCreate` |
|  | [nuxt/no-this-in-fetch-data](./docs/rules/no-this-in-fetch-data.md) | Disallow `this` in `asyncData/fetch` |
|  | [nuxt/no-cjs-in-config](./docs/rules/no-cjs-in-config.md) | Disallow `require/modules.exports/exports` in `nuxt.config.js` |

### Recommended Rules

Include all the below rules, as well as all priority rules in above categories, with:

```json
{
  "extends": "plugin:nuxt/recommended"
}
```

|    | Rule ID | Description |
|:---|:--------|:------------|
|  | [nuxt/no-timing-in-fetch-data](./docs/rules/no-timing-in-fetch-data.md) | Disallow `setTimeout/setInterval` in `asyncData/fetch` |

### Other Rules

|    | Rule ID | Description |
|:---|:--------|:------------|
|  | [nuxt/require-func-head](./docs/rules/require-func-head.md) | Enforce `head` property in component to be a function. |

---
_Source: https://npm.io/package/eslint-plugin-nuxt · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
