Skip to content

Commit c177ad9

Browse files
committed
Implement this.element skipping
1 parent 0d3a2ab commit c177ad9

1 file changed

Lines changed: 12 additions & 1 deletion

File tree

lib/index.js

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,18 @@ async function runForPath(path, options = {}) {
9595

9696
debug(`${componentPath}: tagName detected: %o`, tagName);
9797

98-
// TODO skip components that use `this.element` (warn)
98+
// skip components that use `this.element`
99+
let thisElementPaths = j(objectArg).find(j.MemberExpression, {
100+
object: { type: 'ThisExpression' },
101+
property: { name: 'element' },
102+
});
103+
if (thisElementPaths.length !== 0) {
104+
console.log(
105+
chalk.yellow(`${dimPath}: Using \`this.element\` is not supported in tagless components`)
106+
);
107+
continue;
108+
}
109+
99110
// TODO skip components that use `click()` etc. (warn)
100111

101112
// TODO analyze `tagName`, `attributeBindings`, `classNames`, ...

0 commit comments

Comments
 (0)