Registry / testing / stylecleanup

stylecleanup

JSON →
library1.3.0jsnpmunverified

A CLI tool to lint and automatically fix unused style declarations in React Native and Aphrodite codebases. Version 1.3.0 is the latest stable release, with low release cadence. It works by static analysis of JS files, detecting styles that are never referenced. Key differentiators: supports both React Native and Aphrodite, offers safe (fix) and aggressive (fix-force) removal modes, and handles glob patterns for batch processing. Unlike general linting tools, it specifically targets style objects and can remove dead code programmatically.

npm install stylecleanup
INSTALL
IMPORT
SIG · STYLECLEANUP
S
stylecleanup
testingjavascriptv1.3.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.

stylecleanup (CLI)
npx stylecleanup check ./src/**/*.js
npm run stylecleanup
Primarily used as a CLI tool; install globally or use npx.
default export
Not applicable (CLI-only; no programmatic API is documented)
This package is CLI-only; there is no programmable API to import.

Shows how to install and use stylecleanup CLI to check and fix unused styles in a React Native or Aphrodite project.

// Ensure you have stylecleanup installed globally // Then run on your source files: npx stylecleanup check ./src/**/*.js // To automatically remove unused styles (safe mode): npx stylecleanup fix ./src/**/*.js // To force-remove all potentially unused styles: npx stylecleanup fix-force ./src/**/*.js
stylecleanup --version
Debug
Known issues
gotchafix command skips styles that might be used via computed property access (e.g., styles[something]), so not all unused styles are removed.
fix
Use fix-force to remove those as well, but be aware it may delete actually used styles.
affects: >=1.0
gotchaThe tool only analyzes static references; dynamic style access patterns like Object.assign or spread operators may cause false negatives.
fix
Manually review the results when using fix commands; consider adding tests to verify style usage.
affects: >=1.0
deprecatedThe project appears to be unmaintained (last update around 2017); may not work with modern Babel or newer React Native versions.
fix
Consider alternatives like ESLint plugins (eslint-plugin-react-native or eslint-plugin-styled-components) for modern projects.
affects: =1.3.0
breakingNo breaking changes documented; license is MIT but no changelog available.
fix
Test in a non-critical branch before running fix-force in production code.
affects: >=1.0
Errors
Common errors & fixes
Error: Cannot find module 'babel-core'
The tool depends on Babel 6 internally, which may not be installed or is incompatible with Babel 7+.
fix
Install babel-core explicitly: npm install babel-core@6
SyntaxError: Unexpected token import
The tool does not support ES modules (import/export) by default; may require older Babel configuration.
fix
Transpile your source files to CommonJS before running stylecleanup, or use an older codebase.
stylecleanup: command not found
Global installation missing or not in PATH.
fix
Use npx stylecleanup instead: npx stylecleanup check ./src/**/*.js
Upgrade
Version history
1.3.0latest on npm
Audit
Dependencies

No dependency data recorded yet.

Agent activity
8 hits · last 30 days
node
8
Resources
stylecleanup — npm install stylecleanup · libregistry