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
Thanks for fixing #443, however I have found some more indentation problems with Unary and Binary operators combined with Functions. Return statement is irrelevant in all cases, could as well be an variable assignment.
'use strict';// Unary Operators produce incorrect indentation with functions (return statement is irrelevant)functionaFn(){return[].reduce((p,c)=>{returnp+c;},0)/1;}functionaFn(){return1+(function(){returnarguments;})();}functionaFn(){returntypeoffunction(){returnarguments;}==='function';}functionaFn(){constb=[].reduce((p,c)=>{returnp+c;},0)/1;returnb;}// Binary Operators |, &&, instanceof and in, (possibly more?) produce incorrect indentation combined with functions (return statement is irrelevant)functionaFn(){return1|(function(){returnarguments;})();}functionaFn(a){return(function(){returnarguments;})()&&(function(){returnarguments;})();// same results if functions are not wrapped}functionaFn(a){return[function(){return;}]instanceofArray;}functionaFn(a){constb=[function(){return;}]instanceofArray;returnb;}functionaFn(a){returnain[function(){return;}];}functionaFn(a){returnfunction(){return;}instanceofFunction;}aFn();
$ esformatter test.js > test_out.js
$ eslint test_out.js
D:\github\test\test.js
6:13 error Expected indentation of 8 space characters but found 12 indent
7:9 error Expected indentation of 4 space characters but found 8 indent
12:13 error Expected indentation of 8 space characters but found 12 indent
13:9 error Expected indentation of 4 space characters but found 8 indent
18:13 error Expected indentation of 8 space characters but found 12 indent
19:9 error Expected indentation of 4 space characters but found 8 indent
24:13 error Expected indentation of 8 space characters but found 12 indent
25:9 error Expected indentation of 4 space characters but found 8 indent
38:13 error Expected indentation of 8 space characters but found 12 indent
39:9 error Expected indentation of 4 space characters but found 8 indent
46:13 error Expected indentation of 8 space characters but found 12 indent
47:9 error Expected indentation of 4 space characters but found 8 indent
52:13 error Expected indentation of 8 space characters but found 12 indent
53:9 error Expected indentation of 4 space characters but found 8 indent
60:13 error Expected indentation of 8 space characters but found 12 indent
61:9 error Expected indentation of 4 space characters but found 8 indent
66:13 error Expected indentation of 8 space characters but found 12 indent
67:9 error Expected indentation of 4 space characters but found 8 indent
73:13 error Expected indentation of 8 space characters but found 12 indent
74:9 error Expected indentation of 4 space characters but found 8 indent
79:13 error Expected indentation of 8 space characters but found 12 indent
80:9 error Expected indentation of 4 space characters but found 8 indent
✖ 22 problems (22 errors, 0 warnings)
esformatter v0.9.5
The text was updated successfully, but these errors were encountered:
@Faleij thanks a lot for the bug reports! please keep them coming!
it is a conflict with the ReturnStatement indentation, similar to what happened on #443 - will probably need to improve logic to actually check if nodes at left/right of the operator will add indentation or not (for BinaryExpression, UnaryExpression and LogicalExpression)
maybe we can abstract the logic somehow, so we don't need to implement it also for AssignmentExpression, VariableDeclaration and ObjectExpression... - I wish the whole indentation logic was simpler...
Thanks for fixing #443, however I have found some more indentation problems with Unary and Binary operators combined with Functions. Return statement is irrelevant in all cases, could as well be an variable assignment.
esformatter v0.9.5
The text was updated successfully, but these errors were encountered: