Research
Security News
Threat Actor Exposes Playbook for Exploiting npm to Build Blockchain-Powered Botnets
A threat actor's playbook for exploiting the npm ecosystem was exposed on the dark web, detailing how to build a blockchain-powered botnet.
eslint-plugin-vue
Advanced tools
The eslint-plugin-vue npm package is a plugin for ESLint specifically designed for Vue.js applications. It provides linting rules that are tailored to the Vue.js framework, helping developers to write consistent and error-free code by following best practices and avoiding common mistakes.
Style Guide Enforcement
Enforces a style guide by limiting the number of attributes per line in Vue templates. This helps in maintaining readability and consistency in the codebase.
"vue/max-attributes-per-line": ["error", { "singleline": 3, "multiline": { "max": 1, "allowFirstLine": false } }]
Component Naming
Ensures that component names in templates are written in a specific case, such as PascalCase, which is a common convention in Vue.js projects.
"vue/component-name-in-template-casing": ["error", "PascalCase"]
Avoiding Deprecated Features
Prevents the use of deprecated features like the 'slot' attribute, encouraging developers to use the updated syntax and features of Vue.js.
"vue/no-deprecated-slot-attribute": "error"
Prop Validation
Ensures that every prop has a default value, which can prevent bugs and make the components more predictable.
"vue/require-default-prop": "error"
Script Indentation
Enforces consistent indentation in the script section of Vue single-file components, which improves code readability and maintainability.
"vue/script-indent": ["error", 2, { "baseIndent": 1, "switchCase": 1, "ignores": [] }]
Similar to eslint-plugin-vue, eslint-plugin-react provides linting rules specific to React applications. It helps enforce best practices and conventions for React components, JSX syntax, and more.
This plugin is designed for Angular applications and offers linting rules that cater to the Angular framework's structure and coding styles, similar to how eslint-plugin-vue serves Vue.js developers.
For developers using Svelte, eslint-plugin-svelte3 provides linting rules tailored to the Svelte framework. It helps maintain code quality and consistency in a way that's analogous to eslint-plugin-vue's role for Vue.js.
Official ESLint plugin for Vue.js
3.0.0
:exclamation:This branch contains eslint-plugin-vue@beta
which is pre-released 3.0
, but it's not the default version that you get with npm install eslint-plugin-vue
. In order to install this you need to specify either "eslint-plugin-vue": "beta"
in package.json
or do npm install eslint-plugin-vue@beta
.
Please try it and report any issues that you might experience.
If you want to check previous releases go here.
>=3.18.0
.>=4.0.0
npm install --save-dev eslint eslint-plugin-vue@beta
Create .eslintrc.*
file to configure rules. See also: http://eslint.org/docs/user-guide/configuring.
Example .eslintrc.js:
module.exports = {
extends: [
'eslint:recommended',
'plugin:vue/recommended' // or 'plugin:vue/base'
],
rules: {
// override/add rules' settings here
'vue/no-invalid-v-if': 'error'
}
}
This plugin provides two predefined configs:
plugin:vue/base
- contains necessary settings for this plugin to work properlyplugin:vue/recommended
- extends base config with recommended rules (the ones with check mark :white_check_mark: in the table below)Rules are grouped by category to help you understand their purpose.
No rules are enabled by plugin:vue/base
config. The plugin:vue/recommended
config enables rules that report common problems, which have a check mark :white_check_mark: below.
The --fix
option on the command line automatically fixes problems reported by rules which have a wrench :wrench: below.
Rule ID | Description | |
---|---|---|
:wrench: | html-end-tags | enforce end tag style. |
:white_check_mark::wrench: | html-no-self-closing | disallow self-closing elements. |
:white_check_mark: | no-confusing-v-for-v-if | disallow confusing v-for and v-if on the same element. |
no-duplicate-attributes | disallow duplicate arguments. | |
:white_check_mark: | no-textarea-mustache | disallow mustaches in <textarea> . |
:white_check_mark: | require-component-is | require v-bind:is of <component> elements. |
:white_check_mark: | require-v-for-key | require v-bind:key with v-for directives. |
Rule ID | Description | |
---|---|---|
html-quotes | enforce quotes style of HTML attributes. | |
:wrench: | v-bind-style | enforce v-bind directive style. |
:wrench: | v-on-style | enforce v-on directive style. |
Rule ID | Description | |
---|---|---|
:white_check_mark: | jsx-uses-vars | Prevent variables used in JSX to be marked as unused |
Rule ID | Description | |
---|---|---|
:white_check_mark: | no-invalid-template-root | disallow invalid template root. |
:white_check_mark: | no-invalid-v-bind | disallow invalid v-bind directives. |
:white_check_mark: | no-invalid-v-cloak | disallow invalid v-cloak directives. |
:white_check_mark: | no-invalid-v-else-if | disallow invalid v-else-if directives. |
:white_check_mark: | no-invalid-v-else | disallow invalid v-else directives. |
:white_check_mark: | no-invalid-v-for | disallow invalid v-for directives. |
:white_check_mark: | no-invalid-v-html | disallow invalid v-html directives. |
:white_check_mark: | no-invalid-v-if | disallow invalid v-if directives. |
:white_check_mark: | no-invalid-v-model | disallow invalid v-model directives. |
:white_check_mark: | no-invalid-v-on | disallow invalid v-on directives. |
:white_check_mark: | no-invalid-v-once | disallow invalid v-once directives. |
:white_check_mark: | no-invalid-v-pre | disallow invalid v-pre directives. |
:white_check_mark: | no-invalid-v-show | disallow invalid v-show directives. |
:white_check_mark: | no-invalid-v-text | disallow invalid v-text directives. |
:white_check_mark: | no-parsing-error | disallow parsing errors in <template> . |
This plugin follows semantic versioning and ESLint's Semantic Versioning Policy.
We're using GitHub Releases.
In order to add a new rule, you should:
npm start
docs
filenpm run update
in order to update readme and recommended configurationWe're more than happy to see potential contributions, so don't hesitate. If you have any suggestions, ideas or problems feel free to add new issue, but first please make sure your question does not repeat previous ones.
See the LICENSE file for license rights and limitations (MIT).
FAQs
Official ESLint plugin for Vue.js
The npm package eslint-plugin-vue receives a total of 3,024,518 weekly downloads. As such, eslint-plugin-vue popularity was classified as popular.
We found that eslint-plugin-vue demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 0 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.
Research
Security News
A threat actor's playbook for exploiting the npm ecosystem was exposed on the dark web, detailing how to build a blockchain-powered botnet.
Security News
NVD’s backlog surpasses 20,000 CVEs as analysis slows and NIST announces new system updates to address ongoing delays.
Security News
Research
A malicious npm package disguised as a WhatsApp client is exploiting authentication flows with a remote kill switch to exfiltrate data and destroy files.