🚨 DEPRECATED, please use react-remove-properties from the SWC project instead. 🚨
swc-plugin-jsx-remove-attribute is a plugin for swc used to remove a specified set of attributes from JSX elements.
NOTE: we don't have the capacity to maintain this all the time, bug support and updates are not guaranteed.
If you don't already have swc setup, you can follow their getting started guide.
Add swc-plugin-jsx-remove-attribute to your dependencies like so:
Yarn v1:
yarn add https://github.com/Fullscript/swc-plugin-jsx-remove-attribute.git#1.0.0
Yarn v2 (and onwards):
yarn add @fullscript/swc-plugin-jsx-remove-attribute@https://github.com/Fullscript/swc-plugin-jsx-remove-attribute.git#1.0.0
NPM:
npm install https://github.com/Fullscript/swc-plugin-jsx-remove-attribute.git#1.0.0
Wherever your SWC configuration is located, add the following:
{
jsc: {
...
experimental: {
plugins: [
[
"@fullscript/swc-plugin-jsx-remove-attribute",
{
// You can add as many attribute names in here as you want
attributesToRemove: ["data-testid"],
},
],
]
}
}
}
Bug reports and pull requests are welcome :)
- Run:
cargo build-wasi --release
- Copy the resulting wasm file to the root of the project:
cp ./target/wasm32-wasi/release/swc_plugin_jsx_remove_attribute.wasm .
- Commit and push!