安装一系列eslint插件后,填写eslint配置,配置如下

.editorconfig

root = true

[*]
charset = utf-8
indent_style = space
indent_size = 2
end_of_line = lf
insert_final_newline = true
trim_trailing_whitespace = true .eslintignore /build/
/config/
/dist/
/static/js
/src/test
**/*.js .eslintrc.js module.exports = {
root: true,
parserOptions: {
parser: 'babel-eslint'
},
env: {
browser: true,
},
globals: {
'AMap': true,
'$': true
},
extends: [
// https://github.com/vuejs/eslint-plugin-vue#priority-a-essential-error-prevention
// consider switching to `plugin:vue/strongly-recommended` or `plugin:vue/recommended` for stricter rules.
'plugin:vue/essential',
// https://github.com/standard/standard/blob/master/docs/RULES-en.md
'standard'
],
plugins: [
'html',
'vue'
],
rules: {
'generator-star-spacing': 'off',
'no-debugger': process.env.NODE_ENV === 'production' ? 'error' : 'off',
'semi': ['error', 'never'],
'no-extra-semi': "error",
'eqeqeq': 0,
'spaced-comment': 0,
'keyword-spacing': 0,
"quotes": [0, "single"],
'comma-dangle': 0,
'curly': 0,
'no-unused-expressions': 0,
'padded-blocks': ["error", "never"],
'space-before-function-paren': ["error", "always"],
'no-mixed-operators': 0,
'operator-linebreak': 0,
'camelcase': 0,
'no-lone-blocks': 0,
'no-new': 0,
'one-var': 0,
'no-unneeded-ternary': 0
}
} webpack.base.conf.js {
test: /\.(js|vue)$/,
loader: 'eslint-loader',
enforce: 'pre',
include: [resolve('src'), resolve('test')],
exclude: [resolve('src/components/upload')],
options: {
formatter: require('eslint-friendly-formatter'),
}
},
{
test: /\.vue$/,
loader: 'vue-loader',
options: vueLoaderConfig
}, User Settings {
"window.zoomLevel": 1,
"files.autoSave": "off",
"vetur.validation.template": false,
"search.followSymlinks": false,
"editor.tabSize": 2,
"editor.parameterHints": true,
"editor.quickSuggestions": {
"other": true,
"comments": true,
"strings": true
},
"workbench.colorTheme": "Solarized Dark", // 单引号
"prettier.singleQuote": true,
// 不加分号
"prettier.trailingComma": "all",
//去掉代码结尾的分号
"prettier.semi": false,
"vetur.format.defaultFormatter.js": "vscode-typescript",
// 使用 js-beautify-html 插件格式化 html
"vetur.format.defaultFormatter.html": "js-beautify-html",
//开启 eslint 支持
"prettier.eslintIntegration": true,
//每次保存自动格式化
"editor.formatOnSave": true,
// 每次保存的时候将代码按eslint格式进行修复
"eslint.autoFixOnSave": true,
// 添加 vue 支持
"eslint.validate": [
"javascript",
"javascriptreact",
{
"language": "html",
"autoFix": true
},
{
"language": "vue",
"autoFix": true
}
],
// 格式化插件的配置
"vetur.format.defaultFormatterOptions": {
"js-beautify-html": {
// 属性强制折行对齐
"wrap_attributes": "force-aligned",
}
},
//让函数(名)和后面的括号之间加个空格
"javascript.format.insertSpaceBeforeFunctionParenthesis": true,
//去掉分号
"stylusSupremacy.insertSemicolons": false,
//#去掉大括号
"stylusSupremacy.insertBraces": false,

最新文章

  1. NPOI导出Excel
  2. 1Z0-053 争议题目解析682
  3. import package的问题
  4. 【转载】C++ inline 函数
  5. Github上如何取消fork别人的repository
  6. java jdbc使用配置文件连接数据库:
  7. POJ 3468 A Simple Problem with Integers //线段树的成段更新
  8. LeeCode-Spiral Matrix II
  9. erlang四大behaviour之三-gen_event
  10. spring持久类po或者javabean为什么常常实现序列化?
  11. A low-cost wear-leveling algorithm for block-mappingsolid-state disks
  12. 第7章 贡献 - Identity Server 4 中文文档(v1.0.0)
  13. Linux中Buffer和Cache的区别
  14. Flutter 布局详解
  15. Mysql:is not allowed to connect to this MySQL server
  16. Python操作redis学习系列之(集合)set,redis set详解 (六)
  17. 2019.02.21 bzoj5317: [Jsoi2018]部落战争(凸包+Minkowski和)
  18. 为什么需要micro-service构建平台
  19. ubuntu14.04如何设置静态IP的方法
  20. 微信小程序websocket

热门文章

  1. 【总结】Oracle sql 中的字符(串)替换与转换
  2. POJ 2229 Sumsets(递推,找规律)
  3. Ubuntu中文乱码问题
  4. 删除临时文件的bat文件
  5. 设置meta标签 清除页面缓存,如:<meta http-equiv="Cache-Control" content="no-cache"/>
  6. codeforces 1114C
  7. java定义一个Circle类,包含一个double型的radius属性代表圆的半径,一个findArea()方法返回圆的面积
  8. Everything Be True-freecodecamp算法题目
  9. 【计数】cf223C. Partial Sums
  10. HDU 2045 LELE的RPG难题