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
[linter] Improve do_not_use_environment lint error message and documentation
Replaces confusing "Invalid use of an environment declaration" message
with clear, actionable guidance that explains WHY environment constructors
should be avoided and WHAT to use instead.
Changes:
- Problem message: Now includes specific method name and explains it creates "hidden global state"
- Correction message: Suggests Platform.environment for runtime access
- Documentation: Added comprehensive examples showing both bad and good patterns
- Implementation: Pass method name to error message for better specificity
- Tests: Added comprehensive test coverage for all variants and edge cases
Before: "Invalid use of an environment declaration."
After: "Avoid using environment values like 'bool.hasEnvironment' which create hidden global state."
The new message clearly explains:
1. WHAT is wrong (creates hidden global state)
2. WHY it's problematic (unpredictable across environments)
3. WHAT to do instead (use Platform.environment)
Fixes#59203
0 commit comments