Created by: n1ru4l
Based on the following discussion that got no response:
https://github.com/facebook/create-react-app/pull/7513#pullrequestreview-274168733 https://github.com/facebook/create-react-app/pull/7513#issuecomment-520872886 https://github.com/facebook/create-react-app/issues/7510#issuecomment-520336416
Summary:
Swallowing the eslint config error is not a good idea
The line eslintConfig = eslintCli.getConfigForFile(paths.appIndexJs);
can throw in case the provided eslint config is invalid, e.g. when there is a typo or a plugin dependency is missing. Swallowing that error in case the user explicitly sets the EXTEND_ESLINT
environment variable (and therefore expects that his eslint config is used) makes debugging such issues unnecessary cumbersome.
The eslint config should only be loaded in case the user wants to load it
The eslint config is never used in case the EXTEND_ESLINT
is not set. Therefore it makes sense to only resolve it's path in case the environment variable is set.