Issue
I'm using React with Typescript. Locally i configured eslint
to treat unused variable as warning.
When i run npm run build
locally it work, but in gitlab ci i'm getting this error :
npm run build
> optimal-move@0.1.0 build
> react-scripts build
Creating an optimized production build...
Treating warnings as errors because process.env.CI = true.
Most CI servers set it automatically.
Failed to compile.
[eslint]
src/common/components/MAppBar/MAppBar.tsx
Line 4:8: 'Divider' is defined but never used no-unused-vars
Line 4:8: 'Divider' is defined but never used @typescript-eslint/no-unused-vars
You can see the gitlab repo in question here. Where .eslintrc.js
and .gitlab-ci.yml
are well configured to me.
How to tell Gitlab CI to ignore warning ??
ps: i want to build in order to serve the app in gitlab pages
Solution
You need to set your CI
environment variable to false. See this line in the log you posted:
Treating warnings as errors because process.env.CI = true.
To get GitLab CI to ignore this, you should set CI = "false"
in the variables
section of your '.gitlab-ci.yml' (https://gitlab.com/anesboz/optimal-move/-/blob/feature/ci-cd/.gitlab-ci.yml#L7)
Answered By - James
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.