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
unicorn/prefer-string-slice is good when all the parameters are constants, or when there is only one parameter. But when there are two parameters and they're variables, the autofixes will do things like this:
Slice supports negative indices: summary.slice( 0, -2 ). It may be possible to have the fixer recognise this specific use case, but that would be an issue for upstream...
unicorn/prefer-string-slice is good when all the parameters are constants, or when there is only one parameter. But when there are two parameters and they're variables, the autofixes will do things like this:
editsummary = editsummary.substr(0, editsummary.length - 2); // remove trailing comma
->
editsummary = editsummary.slice(0, Math.max(0, editsummary.length - 2)); // remove trailing comma
I find the Math.max pretty hard to read. I'd prefer that it not autofix that particular sub-pattern. Thoughts?
The text was updated successfully, but these errors were encountered: