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

only load eslint config when EXTEND_ESLINT environment variable is specified/ do not swallow eslint config errors #7530

Merged
merged 2 commits into from
Sep 27, 2019
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 9 additions & 9 deletions packages/react-scripts/config/webpack.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -343,16 +343,16 @@ module.exports = function(webpackEnv) {
resolvePluginsRelativeTo: __dirname,
// @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.
}

// We allow overriding the config only if the env variable is set
if (process.env.EXTEND_ESLINT === 'true' && eslintConfig) {
if (process.env.EXTEND_ESLINT === 'true') {
const eslintCli = new eslint.CLIEngine();
let eslintConfig;
try {
eslintConfig = eslintCli.getConfigForFile(paths.appIndexJs);
} catch (e) {
console.error(e);
process.exit(1);
}
return eslintConfig;
} else {
return {
Expand Down