You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
23 lines
515 B
23 lines
515 B
2 years ago
|
"use strict";
|
||
|
|
||
|
exports.__esModule = true;
|
||
|
exports.default = void 0;
|
||
|
|
||
|
const removeJSXAttribute = (api, opts) => ({
|
||
|
visitor: {
|
||
|
JSXOpeningElement(path) {
|
||
|
if (!opts.elements.includes(path.node.name.name)) return;
|
||
|
path.get('attributes').forEach(attribute => {
|
||
|
const nodeName = attribute.node.name;
|
||
|
|
||
|
if (nodeName && opts.attributes.includes(nodeName.name)) {
|
||
|
attribute.remove();
|
||
|
}
|
||
|
});
|
||
|
}
|
||
|
|
||
|
}
|
||
|
});
|
||
|
|
||
|
var _default = removeJSXAttribute;
|
||
|
exports.default = _default;
|