{"id":24959,"library":"babel-plugin-remove-stylename","title":"babel-plugin-remove-stylename","description":"A Babel plugin that removes styleName props from React JSX elements at build time. Developed to silence React warnings about unknown DOM props when using react-css-modules in test environments. Version 0.1.0 is the current and only stable release. This plugin is a niche utility for testing setups, with no updates since its initial release. It differs from alternatives that mock CSS modules by operating on the AST level, ensuring styleName props are completely removed from the output.","status":"active","version":"0.1.0","language":"javascript","source_language":"en","source_url":"https://github.com/Hylozoic/babel-plugin-remove-stylename","tags":["javascript","babel","plugin","css","modules","stylename","jsx","react"],"install":[{"cmd":"npm install babel-plugin-remove-stylename","lang":"bash","label":"npm"},{"cmd":"yarn add babel-plugin-remove-stylename","lang":"bash","label":"yarn"},{"cmd":"pnpm add babel-plugin-remove-stylename","lang":"bash","label":"pnpm"}],"dependencies":[{"reason":"Babel plugin API dependency","package":"babel-core","optional":false}],"imports":[{"note":"The plugin name is 'remove-stylename', not the full npm package name.","wrong":"plugins: [\"babel-plugin-remove-stylename\"]","symbol":"default","correct":"// In .babelrc or babel.config.js\nplugins: [\"remove-stylename\"]"},{"note":"Options must be in a nested array.","wrong":"plugins: [\"remove-stylename\", {}]","symbol":"with options","correct":"plugins: [[\"remove-stylename\", { /* options */ }]]"}],"quickstart":{"code":"// Install first: npm install babel-plugin-remove-stylename --save-dev\n// Then configure Babel (e.g., in package.json):\n\"babel\": {\n  \"env\": {\n    \"test\": {\n      \"plugins\": [\"remove-stylename\"]\n    }\n  }\n}\n// Example input: <div styleName=\"container\">Hello</div>\n// Output: <div>Hello</div>","lang":"javascript","description":"Babel configuration to remove styleName props only in test environment."},"warnings":[{"fix":"Run jest with --no-cache flag or clear cache manually.","message":"Jest caches Babel transformations aggressively; you may need to run with --no-cache after installing or modifying this plugin.","severity":"gotcha","affected_versions":">=0.0.0"},{"fix":"Use 'remove-stylename' as the plugin name.","message":"Plugin name in Babel config must be 'remove-stylename', not the full package name 'babel-plugin-remove-stylename'.","severity":"gotcha","affected_versions":">=0.0.0"},{"fix":"Combine with other CSS module mocking in tests if needed.","message":"Plugin only affects JSX elements with styleName attribute; it does not handle CSS module imports or class name resolution.","severity":"gotcha","affected_versions":">=0.0.0"}],"env_vars":null,"last_verified":"2026-05-01T00:00:00.000Z","next_check":"2026-07-30T00:00:00.000Z","problems":[{"fix":"Run 'npm install babel-plugin-remove-stylename --save-dev' and ensure node_modules is present.","cause":"Plugin not installed or Babel cannot find it.","error":"ReferenceError: [BABEL] unknown: Unknown plugin \"remove-stylename\" specified in ..."},{"fix":"Add '@babel/preset-react' to your Babel presets in test environment.","cause":"Babel configuration with plugin but missing @babel/preset-react.","error":"Jest encountered an unexpected token when processing JSX after adding the plugin."},{"fix":"Verify the plugin is in the 'test' env section of Babel config and that Jest uses babel-jest.","cause":"Plugin not applied in the correct environment (e.g., test only).","error":"The styleName attribute is not being removed in output."}],"ecosystem":"npm","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}