Skip to content

Commit d8228f3

Browse files
committed
feature: @putout/plugin-apply-shorthand-properties: computed: exclude
1 parent ecee7cb commit d8228f3

File tree

3 files changed

+12
-1
lines changed

3 files changed

+12
-1
lines changed

packages/plugin-apply-shorthand-properties/lib/apply-shorthand-properties.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,11 +26,14 @@ export const traverse = ({push, options}) => ({
2626
},
2727
'__object'(path) {
2828
for (const propPath of path.get('properties')) {
29-
const {shorthand} = propPath.node;
29+
const {computed, shorthand} = propPath.node;
3030

3131
if (shorthand)
3232
continue;
3333

34+
if (computed)
35+
continue;
36+
3437
const valuePath = propPath.get('value');
3538
const keyPath = propPath.get('key');
3639

packages/plugin-apply-shorthand-properties/test/apply-shorthand-properties.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -104,6 +104,11 @@ test('plugin-apply-shorthand-properties: no transform: import-declaration', (t)
104104
t.end();
105105
});
106106

107+
test('plugin-apply-shorthand-properties: no report: computed', (t) => {
108+
t.noReport('computed');
109+
t.end();
110+
});
111+
107112
testWithRemove('plugin-apply-shorthand-properties: transform with options: assign', (t) => {
108113
t.transformWithOptions('assign', {
109114
rename: true,
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
const a = {
2+
[hello]: hello,
3+
}

0 commit comments

Comments
 (0)