sindresorhus/eslint-plugin-unicorn
`prefer-at` should also mark substrings of length 1
Chiusa
#2203 aperta il 22 ott 2023
enhancementhelp wanted
Metriche repository
- Star
- (5022 stelle)
- Metriche merge PR
- (Merge medio 1g 16h) (399 PR mergiate in 30 g)
Descrizione
Description
The prefer-at rule should also check for substrings of length 1.
Fail
string.substring(0, 1)
string.substring(value, value + 1)
string.substring(value, 1 + value)
string.substring(value - 1, value)
Pass
string[0]
string[value]
string[value - 1]
or
string.at(0)
string.at(value)
string.at(value - 1)
And maybe:
string.charAt(0)
string.charAt(value)
string.charAt(value - 1)
Additional Info
No response