Security News
Research
Data Theft Repackaged: A Case Study in Malicious Wrapper Packages on npm
The Socket Research Team breaks down a malicious wrapper package that uses obfuscation to harvest credentials and exfiltrate sensitive data.
eslint-plugin-nuxt
Advanced tools
eslint-plugin-nuxt is an ESLint plugin specifically designed for Nuxt.js projects. It provides a set of rules and configurations to ensure best practices and code quality in Nuxt.js applications.
No Tailing Slash
This rule ensures that there are no trailing slashes in the paths of your Nuxt.js application.
module.exports = {
extends: [
'plugin:nuxt/recommended'
],
rules: {
'nuxt/no-tailing-slash': 'error'
}
};
No Deprecated Functions
This rule helps to avoid using deprecated functions in your Nuxt.js codebase.
module.exports = {
extends: [
'plugin:nuxt/recommended'
],
rules: {
'nuxt/no-deprecated-functions': 'error'
}
};
No Async Data
This rule disallows the use of the asyncData method in favor of the fetch method, which is recommended in Nuxt.js.
module.exports = {
extends: [
'plugin:nuxt/recommended'
],
rules: {
'nuxt/no-async-data': 'error'
}
};
eslint-plugin-vue provides linting rules for Vue.js applications. While it is not specific to Nuxt.js, it offers a wide range of rules to ensure code quality and best practices in Vue.js projects. It can be used alongside eslint-plugin-nuxt for comprehensive linting.
eslint-plugin-vue-scoped-css is an ESLint plugin that enforces scoped CSS rules in Vue.js single-file components. It ensures that styles are scoped to the component, preventing global style leaks. This plugin complements eslint-plugin-nuxt by focusing on CSS best practices.
:sparkles: ESLint plugin for Nuxt.js
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.
Add nuxt
to the plugins section of your .eslintrc
configuration file. You can omit the eslint-plugin-
prefix:
{
"extends": [
"plugin:nuxt/recommended"
]
}
{
"plugins": [
"nuxt"
],
"rules": {
"nuxt/rule-name": 2
}
}
This plugin provides four predefined configs:
plugin:nuxt/base
- Settings and rules to enable correct ESLint parsingplugin:nuxt/recommended
- Above, plus rules to enforce subjective community defaults to ensure consistency{
"extends": "plugin:nuxt/base"
}
Rule ID | Description | |
---|---|---|
nuxt/no-env-in-context | Disallow context.isServer/context.isClient in asyncData/fetch/nuxtServerInit | |
nuxt/no-env-in-hooks | Disallow process.server/process.client in client only Vue lifecycle hooks like: mounted, beforeMount, updated... | |
nuxt/no-globals-in-created | Disallow window/document in created/beforeCreate | |
nuxt/no-this-in-fetch-data | Disallow this in asyncData/fetch | |
nuxt/no-cjs-in-config | Disallow 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 ID | Description | |
---|---|---|
nuxt/no-timing-in-fetch-data | Disallow setTimeout/setInterval in asyncData/fetch |
Rule ID | Description | |
---|---|---|
nuxt/require-func-head | Enforce head property in component to be a function. |
FAQs
ESLint plugin for Nuxt.js
The npm package eslint-plugin-nuxt receives a total of 140,760 weekly downloads. As such, eslint-plugin-nuxt popularity was classified as popular.
We found that eslint-plugin-nuxt demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 5 open source maintainers collaborating on the project.
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.
Security News
Research
The Socket Research Team breaks down a malicious wrapper package that uses obfuscation to harvest credentials and exfiltrate sensitive data.
Research
Security News
Attackers used a malicious npm package typosquatting a popular ESLint plugin to steal sensitive data, execute commands, and exploit developer systems.
Security News
The Ultralytics' PyPI Package was compromised four times in one weekend through GitHub Actions cache poisoning and failure to rotate previously compromised API tokens.