-
-
Notifications
You must be signed in to change notification settings - Fork 632
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
Resolve 14.1.1 incompatibility with eslint & make sure that spec/dummy is linted by eslint #1693
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
This file was deleted.
This file was deleted.
Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
@@ -7,10 +7,10 @@ const envSpecificConfig = () => { | |||||||||||||||||||||||||||||||||
const path = resolve(__dirname, `${env.nodeEnv}.js`); | ||||||||||||||||||||||||||||||||||
if (existsSync(path)) { | ||||||||||||||||||||||||||||||||||
console.log(`Loading ENV specific webpack configuration file ${path}`); | ||||||||||||||||||||||||||||||||||
// eslint-disable-next-line import/no-dynamic-require, global-require | ||||||||||||||||||||||||||||||||||
return require(path); | ||||||||||||||||||||||||||||||||||
} else { | ||||||||||||||||||||||||||||||||||
return generateWebpackConfig(); | ||||||||||||||||||||||||||||||||||
} | ||||||||||||||||||||||||||||||||||
return generateWebpackConfig(); | ||||||||||||||||||||||||||||||||||
Comment on lines
+10
to
+13
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Review the control flow logic. The current implementation might have unintended behavior:
Consider this fix: const envSpecificConfig = () => {
const path = resolve(__dirname, `${env.nodeEnv}.js`);
if (existsSync(path)) {
console.log(`Loading ENV specific webpack configuration file ${path}`);
// eslint-disable-next-line import/no-dynamic-require, global-require
- return require(path);
+ const envConfig = require(path);
+ return envConfig || generateWebpackConfig();
}
return generateWebpackConfig();
}; 📝 Committable suggestion
Suggested change
|
||||||||||||||||||||||||||||||||||
}; | ||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||
module.exports = envSpecificConfig(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🛠️ Refactor suggestion
Strengthen PropTypes validation.
The
name
property should be marked as required since it's used directly in the component.📝 Committable suggestion