typescript-plugin-css-modules
typescript-plugin-css-modules copied to clipboard
add support for disabling the plugin via `env.TS_PLUGIN_CSS_MODULES_DISALBED`
This follows a pattern I've seen in other plugins, like this from typescript-eslint-language-service:
https://github.com/Quramy/typescript-eslint-language-service/blob/da3c201c94dd3c3a6a10f83cbbd54fae9d3db9e1/src/plugin-module-factory.ts#L9
Reasoning:
When this plugin seems to be causing WebStorm some headaches (or certain versions of TS, etc) and I need to work on something else for a while, I find it tedious to comment it out from the plugins list of our tsconfig. The biggest headache there is that I often commit this commented-out code to my branches, only to have to revert it later when reviewing my PRs.
I don't care too much about the methodology here re: env vars. Actually, starting my IDE with an env var is less than convenient, but it'll work. Other options could be checking for the existence of some file or what have you, but no matter what, it should be something either
gitignore-able, or otherwise not a file in the repository.
tested this locally* works nicely on MacOS via export TS_PLUGIN_CSS_MODULES_DISALBED=1 && open -a "WebStorm.app"
*I fought with
yarn 3(which my project is using) for about 2 hrs trying to either install this from a local directory into a project withyarn link, as well as from github withyarn add ...from github..., and couldn't get it to work. i don't remember this being so difficult withyarn 1.so to test this, I just threw the changed code in
dist/index.jsinto my project's copy of it innode_modules, and this worked great.
Any thoughts on this @mrmckeb?
In the absence of the TS team replying over here, this would be a nice win for me :)
Thanks for this @ekilah, and sorry it took a long time.
thanks :) It'll really help my workflow at least.
This has now shipped in v5.1.0. Thanks again!