首页 > 解决方案 > 在circleci中构建反应应用程序时如何使eslint工作?

问题描述

我在我的个人项目上配置 eslint 以允许console.log成为警告而不是错误,因此在本地我的应用程序编译成功。

当我npm run build在本地跑步时

Creating an optimized production build...
Compiled with warnings.

src/components/ReduxName/ReduxName.tsx
  Line 12:3:  Unexpected console statement  no-console

Search for the keywords to learn more about each warning.
To ignore, add // eslint-disable-next-line to the line before.

这很好,一切正常。但是当我在circleci中跑步时

Creating an optimized production build...

Treating warnings as errors because process.env.CI = true.
Most CI servers set it automatically.

Failed to compile.

src/components/ReduxName/ReduxName.tsx
  Line 12:3:  Unexpected console statement  no-console

好像 circleci 不认识我的 eslint 设置???知道如何度过这个难关吗?

标签: continuous-integrationcreate-react-appeslintcircleci

解决方案


原来问题就在我眼前

Treating warnings as errors because process.env.CI = true.
Most CI servers set it automatically.

警告被视为 CI 上的错误,当然我的应用程序无法编译。我通过专门console.log在 eslint 中不发出警告来修复它并解决了问题。


推荐阅读