Skip to content

Option not to fail build on warnings in CI environment #2453

Closed

Description

@varnav

Currently if CI environment variable is set to true, and any warnings emitted, build fails (#944). There is no way to alter this behavior other than unsetting CI envvar that may be undesirable. You cannot even customize the rule set (#808).
Please add command-line option like --no-fail-on-warnings or add any other way to make this less strict.

https://github.com/facebookincubator/create-react-app/blob/master/packages/react-scripts/scripts/build.js#L115

Activity

  1. gaearon commented on Jun 2, 2017

    @gaearon
    Contributor

    What warnings specifically do you want to ignore?

  2. varnav commented on Jun 2, 2017

    @varnav
    ContributorAuthor

    We are at the early stages of development of UI, and warning that annoys us most is 'jsx-a11y/alt-text' about no alt inside img. We intentionally don't have these for now.

    But I would prefer just to have control over ESlint ruleset.

  3. Timer commented on Jun 6, 2017

    @Timer
    Contributor

    @varnav you can disable eslint warnings by adding the lines suggested to you in your development console while running npm start.

  4. varnav commented on Jun 6, 2017

    @varnav
    ContributorAuthor

    I don't run npm start during CI deployment process, and I don't want to disable all warnings. I want:

    1. Option not to fail build on warnings inside CI environment
    2. Control over eslint ruleset
  5. Timer commented on Jun 6, 2017

    @Timer
    Contributor

    You can place //eslint-disable jsx-a11y/alt-text (or similar) at the top of the file to only disable that warning (and not all warnings). This has the effect in development and production builds, I was simply referring to development as it provides instructions for you to do so.

  6. varnav commented on Jun 7, 2017

    @varnav
    ContributorAuthor

    It works as workaround, but I will have to change about 40 files. It would be better to have centralized control over this.

  7. Timer commented on Jun 7, 2017

    @Timer
    Contributor

    Unfortunately you cannot have control of this unless if you eject; being mindful of accessibility when you are creating images doesn't take very long.

    Is there something wrong with adding alt="TODO" when you create an image? This makes it very easy later on to find where you need to fix these problems, rather than ignore it all together.

    If you explicitly would like to not provide an alt, alt="" will mute the warning and is also relatively searchable.

  8. varnav commented on Jun 7, 2017

    @varnav
    ContributorAuthor

    You probably right, but in reality it looks different. I don't write js, I'm admin and I do DevOps things. And I have chats like this:

    Programmers: Hey, build of our code fails in your CI!
    Me: It's because you have warnings
    P: But backend guys have warnings too, their build is ok. What can we do?
    M: Fix warnings
    P: We have tasks, we have deadlines, we can't do this, it's 250 lines in 40 files!
    M: Ok, then add this to mute warnings to your files
    P: All 40 files? We have tasks, we have deadlines. We gonna complain to your supervisor!
    M: Sorry guys, I don't have control over fails/not fails on warnings, and over eslint ruleset too!
    P: Yes, it's exactly what we gonna tell your supervisor. You don't have control over CI builds that are your direct responsibility!

  9. Timer commented on Jun 7, 2017

    @Timer
    Contributor

    FWIW this has been discussed before and warnings purposely fail CI builds by default. This is good practice.

    Disabling this functionality is normally done by setting CI=false (as you mentioned in your first post); why is this not a viable option?

    To clarify, setting CI=false is already the official solution to this / the option you are looking for.
    If you can elaborate why this option is not good enough for you, we are more than happy to consider adding another solution.

  10. varnav commented on Jun 7, 2017

    @varnav
    ContributorAuthor

    This is strange, because we have 5 more different languages built in CI, and nowhere else build fails on warnings.
    Setting CI to false does not help, only unsetting does. But is this a good idea? Is this variable used somewhere else?

  11. Timer commented on Jun 7, 2017

    @Timer
    Contributor

    Setting CI to false does not help, only unsetting does.

    If this is the case, then this is a bug. Setting CI to be false should disable warnings.

    But is this a good idea? Is this variable used somewhere else?

    As described in Advanced Configuration, setting CI only makes npm test non-watching and makes npm run build warnings failures. There are no other side-effects, so this is completely safe to do.

    Make sure you're only doing this for the npm run build command, however. You probably should not unset it in your entire test/CI environment.

  12. Timer commented on Jun 7, 2017

    @Timer
    Contributor

    It seems that setting CI to false will indeed still treat the variable as true.

    As a temporary work-around, you can set CI to be blank via CI="" npm run build in your test script.

    We're happy to accept a PR that looks for the value 'false'.

  13. 11 remaining items

  14. added this to the 1.0.8 milestone on Jun 22, 2017
  15. varnav commented on Jun 27, 2017

    @varnav
    ContributorAuthor

    I don't really think that it's ok to close this issue, as "Option not to fail build on warnings in CI environment" still does not exist.

  16. gaearon commented on Jun 28, 2017

    @gaearon
    Contributor

    I don't think we'll be adding an option for this. But we're happy to address individual warnings that "shouldn't be warnings" on a case by case basis. If you see an unnecessary warning please file an issue.

  17. bompi88 commented on Dec 5, 2017

    @bompi88

    This is not a preferable solution when a lot of frameworks and libraries depend on the CI variable in different ways. My build now fails because of named imports, which are not in alphabetical order.

  18. Timer commented on Dec 5, 2017

    @Timer
    Contributor

    We do not enforce a rule about alphabetical ordering -- it sounds like you have your own rules in place.

    If you have an problem, please file a new issue. Thanks!

  19. locked and limited conversation to collaborators on Dec 5, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions