You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
error(`Warning: React version specified in eslint-plugin-react-settings must be a valid semver version, or "detect"; got “${settingsDefaultVersion}”. Falling back to latest version as default.`);
74
+
}
75
+
}else{
76
+
defaultVersion=ULTIMATE_LATEST_SEMVER;
77
+
}
78
+
}
79
+
47
80
// TODO, semver-major: remove context fallback
48
81
functiondetectReactVersion(context){
49
82
if(cachedDetectedReactVersion){
@@ -60,20 +93,22 @@ function detectReactVersion(context) {
60
93
}catch(e){
61
94
if(e.code==='MODULE_NOT_FOUND'){
62
95
if(!warnedForMissingVersion){
63
-
error('Warning: React version was set to "detect" in eslint-plugin-react settings, '
64
-
+'but the "react" package is not installed. Assuming latest React version for linting.');
96
+
letsentence2='Assuming latest React version for linting.';
97
+
if(defaultVersion!==ULTIMATE_LATEST_SEMVER){
98
+
sentence2=`Assuming default React version for linting: "${defaultVersion}".`;
99
+
}
100
+
error(`Warning: React version was set to "detect" in eslint-plugin-react settings, but the "react" package is not installed. ${sentence2}`);
['Warning: React version was set to "detect" in eslint-plugin-react settings, but the "react" package is not installed. Assuming default React version for linting: "16.14.0".'],
77
+
];
78
+
79
+
deletecontext.settings.react.defaultVersion;
80
+
});
81
+
82
+
it('fails nicely with an invalid default version of react',()=>{
['Warning: React version specified in eslint-plugin-react-settings must be a valid semver version, or "detect"; got “not semver”. Falling back to latest version as default.'],
90
+
['Warning: React version was set to "detect" in eslint-plugin-react settings, but the "react" package is not installed. Assuming latest React version for linting.'],
91
+
];
92
+
93
+
deletecontext.settings.react.defaultVersion;
94
+
});
95
+
68
96
it('warns only once for failure to detect react ',()=>{
0 commit comments