index.js 515 B

1234567891011121314151617181920212223
  1. "use strict";
  2. exports.__esModule = true;
  3. exports.default = void 0;
  4. const removeJSXAttribute = (api, opts) => ({
  5. visitor: {
  6. JSXOpeningElement(path) {
  7. if (!opts.elements.includes(path.node.name.name)) return;
  8. path.get('attributes').forEach(attribute => {
  9. const nodeName = attribute.node.name;
  10. if (nodeName && opts.attributes.includes(nodeName.name)) {
  11. attribute.remove();
  12. }
  13. });
  14. }
  15. }
  16. });
  17. var _default = removeJSXAttribute;
  18. exports.default = _default;