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
The fluent-chaining rule emits this error message:
Identifier "undefined" should be on a new line
for code that contains both chained method calls and array access. For example:
url=url// Remove any query string:.split('?')[0]// Remove any hash:.split('#')[0];
The above code strips the query string and hash from a URL. Both of the [0] array access statements trigger an error for the fluent-chaining rule with the error message "Identifier "undefined" should be on a new line".
True, we could rewrite this as:
// Remove any query string:url=url.split('?')[0];// Remove any hash:url=url.split('#')[0];
but personally I like the simplicity of the chained method calls, particularly if there were more needed.
Should we support this pattern?
If so, we need to modify the fluent-chaining rule to support this case.
If not, we probably need to fix the error message so that it doesn't print "undefined" where it seems it should print some identifier name. Additionally, when you apply ESLint's suggested auto-fix, you get:
url=url// Remove any query string.split('?').0]
which removes one of the array access statement's braces and creates invalid JavaScript.
The text was updated successfully, but these errors were encountered:
The fluent-chaining rule emits this error message:
for code that contains both chained method calls and array access. For example:
The above code strips the query string and hash from a URL. Both of the
[0]
array access statements trigger an error for the fluent-chaining rule with the error message "Identifier "undefined" should be on a new line".True, we could rewrite this as:
but personally I like the simplicity of the chained method calls, particularly if there were more needed.
Should we support this pattern?
If so, we need to modify the fluent-chaining rule to support this case.
If not, we probably need to fix the error message so that it doesn't print "undefined" where it seems it should print some identifier name. Additionally, when you apply ESLint's suggested auto-fix, you get:
which removes one of the array access statement's braces and creates invalid JavaScript.
The text was updated successfully, but these errors were encountered: