简体   繁体   English

Eslint 和 Prettier 行格式问题

[英]Eslint and Prettier lines formatting issue

who faced with same issue?谁遇到过同样的问题? My IDE (JetBrain WebStorm, macOS) consider the code snippet at the screenshot below as a wrong formatted one:我的 IDE(JetBrain WebStorm,macOS)认为下面屏幕截图中的代码片段格式错误:

在此处输入图片说明

But my teammate has JetBrains IntelliJ IDEA on Windows, and the same code is OK for the same linter!但是我的队友在 Windows 上有 JetBrains IntelliJ IDEA,并且相同的代码对于相同的 linter 是可以的!

We use the same environment for linters (.eslintrc, .prettierrc, .editorconfig, etc.).我们对 linter 使用相同的环境(.eslintrc、.prettierrc、.editorconfig 等)。 In the same time, my IDE does not refer to the rule it's trying to use, it just shows me this hint:同时,我的 IDE 没有引用它尝试使用的规则,它只是向我显示了这个提示:

ESLint: Insert ⏎····· (prettier/prettier) ESLint: Insert ⏎····· (prettier/prettier)

Do you know what can it be?你知道它是什么吗?

The code is here (JSX, React):代码在这里(JSX,React):

const DBFieldInfoBlock = ({
  rowClassName,
  cellLabelClassName,
  cellValueClassName,
  id,
  value,
  currency,
}) => (
  <div className={rowClassName}>
    <span className={cellLabelClassName}>
      <InfoLabel id={id} />:
    </span>
    {value !== undefined && value !== null && (
      <span className={cellValueClassName}>
        <InfoValue value={value} id={id} currency={currency} />
      </span>
    )}
  </div>
);

Resolved.解决。 Guys, perhaps it will be helpful for someone.伙计们,也许这对某人有帮助。 I proceeded following steps:我进行了以下步骤:

  1. Delete the repo.删除回购。
  2. Clone the repo again.再次克隆 repo。

That's it!就是这样!

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM