如何禁用Yarn自动格式化代码

问题描述 投票:1回答:1

我有一个突然出现的文件,好像我在git中对它进行了一些更改。我想跑:

git checkout -- <file>

在我要放弃所有更改的文件上。但是,如果我运行git status,它会在那里再次出现。我甚至试图运行git stash,但同样的事情发生了。当我运行git status时,该文件不断显示为未分级。

git status
On branch master
Your branch is up to date with 'origin/master'.

Changes not staged for commit:
  (use "git add <file>..." to update what will be committed)
  (use "git checkout -- <file>..." to discard changes in working directory)

        modified:   packages/fp/src/support/SupportIndex.jsx

no changes added to commit (use "git add" and/or "git commit -a"). 

我认为可能是Intellij格式化代码并重建文件,但在进一步检查时,这似乎只有在我运行qazxsw poi时才会发生。

yarn

当我运行它时,它会重新格式化该文件中的代码,因此它总是显示为已更改。我知道纱线有一个标志不能做到这一点,但我不记得它是哪一个或找到它?

git yarnpkg
1个回答
2
投票

如果您想禁用格式化代码的纱线,您应该使用yarn run dev 标志运行它。在你的情况下:

纱线运行dev --no-fix

这将--no-fix设置为eslint-loader option 'fix'

© www.soinside.com 2019 - 2024. All rights reserved.