# eslint-plugin-vue [![NPM version](https://img.shields.io/npm/v/eslint-plugin-vue.svg?style=flat)](https://npmjs.org/package/eslint-plugin-vue) [![NPM downloads](https://img.shields.io/npm/dm/eslint-plugin-vue.svg?style=flat)](https://npmjs.org/package/eslint-plugin-vue) [![CircleCI](https://circleci.com/gh/vuejs/eslint-plugin-vue.svg?style=svg)](https://circleci.com/gh/vuejs/eslint-plugin-vue) > Official ESLint plugin for Vue.js ## :art: Playground on the Web You can try this plugin on the Web. - https://mysticatea.github.io/vue-eslint-demo/ ## :grey_exclamation: Requirements - [ESLint](http://eslint.org/) `>=3.18.0`. - `>=4.7.0` to use `eslint --fix`. - `>=4.14.0` to use with `babel-eslint`. - Node.js `>=4.0.0` ## :cd: Installation ```bash npm install --save-dev eslint eslint-plugin-vue ``` ## :rocket: Usage Create `.eslintrc.*` file to configure rules. See also: [http://eslint.org/docs/user-guide/configuring](http://eslint.org/docs/user-guide/configuring). Example **.eslintrc.js**: ```js module.exports = { extends: [ // add more generic rulesets here, such as: // 'eslint:recommended', 'plugin:vue/essential' ], rules: { // override/add rules settings here, such as: // 'vue/no-unused-vars': 'error' } } ``` ### Single File Components ESLint only targets `.js` files by default. You must include the `.vue` extension using [the `--ext` option](https://eslint.org/docs/user-guide/configuring#specifying-file-extensions-to-lint) or a glob pattern. Examples: ```bash eslint --ext .js,.vue src eslint src/**/*.{js,vue} ``` ### Attention All component-related rules are being applied to code that passes any of the following checks: * `Vue.component()` expression * `Vue.extend()` expression * `Vue.mixin()` expression * `export default {}` in `.vue` or `.jsx` file If you however want to take advantage of our rules in any of your custom objects that are Vue components, you might need to use special comment `// @vue/component` that marks object in the next line as a Vue component in any file, e.g.: ```js // @vue/component const CustomComponent = { name: 'custom-component', template: '
' } ``` ```js Vue.component('AsyncComponent', (resolve, reject) => { setTimeout(() => { // @vue/component resolve({ name: 'async-component', template: '
' }) }, 500) }) ``` ### `eslint-disable` functionality in `