Created
October 13, 2017 19:32
-
-
Save miseeger/a340215b4d7b05f9f95fa330b0a9a2cd to your computer and use it in GitHub Desktop.
ESLint for .vue files in VS Code
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 1) Install ESLint for VS Code (https://marketplace.visualstudio.com/items?itemName=dbaeumer.vscode-eslint) | |
| 2) Add the following settings to VS Code settings: | |
| "[javascript]": { | |
| "editor.tabSize": 4, | |
| "editor.insertSpaces": true | |
| }, | |
| "[vue]": { | |
| "editor.tabSize": 4, | |
| "editor.insertSpaces": true | |
| }, | |
| "eslint.options": { | |
| "extensions": [".html", ".js", ".vue", ".jsx"] | |
| }, | |
| "eslint.validate": [ | |
| { | |
| "language": "html", | |
| "autoFix": true | |
| }, | |
| { | |
| "language": "vue", | |
| "autoFix": true | |
| }, | |
| { | |
| "language": "javascript", | |
| "autoFix": true | |
| }, | |
| { | |
| "language": "javascriptreact", | |
| "autoFix": true | |
| } | |
| ] | |
| 3) Install eslint-plugin-vue (npm install --save-dev eslint eslint-plugin-vue@beta) | |
| 4) configure ESLint as follows (here: javascript): | |
| module.exports = { | |
| "env": { | |
| "browser": true, | |
| "es6": true, | |
| "node": true | |
| }, | |
| "extends": [ | |
| "eslint:recommended", | |
| 'plugin:vue/recommended' // or 'plugin:vue/base' | |
| ], | |
| "parserOptions": { | |
| "sourceType": "module" | |
| }, | |
| "rules": { | |
| "indent": [ | |
| "error", | |
| "tab" | |
| ], | |
| "linebreak-style": [ | |
| "error", | |
| "windows" | |
| ], | |
| "quotes": [ | |
| "error", | |
| "double" | |
| ], | |
| "semi": [ | |
| "error", | |
| "always" | |
| ], | |
| "no-unused-vars": ["off", { "vars": "all", "args": "after-used", "ignoreRestSiblings": false }] // my preference ;-) | |
| } | |
| }; | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment