Indent rule and smart pipeline operator causes error in es6 class method.
optijon opened this issue · comments
I'm getting the following error when trying to use the smart pipeline operator within an es6 class method.
return someAlarm
|> _.map(#, "level")
TypeError: Cannot read property 'match' of undefined
Occurred while linting /Projects/project/source/javascript/store/alarm-store.js:1
at countTrailingLinebreaks (/Projects/project/node_modules/eslint/lib/rules/indent.js:788:47)
at elements.forEach (/Projects/project/node_modules/eslint/lib/rules/indent.js:855:65)
at Array.forEach (<anonymous>)
at addElementListIndent (/Projects/project/node_modules/eslint/lib/rules/indent.js:830:22)
at Object.addFunctionCallIndent [as listener] (/Projects/project/node_modules/eslint/lib/rules/indent.js:923:13)
at Program:exit.listenerCallQueue.filter.forEach.nodeInfo (/Projects/project/node_modules/eslint/lib/rules/indent.js:1546:55)
at Array.forEach (<anonymous>)
at Program:exit (/Projects/project/node_modules/eslint/lib/rules/indent.js:1546:26)
at listeners.(anonymous function).forEach.listener (/Projects/project/node_modules/eslint/lib/linter/safe-emitter.js:45:58)
at Array.forEach (<anonymous>)
This seems to work if I switch _.map
to #.map
and the error is occurring on any function with an arity of 2 or more. I do not get this error when I move the pipeline to a function outside of a class. Removing the indent rule in eslint seems to resolve the error as well.
rules: {
"indent": [ "warn", 2, { "SwitchCase": 1 } ],
...
I'm using eslint-babel version 11.0.0-beta.0
.
Thank you for the PR. Now that @babel/eslint-parser
has been released, we are making this repository read-only. If this is a change you would still like to advocate for, please reopen this in the babel/babel monorepo.