Skip to content

Conversation

@zglicz
Copy link
Contributor

@zglicz zglicz commented Dec 26, 2025

Summary

  • Fix warning from eslint-plugin-react when React version in package.json contains a range (e.g., ^18.0.0)
  • Use semver.minVersion() to coerce version ranges to valid semver versions

Problem

When package.json contains:

{
  "dependencies": {
    "react": "^18.0.0"
  }
}

eslint-plugin-react would output a warning because it expects a valid semver version, not a range.

Solution

Coerce the version range to the minimum version that satisfies it:

  • ^18.0.018.0.0
  • >=17.0.017.0.0
  • 18.2.018.2.0 (exact versions unchanged)

Fixes https://sonarsource.atlassian.net/browse/JS-536

Test plan

  • Added test fixture with version range (^18.0.0)
  • Added unit test verifying deprecations are correctly detected
  • Existing tests still pass

🤖 Generated with Claude Code

When the React version in package.json contains a range (e.g., "^18.0.0"),
eslint-plugin-react would output a warning because it expects a valid
semver version, not a range.

Fix: Use semver.minVersion() to coerce version ranges to the minimum
valid version that satisfies the range.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <[email protected]>
@hashicorp-vault-sonar-prod
Copy link

hashicorp-vault-sonar-prod bot commented Dec 26, 2025

JS-536

@sonarqube-next
Copy link

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant