twind icon indicating copy to clipboard operation
twind copied to clipboard

Feature request: ability to type-check or leverage eslint to verify usage in CI

Open marbemac opened this issue 3 years ago • 4 comments

Hi - I was wondering if it might be possible to leverage or build on https://github.com/tw-in-js/typescript-plugin to support running those same checks in a CI type environment? Similar to how one might run lint checks in a PR. Would be reallyy helpful to be able to catch type errors at test step in CI.

marbemac avatar Jul 16 '21 20:07 marbemac

Sorry, it took so long. Great idea!

sastan avatar Jan 25 '22 19:01 sastan

So happy to see the response, thank you! I'm reviving our "migrate to twind poc" branch as we speak, in order to try out the WIP twind v1, looking forward to exploring.

marbemac avatar Jan 25 '22 20:01 marbemac

Yes, unfortunately Typescript Language Service plugins such as https://github.com/tw-in-js/typescript-plugin are not executed during tsc command line transpilation/typechecking ... they only activate in Visual Studio Code during the editing experience, see: https://github.com/microsoft/TypeScript/wiki/Writing-a-Language-Service-Plugin

It would be nice if a Twind "checker" could plug into either Prettier, ESLint, or Stylelint ... although the Typescript Language Service plugin (which will at some point be ported to Twind v1, I imagine) does offer a nice DX, i.e. not just highlighting errors, but also providing auto-completion / "intellisense", as well as rich contextual information popup.

danielweck avatar Jan 25 '22 20:01 danielweck

I haven't had a chance to investigate how libraries like Stitches provide native TS autocompletions & type checking (that incorporate the custom user defined theme / config no less!), but it is very slick. It's particularly appealing for library authors, so that downstream consumers of a component library etc also get all of that type-checking / autocomplete goodness.

marbemac avatar Jan 26 '22 00:01 marbemac