Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix ESLint 6 support #7513

Merged
merged 2 commits into from Aug 13, 2019
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
19 changes: 5 additions & 14 deletions packages/react-scripts/config/webpack.config.js
Expand Up @@ -340,21 +340,12 @@ module.exports = function(webpackEnv) {
// @remove-on-eject-begin
baseConfig: (() => {
const eslintCli = new eslint.CLIEngine();
let eslintConfig;
try {
eslintConfig = eslintCli.getConfigForFile(paths.appIndexJs);
} catch (e) {
// A config couldn't be found.
}
const eslintConfig = eslintCli.getConfigForFile(
Copy link
Contributor

@mrmckeb mrmckeb Aug 12, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This threw an error previously if a file wasn't found. I understand it doesn't now?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think I may have been getting lucky (eslint config somewhere up the file system tree perhaps?). I was seeing errors in CI so i've reverted to include the catch again.

I also observed a strange error on our PNP test that failed due to eslint-config-react-app not being defined in package.json. This catch block is catching that error on master it appears.

paths.appIndexJs
);

// We allow overriding the config, only if it extends our config
// (`extends` can be a string or array of strings).
if (
process.env.EXTEND_ESLINT &&
eslintConfig &&
eslintConfig.extends &&
eslintConfig.extends.includes('react-app')
) {
// We allow overriding the config only if the env variable is set
if (process.env.EXTEND_ESLINT && eslintConfig) {
return eslintConfig;
} else {
return {
Expand Down