Created
March 21, 2020 04:30
-
-
Save chhumsina/ace3b9435d16a91661cbdec485ed39b1 to your computer and use it in GitHub Desktop.
Setup Eslint + Prettier in an existing vue-cli project- eslintrc file- user settings in VsCode- package.json (for check versions)
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
// Eslint + Prettier, custom configuration taken from here. | |
// https://medium.com/@doppelmutzi/eslint-prettier-vue-workflow-46a3cf54332f | |
// and here's my gist | |
// https://gist.github.com/robertoandres24/6cb6d0fa898bfb31066c5e1b118df64a | |
module.exports = { | |
root: true, | |
parserOptions: { | |
parser: 'babel-eslint' | |
}, | |
env: { | |
browser: true | |
}, | |
extends: [ | |
"prettier", | |
"prettier/standard", | |
"plugin:vue/recommended" | |
], | |
plugins: [ | |
'vue', 'prettier' | |
], | |
rules: { | |
"prettier/prettier": "error", | |
"vue/max-attributes-per-line": 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
{ | |
... | |
... | |
"scripts": { | |
"dev": "webpack-dev-server --inline --progress --config build/webpack.dev.conf.js", | |
"start": "npm run dev", | |
"lint": "eslint --ext .js,.vue src", | |
"lint-autofix": "eslint --ext .js,.vue src test --fix", | |
"eslint-check": "eslint --print-config .eslintrc.js | eslint-config-prettier-check", | |
"build": "node build/build.js" | |
}, | |
"dependencies": { | |
... | |
... | |
}, | |
"devDependencies": { | |
"autoprefixer": "^7.1.2", | |
"babel-core": "^6.22.1", | |
"babel-eslint": "^8.2.1", | |
"babel-helper-vue-jsx-merge-props": "^2.0.3", | |
"babel-loader": "^7.1.1", | |
"babel-plugin-syntax-jsx": "^6.18.0", | |
"babel-plugin-transform-runtime": "^6.22.0", | |
"babel-plugin-transform-vue-jsx": "^3.5.0", | |
"babel-preset-env": "^1.3.2", | |
"babel-preset-stage-2": "^6.22.0", | |
"browser-sync": "^2.24.4", | |
"browser-sync-webpack-plugin": "^2.2.2", | |
"chalk": "^2.0.1", | |
"copy-webpack-plugin": "^4.0.1", | |
"css-loader": "^0.28.0", | |
"eslint": "^4.15.0", | |
"eslint-config-prettier": "^3.1.0", | |
"eslint-config-standard": "^10.2.1", | |
"eslint-friendly-formatter": "^3.0.0", | |
"eslint-loader": "^1.7.1", | |
"eslint-plugin-import": "^2.7.0", | |
"eslint-plugin-node": "^5.2.0", | |
"eslint-plugin-prettier": "^3.0.0", | |
"eslint-plugin-promise": "^3.4.0", | |
"eslint-plugin-standard": "^3.0.1", | |
"eslint-plugin-vue": "^4.0.0", | |
"extract-text-webpack-plugin": "^3.0.0", | |
"file-loader": "^1.1.4", | |
"friendly-errors-webpack-plugin": "^1.6.1", | |
"html-webpack-plugin": "^2.30.1", | |
"node-notifier": "^5.1.2", | |
"node-sass": "^4.9.3", | |
"optimize-css-assets-webpack-plugin": "^3.2.0", | |
"ora": "^1.2.0", | |
"portfinder": "^1.0.13", | |
"postcss-import": "^11.0.0", | |
"postcss-loader": "^2.0.8", | |
"postcss-url": "^7.2.1", | |
"prettier": "^1.14.3", | |
"rimraf": "^2.6.0", | |
"sass-loader": "^7.0.1", | |
"sass-resources-loader": "^1.3.3", | |
"semver": "^5.3.0", | |
"shelljs": "^0.7.6", | |
"uglifyjs-webpack-plugin": "^1.1.1", | |
"url-loader": "^0.5.8", | |
"vue-loader": "^13.3.0", | |
"vue-style-loader": "^3.0.1", | |
"vue-template-compiler": "^2.5.2", | |
"webpack": "^3.6.0", | |
"webpack-bundle-analyzer": "^2.9.0", | |
"webpack-dev-server": "^2.9.1", | |
"webpack-merge": "^4.1.0" | |
}, | |
"engines": { | |
"node": ">= 6.0.0", | |
"npm": ">= 3.0.0" | |
}, | |
"browserslist": [ | |
"> 1%", | |
"last 2 versions", | |
"not ie <= 8" | |
] | |
} |
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
{ | |
... | |
... | |
"eslint.enable": true, | |
"editor.formatOnSave": true, | |
"eslint.autoFixOnSave": true, | |
"eslint.alwaysShowStatus": true, | |
"eslint.validate": [ | |
"javascript", | |
"vue" | |
], | |
"vetur.format.defaultFormatter.html": "prettier" | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment