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
String.startsWith() and String.includes() were introduced in ES6 and are great. Very readable.
I'd like to suggest a rule that looks for String.indexOf(a) !== -1 and String.indexOf(a) === 0 and warns or errors for these, telling the user to change them to String.startsWith() and String.includes()
Could also auto fix these
Source code from another eslint plugin with these rules here and here (MIT license)
The text was updated successfully, but these errors were encountered:
Alternatively the rules could be applied to ES2016 rules only, where Array.indexOf can also be replaced by Array.includes, and so the type wouldn't matter
String.startsWith()
andString.includes()
were introduced in ES6 and are great. Very readable.String.indexOf(a) !== -1
andString.indexOf(a) === 0
and warns or errors for these, telling the user to change them toString.startsWith()
andString.includes()
Source code from another eslint plugin with these rules here and here (MIT license)
The text was updated successfully, but these errors were encountered: