Babel plugin for stripping object properties from AST nodes that match a supplied regex pattern. The current stable version is 1.0.2, released with low release cadence. It works during Babel's transpilation phase, removing nodes of type 'ObjectProperty' via regex. Unlike generic Babel visitors or AST manipulation utilities, this plugin provides a simple configurable approach to remove object properties (e.g., data-* attributes in React). Suitable for cleaning test attributes from production builds. Has minimal dependencies and is distributed on npm.
npm install babel-plugin-remove-object-propertiesNo compatibility data collected yet for this library.
Verified import paths — ran on the pinned version, not inferred.
Configures Babel plugin to remove properties matching 'data-*' regex from JSX elements.
Use a proper regex like '^data-' to match keys starting with 'data-'.
Restrict usage to specific files or conditions if unwanted removal occurs.
Test with your Babel version; consider using modern alternatives like babel-plugin-strip-sourcemap or custom visitor.
Use double array syntax: "plugins": [["remove-object-properties", { "regexp": "data-*" }]]Run npm install babel-plugin-remove-object-properties --save-dev
Use string form: "regexp": "data-*" (not /data-*/)
No dependency data recorded yet.