1、vscode代码保存时自动格式化成 ESLint风格(支持VUE) : http://www.ptbird.cn/vscode-autosave-eslint-support-vue.html
另,vscode中非webpack等一些构建工具项目,也可以使用eslint风格。但是需要额外安装eslint包,生成.eslintrc.*文件: https://segmentfault.com/a/1190000009077086(亲测有效)
npm install eslint --save-dev
项目目录下创建一个 .eslintrc.* 的配置文件或 使用命令行(./node_modules/.bin/eslint --init,推荐这种方法)生成这个文件。具体规则可以自己根据需要定制的 https://www.cnblogs.com/yesu/p/7852527.html。
module.exports = { "env": { "browser": true, "commonjs": true, "es6": true }, "extends": "eslint:recommended", "parserOptions": { "sourceType": "module" }, "rules": { "indent": [ "error", 4 ], "linebreak-style": [ "error", "windows" ], "quotes": [ "error", "single" ], "semi": [ "error", "never" ] } };