vue中组件名命名不规范导致报错

  1. 组件命名需要以驼峰形式,这是es6限制,如果要以其他形式命名且不报错,需要配置.eslintrc.js文件

  1. 如果没有需要新建.eslintrc.js文件

  1. 具体配置

module.exports = {
    root: true,
    env: {
      node: true
    },
    'extends': [
      'plugin:vue/essential',
      'eslint:recommended'
    ],
    parserOptions: {
      parser: '@babel/eslint-parser'
    },
    rules: {
      'no-console': process.env.NODE_ENV === 'production' ? 'warn' : 'off',
      'no-debugger': process.env.NODE_ENV === 'production' ? 'warn' : 'off',
       //在rules中添加自定义规则
       //关闭组件命名规则
       "vue/multi-word-component-names":"off",
    },
    overrides: [
      {
        files: [
          '**/__tests__/*.{j,t}s?(x)',
          '**/tests/unit/**/*.spec.{j,t}s?(x)'
        ],
        env: {
          jest: true
        }
      }
    ]
  }
  

猜你喜欢

转载自blog.csdn.net/weixin_49662044/article/details/128837870
今日推荐