1.2.7 β€’ Published 6 months ago

react-native-style-cleaner v1.2.7

Weekly downloads
-
License
ISC
Repository
-
Last release
6 months ago

React Native Style Cleaner 🧹

A tool to detect and clean unused styles in your React Native projects.

npm version npm downloads License

Features ✨

  • Detects unused StyleSheet styles in your React Native project
  • Scans all JavaScript/TypeScript files (.js, .jsx, .ts, .tsx)
  • Automatically removes unused styles
  • Supports array-style declarations
  • Beautiful CLI output with detailed information
  • TypeScript support
  • Style usage statistics and analysis
  • Duplicate style detection
  • Style complexity analysis
  • Performance impact analysis
  • Interactive cleaning mode

Available Commands πŸ“‹

CommandDescriptionExampleOutput
cleanRemoves unused styles from your projectnpx react-native-style-cleaner clean ./srcList of removed styles
analyzeShows unused styles without removing themnpx react-native-style-cleaner analyzeList of unused styles
statsDisplays style usage statisticsnpx react-native-style-cleaner statsUsage counts, most/least used styles
duplicatesFinds duplicate style definitionsnpx react-native-style-cleaner duplicatesList of duplicate styles with locations
complexityAnalyzes style complexitynpx react-native-style-cleaner complexityComplex styles that might need refactoring
performanceChecks performance impact of stylesnpx react-native-style-cleaner performanceHeavy styles with optimization suggestions
interactiveClean styles with confirmationnpx react-native-style-cleaner interactiveInteractive prompts for each style
helpShows all available commandsnpx react-native-style-cleaner helpList of all commands and usage

Command Options

OptionDescriptionExample
--dirSpecify custom directorynpx react-native-style-cleaner clean --dir=./app
--ignoreIgnore specific pathsnpx react-native-style-cleaner clean --ignore=tests
--verboseShow detailed outputnpx react-native-style-cleaner analyze --verbose
--jsonOutput results as JSONnpx react-native-style-cleaner stats --json

Installation πŸ“¦

  • Added TypeScript support
  • Improved CLI output

Common Use Cases πŸ’‘

  1. Project Cleanup

    • Remove styles from refactored components
    • Clean up after large UI updates
  2. Performance Optimization

    • Reduce StyleSheet object size
    • Remove unnecessary style calculations
  3. Code Maintenance

    • Keep style definitions clean and relevant
    • Improve code readability

Ignored Directories 🚫

By default, the following directories are ignored:

  • node_modules
  • build
  • dist

Best Practices 🌟

  1. Run Before Commits

    • Clean unused styles before committing changes
    • Keep your style definitions lean
  2. Regular Maintenance

    • Run periodically on large projects
    • Include in your cleanup scripts
  3. Backup First

    • Always commit your changes before running the cleaner
    • Use version control to track style changes

Contributing 🀝

Contributions, issues and feature requests are welcome!

License πŸ“

This project is ISC licensed.

Author ✍️

Muhammed Deniz

Show your support

Give a ⭐️ if this project helped you!

Changelog πŸ“

Version 1.2.1

  • Added new analysis features:
    • stats: Style usage statistics
    • duplicates: Find duplicate styles
    • complexity: Style complexity analysis
    • performance: Performance impact analysis
    • interactive: Interactive cleaning mode
  • Enhanced CLI with new commands
  • Improved error handling and reporting
  • Added detailed statistics output
  • Added colorful CLI interface
1.2.7

6 months ago

1.2.6

6 months ago

1.2.5

6 months ago

1.2.4

6 months ago

1.2.3

6 months ago

1.2.2

6 months ago

1.2.1

6 months ago

1.2.0

6 months ago

1.1.9

6 months ago

1.1.8

6 months ago

1.1.7

6 months ago

1.1.6

6 months ago

1.1.5

6 months ago

1.1.4

6 months ago

1.1.3

6 months ago

1.1.2

6 months ago

1.1.1

6 months ago

1.1.0

6 months ago

1.0.9

6 months ago

1.0.8

6 months ago

1.0.7

6 months ago

1.0.6

6 months ago

1.0.5

6 months ago

1.0.4

6 months ago

1.0.3

6 months ago

1.0.2

6 months ago

1.0.1

6 months ago

1.0.0

6 months ago