Skip to content

Commit 29f9f22

Browse files
committed
feature: @putout/plugin-math: remove-unchanged-zero-declaration: exclude assertions
1 parent 774b9a0 commit 29f9f22

File tree

3 files changed

+14
-0
lines changed

3 files changed

+14
-0
lines changed
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
const BUTTON_LEFT = 0;
2+
3+
if (event.button === BUTTON_LEFT)
4+
toggleSelect(key, files);

packages/plugin-math/lib/remove-unchanged-zero-declarations/index.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,11 @@ module.exports.traverse = ({push}) => ({
4848
for (const {parent} of referencePaths) {
4949
if (!isBinaryExpression(parent))
5050
return;
51+
52+
const {operator} = parent;
53+
54+
if (!/^[+-]$/.test(operator))
55+
return;
5156
}
5257

5358
push({

packages/plugin-math/lib/remove-unchanged-zero-declarations/index.spec.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,3 +43,8 @@ test('math: remove-unchanged-zero-declarations: no report: not-referenced', (t)
4343
t.noReport('not-referenced');
4444
t.end();
4545
});
46+
47+
test('math: remove-unchanged-zero-declarations: no report: assert', (t) => {
48+
t.noReport('assert');
49+
t.end();
50+
});

0 commit comments

Comments
 (0)