Skip to content

Commit 80ed399

Browse files
committed
Implement tagName: '' assignment
1 parent f81ec5d commit 80ed399

1 file changed

Lines changed: 11 additions & 1 deletion

File tree

lib/transform.js

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,17 @@ function transform(componentPath) {
127127
}
128128
debug(`${componentPath}: templatePath: %o`, templatePath);
129129

130-
// TODO set `tagName: ''`
130+
// set `tagName: ''`
131+
let tagNamePath = j(properties)
132+
.find(j.ObjectProperty)
133+
.filter(path => path.parentPath === properties)
134+
.filter(path => isProperty(path, 'tagName'));
135+
136+
if (tagNamePath.length === 1) {
137+
j(tagNamePath.get('value')).replaceWith(j.stringLiteral(''));
138+
} else {
139+
properties.unshift(j.objectProperty(j.identifier('tagName'), j.stringLiteral('')));
140+
}
131141

132142
// remove `elementId`, `attributeBindings`, `classNames` and `classNameBindings`
133143
j(properties)

0 commit comments

Comments
 (0)