solid-styled-components icon indicating copy to clipboard operation
solid-styled-components copied to clipboard

Fixing Nits

Open jvanderen1 opened this issue 3 years ago • 5 comments

As I was exploring #29, I came across some minor stuff that I figured would be good to add to the codebase:

  • Replace useContext(ThemeContext) with useTheme().
  • Removed "theme" from splitProps(htmlProps, ["children", "theme"]);.
    • This is already removed a few lines above and was throwing some TS errors during #29.
  • Simplified conditional logic through short-circuit return.
  • Replaced let to const (where applicable).
  • Remove null from optional params.
    • This simplifies the TS slightly since undefined is captured through optional params already.
  • Added "solid" preset to babel config.
  • Added "forceConsistentCasingInFileNames" to tsconfig.
    • VSCode recommends doing this to ensure consistency across OS's.
  • Ran prettier --write . ✨ .

I am definitely open to feedback / suggestions.

jvanderen1 avatar Jun 26 '22 05:06 jvanderen1

The diffing on src/index.js got affected by prettier it seems. If this is an eye-sore, I can remove the prettier changes from this file 👍🏻 .

jvanderen1 avatar Jun 26 '22 06:06 jvanderen1

@ryansolid Is there anyone you'd recommend to review this?

jvanderen1 avatar Jun 27 '22 19:06 jvanderen1

Hmm.. because of all the changes the diff on index.js is basically useless. It might be better without prettier, so I can make sense of it.

ryansolid avatar Jun 29 '22 01:06 ryansolid

@ryansolid Yeah, I agree. I will remove the prettier change in index.js.

Maybe in a different PR, we could introduce linting/prettier rules to run on every commit. This can be achieved with something like husky + lint-staged.

jvanderen1 avatar Jun 29 '22 05:06 jvanderen1

@ryansolid I pushed out index.js without prettier changes. Lmk if there's anything else 👍🏻 .

jvanderen1 avatar Jun 29 '22 05:06 jvanderen1