Skip to content

Commit f81ec5d

Browse files
committed
Implement old properties removal
1 parent e414c47 commit f81ec5d

1 file changed

Lines changed: 17 additions & 1 deletion

File tree

lib/transform.js

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

130-
// TODO set `tagName: ''` and remove `attributeBindings`, `classNames`, ...
130+
// TODO set `tagName: ''`
131+
132+
// remove `elementId`, `attributeBindings`, `classNames` and `classNameBindings`
133+
j(properties)
134+
.find(j.ObjectProperty)
135+
.filter(path => path.parentPath === properties)
136+
.filter(
137+
path =>
138+
isProperty(path, 'elementId') ||
139+
isProperty(path, 'attributeBindings') ||
140+
isProperty(path, 'classNames') ||
141+
isProperty(path, 'classNameBindings')
142+
)
143+
.remove();
144+
145+
fs.writeFileSync(componentPath, root.toSource(), 'utf8');
146+
131147
// TODO wrap existing template with root element
132148
}
133149

0 commit comments

Comments
 (0)