首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >ESLint显示EditorConfig配置错误

ESLint显示EditorConfig配置错误
EN

Stack Overflow用户
提问于 2019-01-12 09:54:43
回答 1查看 1.1K关注 0票数 1

我已经创建了一个默认的Nuxt项目,并选择了ESLint和更漂亮的项目。我已经打开了应用程序,并按了快捷键重新格式化的代码。当我运行nuxt项目时,ESLint会在index.vue页面上显示错误,用于缩进。

以下是ESLint、EditorConfig和index.vue代码。

ESLint:

代码语言:javascript
复制
module.exports = {
  root: true,
  env: {
    browser: true,
    node: true
  },
  parserOptions: {
    parser: 'babel-eslint'
  },
  extends: [
    'plugin:vue/recommended',
    'plugin:prettier/recommended'
  ],
  // required to lint *.vue files
  plugins: [
    'vue',
    'prettier'
  ],
  // add your custom rules here
  rules: {
    'no-console': process.env.NODE_ENV === 'production' ? 'error' : 'off',
    'no-debugger': process.env.NODE_ENV === 'production' ? 'error' : 'off'
  }
}

EditorConfig:

代码语言:javascript
复制
# editorconfig.org
root = true

[*]
indent_style = space
indent_size = 2
end_of_line = lf
charset = utf-8
trim_trailing_whitespace = true
insert_final_newline = true

[*.md]
trim_trailing_whitespace = false

index.vue:

代码语言:javascript
复制
<template>
  <section class="container">
    ...
  </section>
</template>

<script>
  import Logo from '~/components/Logo.vue'

  export default {
    components: {
      Logo
    }
  }
</script>

<style>
  .container {
    min-height: 100vh;
    ...
  }
  ...
</style>

因此,错误发生在<script>...</script><style>...</style>部分。有人能指导我如何让ESLint与EditorConfig缩进一起工作吗?如果有帮助的话,我将使用Webstorm作为IDE。

EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2019-01-12 14:27:54

你能看到哪些错误?是关于<style><script>中的代码向右移动而不是与标记对齐吗?这是一个已知的问题,原因是缺乏针对.vue文件的专用代码样式设置;它是在WEB-30382中跟踪的。

作为一种解决办法,尝试将scriptstyle条目添加到设置-设置-编辑器-代码样式

票数 3
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/54158458

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档