Vue.js 如何在Vue中配置eslint?

Vue.js 如何在Vue中配置eslint?,vue.js,Vue.js,我已经启动了一个新的Vue项目,但是所有的配置文件(webpack,…)都不存在了。现在一切都隐藏在Vue中,我不知道如何配置它 我的问题是,所有通知和警告都被eslint视为错误: error: 'Segment' is defined but never used (no-unused-vars) at src/App.vue:10:8: 8 | <script> 9 | import HelloWorld from './components/HelloWorld.

我已经启动了一个新的Vue项目,但是所有的配置文件(webpack,…)都不存在了。现在一切都隐藏在Vue中,我不知道如何配置它

我的问题是,所有通知和警告都被eslint视为错误:

error: 'Segment' is defined but never used (no-unused-vars) at src/App.vue:10:8:
   8 | <script>
   9 | import HelloWorld from './components/HelloWorld.vue'
> 10 | import Segment

是否存在和
开发
模式或类似模式?

例如,您可以禁用
未定义
未使用
警告:

在package.json中:

"eslintConfig": {
    "rules": {
      "no-unused-vars": "off",
      "no-undef": "off"
    },
  },

例如,您可以禁用
未定义
未使用
警告:

在package.json中:

"eslintConfig": {
    "rules": {
      "no-unused-vars": "off",
      "no-undef": "off"
    },
  },

目前还没有现成的配置将所有规则配置为警告,但您可以使用ESLint插件来实现这一点:。安装该模块后,编辑
package.json
eslintConfig
以包含:

{
  "eslintConfig": {
    "plugins": [
      "only-warn"
    ]
  }
}
或者,您可以单独显示警告而不是错误:

{
  "eslintConfig": {
    "rules": {
       "no-unused-vars": "warn",
       "no-undef": "warn"
    }
  }
}

目前还没有现成的配置将所有规则配置为警告,但您可以使用ESLint插件来实现这一点:。安装该模块后,编辑
package.json
eslintConfig
以包含:

{
  "eslintConfig": {
    "plugins": [
      "only-warn"
    ]
  }
}
或者,您可以单独显示警告而不是错误:

{
  "eslintConfig": {
    "rules": {
       "no-unused-vars": "warn",
       "no-undef": "warn"
    }
  }
}

我不想禁用EsLIt,但要考虑这些细微的注释:<代码>通知<代码> > <代码>错误>代码>我不想禁用EsLIt,但要考虑这些小注释为<代码>通知< /代码>不<代码>错误< /代码>。