Skip to content

Instantly share code, notes, and snippets.

@phvictorino
Last active April 24, 2019 21:37
Show Gist options
  • Save phvictorino/0a93af1a66c604a45bcea0f35ce00bca to your computer and use it in GitHub Desktop.
Save phvictorino/0a93af1a66c604a45bcea0f35ce00bca to your computer and use it in GitHub Desktop.
config eslint vue
// 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
}
}
npm install --save-dev eslint-plugin-prettier eslint-config-prettier eslint-plugin-vue
"scripts": {
"lint:fix": "eslint --fix --ext .js,.vue src",
}
// 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