![](/img/trans.png)
[英]How to discriminate JSON code formatting by removing empty lines using 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>
);
解決。 伙計們,也許這對某人有幫助。 我進行了以下步驟:
就是這樣!
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.