Skip to content

Commit 6b36f0b

Browse files
committed
feature: @putout/plugin-split-assignment-expressions: false positive: MemberExpression with SequenceExpression property
1 parent 0f13915 commit 6b36f0b

File tree

3 files changed

+13
-0
lines changed

3 files changed

+13
-0
lines changed

packages/plugin-split-assignment-expressions/lib/split-assignment-expressions.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@ const {replaceWithMultiple} = operator;
55
const {
66
isAssignmentExpression,
77
AssignmentExpression,
8+
isMemberExpression,
9+
isSequenceExpression,
810
} = types;
911

1012
module.exports.report = () => `Split assignment expressions`;
@@ -35,6 +37,9 @@ module.exports.traverse = ({push}) => ({
3537
if (!isAssignmentExpression(right))
3638
return;
3739

40+
if (isMemberExpression(right.left) && isSequenceExpression(right.left.property))
41+
return;
42+
3843
const lefts = [
3944
[operator, left],
4045
[right.operator, right.left],
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
currentDir = dirname(currentDir)
2+
[currentDir, currentType] = getParentPath(currentDir, filesystem);
3+

packages/plugin-split-assignment-expressions/test/split-assignment-expressions.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,3 +28,8 @@ test('putout: split-assignment-expressions: transform', (t) => {
2828
t.transform('split-assignment-expressions');
2929
t.end();
3030
});
31+
32+
test('putout: split-assignment-expressions: no report: separate', (t) => {
33+
t.noReport('separate');
34+
t.end();
35+
});

0 commit comments

Comments
 (0)