Registry / testing / babel-plugin-remove-style

babel-plugin-remove-style

JSON →
library0.1.0jsnpmunverified

A Babel plugin that removes `style` props from React JSX elements, primarily used to simplify snapshot testing by excluding inline styles. Version 0.1.0 is the current and only stable release. It operates as a Babel transform, stripping style attributes during transpilation. Unlike mocking CSS modules or disabling style processing, this plugin provides a brute-force removal without side effects. Developed by Hylozoic, it targets test environments where style details are irrelevant. No updates since initial release; minimal community adoption.

npm install babel-plugin-remove-style
INSTALL
IMPORT
SIG · BABEL-PLUGIN-REMOV
B
babel-plugin-remove-style
testingjavascriptv0.1.0
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

default
module.exports = require('babel-plugin-remove-style')
import plugin from 'babel-plugin-remove-style'
CJS-only; no ESM export. Use require in Babel config.

Configures the plugin to remove style props in test environment, showing JSX transformation.

// .babelrc or babel.config.js { "env": { "test": { "plugins": ["babel-plugin-remove-style"] } } } // input.jsx const Comp = () => <div style={{ color: 'red' }}>hi</div>; // output.jsx const Comp = () => <div>hi</div>;
Debug
Known issues
gotchaPlugin removes all style props unconditionally; no selective removal or options.
fix
Use only in test environment; not for production builds.
affects: 0.1.0
gotchaJest caches transpiled code; may need --no-cache flag after installing plugin.
fix
Run jest with --no-cache or clear cache manually.
affects: >=0.1.0
Errors
Common errors & fixes
Plugin not found: 'remove-style'
Babel config uses short name 'remove-style' but package is 'babel-plugin-remove-style'. Babel only auto-resolves 'babel-plugin-' prefix for official or well-known plugins.
fix
Use full package name: ['babel-plugin-remove-style']
TypeError: .default is not a function
ESM import syntax used for CJS plugin.
fix
Use require('babel-plugin-remove-style') or in .babelrc as string.
Upgrade
Version history
0.1.0latest on npm
Audit
Dependencies

No dependency data recorded yet.

Agent activity
16 hits · last 30 days
node
14
OpenAI (training)
1
Resources