[Bug]: Confusing error message when you accidentally set defaultVersion to 'detect' instead of version

Author: liamkearnutasCreated Sep 24, 2026Updated Sep 26, 2026
Labelsbug

Is there an existing issue for this?

  • I have searched the existing issues and my issue is unique
  • My issue appears in the command-line and not only in the text editor

Description Overview

https://github.com/jsx-eslint/eslint-plugin-react/blob/c99d3b274efbc593e46563358e7b77cad8d01957/lib/util/version.js#L73 with:

typescript
{
    settings: {
        react: {
            defaultVersion: 'detect',
        },
    },
}

Instead of:

typescript
{
    settings: {
        react: {
            version: 'detect',
        },
    },
}

Results in: Warning: React version specified in eslint-plugin-react-settings must be a valid semver version, or "detect"; got “detect”. Falling back to latest version as default..

Expected Behavior

A more reasonable error message.

It should be mentioned that this is the default as specified here: https://github.com/jsx-eslint/eslint-plugin-react/blob/c99d3b274efbc593e46563358e7b77cad8d01957/lib/util/version.js#L66

Moreover this is already the default codepath so 'detect' isn't a valid value here so this error message should just say something like: Warning: default React version specified in eslint-pluigin-react-settings must be a valid semvar constraint; got "${typeof settingsDefaultVersion}"

eslint-plugin-react version

N/A

eslint version

N/A

node version

N/A

Source: jsx-eslint/eslint-plugin-react