vsode 保存时自动在 链式调用处加空格,导致报错?

store?.getters?.token

保存后变成这样了,怎么修改,可以在保存时候,链式调用不报错,也不影响其他地方格式化?
image.png
格式化用的是eslint
vscode setting.json 是这个样子的

{
    // "eslint.autoFixOnSave": true,
    "editor.codeActionsOnSave": {
        "source.fixAll.eslint": true
    },
    //保存自动格式化
    "editor.formatOnSave": true
}

.eslintrc

module.exports = {
  root: true,
  env: {
    node: true
  },
  extends: [
    'plugin:vue/essential'
    // 关闭ESlint关键代码
    // '@vue/standard'
  ],
  parserOptions: {
    parser: 'babel-eslint'
  },
  rules: {
    indent: ['off', 2],
    'space-before-function-paren': 0,
    'no-console': process.env.NODE_ENV === 'production' ? 'warn' : 'off',
    'no-debugger': process.env.NODE_ENV === 'production' ? 'warn' : 'off',
    // 关闭prettier
    'prettier/prettier': 'off',
    "vue/comment-directive": 'off' // 解决index.html 中红线
  }
}
阅读 1.7k
1 个回答

可能是老版vuter造成的,换成新版的官方的试一下

撰写回答
你尚未登录,登录后可以
  • 和开发者交流问题的细节
  • 关注并接收问题和回答的更新提醒
  • 参与内容的编辑和改进,让解决方法与时俱进