Last active
April 24, 2019 21:37
-
-
Save phvictorino/0a93af1a66c604a45bcea0f35ce00bca to your computer and use it in GitHub Desktop.
config eslint vue
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
// http://eslint.org/docs/user-guide/configuring | |
module.exports = { | |
root: true, | |
parserOptions: { | |
sourceType: 'module', | |
parser: 'babel-eslint', | |
}, | |
env: { | |
browser: true, | |
}, | |
// https://github.com/feross/standard/blob/master/RULES.md#javascript-standard-style | |
extends: ["prettier", "prettier/standard", "plugin:vue/essential"], | |
// required to lint *.vue files | |
plugins: ["vue", "prettier"], | |
// add your custom rules here | |
'rules': { | |
"prettier/prettier": "error", | |
// allow paren-less arrow functions | |
'arrow-parens': 0, | |
// allow async-await | |
'generator-star-spacing': 0, | |
// allow debugger during development | |
'no-debugger': process.env.NODE_ENV === 'production' ? 2 : 0 | |
} | |
} |
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
npm install --save-dev eslint-plugin-prettier eslint-config-prettier eslint-plugin-vue |
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
"scripts": { | |
"lint:fix": "eslint --fix --ext .js,.vue src", | |
} |
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
// User Settings vscode | |
"vetur.format.defaultFormatter.js": "prettier-eslint", | |
"vetur.format.defaultFormatter.html": "js-beautify-html", | |
"eslint.validate": [ | |
{ | |
"language": "vue", | |
"autoFix": true | |
}, | |
{ | |
"language": "html", | |
"autoFix": true | |
}, | |
{ | |
"language": "javascript", | |
"autoFix": true | |
} | |
] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment