
Research
/Security News
Mini Shai-Hulud Campaign Hits Red Hat Cloud Services npm Packages
A mini Shai-Hulud campaign compromised Red Hat Cloud Services npm packages to steal developer and CI/CD secrets during installation.
@rolldown/plugin-jsx-remove-attributes
Advanced tools
Rolldown plugin to remove JSX attributes (e.g. data-testid)
Rolldown plugin to remove JSX attributes (e.g. data-testid).
This plugin is similar to babel-plugin-react-remove-properties but uses Rolldown's native AST parser and native magic string API instead of Babel, making it faster and requiring no additional dependencies.
pnpm add -D @rolldown/plugin-jsx-remove-attributes
import jsxRemoveAttributes from '@rolldown/plugin-jsx-remove-attributes'
export default {
plugins: [
jsxRemoveAttributes({
// options
}),
],
}
In
export default function Home() {
return (
<div data-test-id="1" data-custom="1a">
<div data-custom="2">
<h1 data-testid="3">Hello World!</h1>
</div>
</div>
)
}
Out (with default options)
export default function Home() {
return (
<div data-custom="1a">
<div data-custom="2">
<h1>Hello World!</h1>
</div>
</div>
)
}
Attributes matching /^data-test/ (data-test-id and data-testid) are removed, while data-custom is preserved.
attributesArray<string | RegExp>[/^data-test/]Patterns to match JSX attribute names to remove. Strings are exact matches.
jsxRemoveAttributes({
attributes: [/^data-test/, 'data-custom'],
})
Results of the benchmark that can be run by pnpm bench in ./benchmark directory:
name hz min max mean p75 p99 p995 p999 rme samples
· @rolldown/plugin-jsx-remove-attributes 12.9805 72.0620 107.49 77.0388 74.7614 107.49 107.49 107.49 ±9.99% 10
· @rolldown/plugin-babel 5.1662 183.08 223.91 193.56 197.79 223.91 223.91 223.91 ±5.22% 10
· @rollup/plugin-swc 11.3756 82.0540 111.68 87.9076 87.6005 111.68 111.68 111.68 ±6.98% 10
@rolldown/plugin-jsx-remove-attributes - bench/jsx-remove-attributes.bench.ts > JSX Remove Attributes Benchmark
1.14x faster than @rollup/plugin-swc
2.51x faster than @rolldown/plugin-babel
The benchmark was ran on the following environment:
OS: macOS Tahoe 26.3
CPU: Apple M4
Memory: LPDDR5X-7500 32GB
MIT
The implementation is based on swc-project/plugins/packages/react-remove-properties (Apache License 2.0). Test cases are also adapted from it.
FAQs
Rolldown plugin to remove JSX attributes (e.g. data-testid)
The npm package @rolldown/plugin-jsx-remove-attributes receives a total of 591 weekly downloads. As such, @rolldown/plugin-jsx-remove-attributes popularity was classified as not popular.
We found that @rolldown/plugin-jsx-remove-attributes demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 4 open source maintainers collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Research
/Security News
A mini Shai-Hulud campaign compromised Red Hat Cloud Services npm packages to steal developer and CI/CD secrets during installation.

Research
/Security News
The North Korean malware loader hides in a Packagist-listed package and its GitHub branch to fetch and execute remote code in a likely Contagious Interview-style lure.

Security News
The Rust project is moving toward formal rules on LLM use in contributions after months of internal debate over maintainer burden, code quality, and contributor experience.