簡體   English   中英

Eslint 和 Prettier 行格式問題

[英]Eslint and Prettier lines formatting issue

誰遇到過同樣的問題? 我的 IDE(JetBrain WebStorm,macOS)認為下面屏幕截圖中的代碼片段格式錯誤:

在此處輸入圖片說明

但是我的隊友在 Windows 上有 JetBrains IntelliJ IDEA,並且相同的代碼對於相同的 linter 是可以的!

我們對 linter 使用相同的環境(.eslintrc、.prettierrc、.editorconfig 等)。 同時,我的 IDE 沒有引用它嘗試使用的規則,它只是向我顯示了這個提示:

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

你知道它是什么嗎?

代碼在這里(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>
);

解決。 伙計們,也許這對某人有幫助。 我進行了以下步驟:

  1. 刪除回購。
  2. 再次克隆 repo。

就是這樣!

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM