stringCaseMismatches
Reports string case method calls compared against literals with mismatched casing.
✅ This rule is included in the ts logical presets.
When using .toLowerCase() or .toUpperCase() in comparisons, the compared string literal must match the expected case.
Otherwise, the comparison will always produce the same result regardless of input.
For example, text.toLowerCase() === "VALUE" will always be false because .toLowerCase() returns a lowercase string, but "VALUE" is uppercase.
Examples
Section titled “Examples”input.toLowerCase() === "VALUE";input.toUpperCase() === "hello";input.toLowerCase() === "value";input.toUpperCase() === "HELLO";Options
Section titled “Options”This rule is not configurable.
When Not To Use It
Section titled “When Not To Use It”If you have code that intentionally uses mismatched case comparisons for testing or demonstration purposes, this rule might get in your way. You might consider using Flint disable comments and/or configuration file disables for those specific situations instead of completely disabling this rule.
Further Reading
Section titled “Further Reading”Equivalents in Other Linters
Section titled “Equivalents in Other Linters”- Biome:
noStringCaseMismatch
Made with ❤️🔥 in Boston by
Josh Goldberg and contributors.