Socket
Socket
Sign inDemoInstall

eslint-plugin-nuxt

Package Overview
Dependencies
110
Maintainers
5
Versions
19
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    eslint-plugin-nuxt

ESLint plugin for Nuxt.js


Version published
Maintainers
5
Install size
5.70 MB
Created

Changelog

Source

3.2.0 (2022-03-13)

Features

  • add base config (fb94d7b)
  • add no-env-in-context (42ada82)
  • add no-env-in-hooks (016f609)
  • add no-env-in-mounted (4b32052)
  • add no-this-in-fetch (94552c7)
  • add no-timing-in-fetch-data (1436642)
  • add rule no-this-in-async-data (96ce607)
  • init no-this-in-async-data (cb03b4d)
  • init no-this-in-fetch (581005a)
  • move ssr to base (1da2f0c)
  • rule: add no-globals-in-created (09eaa50)
  • rule: add require-func-head in recommended (#62) (f7e7b87)
  • rule: no commonjs api in nuxt config (eb02e0e)
  • upgrade eslint to v7 (3e46242)
  • upgrade eslint-plugin-vue to v6 (b5b1bf4)

Bug Fixes

  • correct category for no-timing-in-fetch-data (ae6b499)
  • disallow process.browser in no-env-in-hooks (#127) (e421323)
  • enable no-this-in-fetch only for nuxt < 2.12 (a0e3f73)
  • incompatible version of vue-eslint-parser (a0e355f)
  • not-null check for hooks (ee73e8b)
  • nuxt/require-func-head doesnt work with factories (11492e2), closes #94
  • remove require-func-head from recommend (25d108c), closes #93
  • rule not found (976f28d)
  • undefined value in nuxt/no-env-in-context (b9fed00)
  • use filename instead of full path (d22e011)
  • wrong index file (f95cf1d)

Readme

Source

eslint-plugin-nuxt

Standard JS Circle CI npm version npm downloads

:sparkles: ESLint plugin for Nuxt.js

:cd: Installation

You'll first need to install ESLint:

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

Next, install eslint-plugin-nuxt:

$ 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:
{
  "extends": [
    "plugin:nuxt/recommended"
  ]
}
  1. Or specify individual rules manually:
{
    "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

Base Rules

{
  "extends": "plugin:nuxt/base"
}
Rule IDDescription
nuxt/no-env-in-contextDisallow context.isServer/context.isClient in asyncData/fetch/nuxtServerInit
nuxt/no-env-in-hooksDisallow process.server/process.client in client only Vue lifecycle hooks like: mounted, beforeMount, updated...
nuxt/no-globals-in-createdDisallow window/document in created/beforeCreate
nuxt/no-this-in-fetch-dataDisallow this in asyncData/fetch
nuxt/no-cjs-in-configDisallow require/modules.exports/exports in nuxt.config.js

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

{
  "extends": "plugin:nuxt/recommended"
}
Rule IDDescription
nuxt/no-timing-in-fetch-dataDisallow setTimeout/setInterval in asyncData/fetch

Other Rules

Rule IDDescription
nuxt/require-func-headEnforce head property in component to be a function.

Keywords

FAQs

Last updated on 13 Mar 2022

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc