1.0.11 • Published 2 years ago

@benhammondmusic/find-dead-classes v1.0.11

Weekly downloads
-
License
ISC
Repository
github
Last release
2 years ago

Find Dead Classes 😵

Simple tool that compares a directory's .scss and .tsx files, and reports the "dead" code, meaning a class declaration like .CoolText {} that is never called in a component, or a class call like className={styles.AwesomeText} that is not declared in any style file.

To Use

In your terminal, navigate to the directory that contains the existing project you want to check:

cd code/MySweetProject

Run the script:

npx @benhammondmusic/find-dead-classes

The results will be logged to the console; showing each .scss file grouped with any related .tsx files

Example

https://user-images.githubusercontent.com/41567007/147434328-a1d543e9-b580-4e6a-b21a-d60da2aca15f.mov

TODO

  • make script return {deadClasses: [...], deadDeclarations: [...]}
  • add tests to ensure expected passes/failures for /test-project
  • add more scss/tsx test files to /test-project
  • allow config options (.css, .scss, .ts, .js, .jsx)
  • allow fo @uses and not just @import
  • test on some more real projects
  • use in Health Equity Tracker as an automated test

https://benhammond.tech

1.0.11

2 years ago

1.0.10

2 years ago

1.0.9

2 years ago

1.0.8

2 years ago

1.0.7

2 years ago

1.0.6

2 years ago

1.0.5

2 years ago

1.0.4

2 years ago

1.0.3

2 years ago

1.0.2

2 years ago

1.0.1

2 years ago

1.0.0

2 years ago