typescript-plugin-css-modules icon indicating copy to clipboard operation
typescript-plugin-css-modules copied to clipboard

add support for disabling the plugin via `env.TS_PLUGIN_CSS_MODULES_DISALBED`

Open ekilah opened this issue 2 years ago • 2 comments

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.

ekilah avatar Oct 24 '23 05:10 ekilah

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 with yarn link, as well as from github with yarn add ...from github..., and couldn't get it to work. i don't remember this being so difficult with yarn 1.

so to test this, I just threw the changed code in dist/index.js into my project's copy of it in node_modules, and this worked great.

ekilah avatar Oct 24 '23 06:10 ekilah

Any thoughts on this @mrmckeb?

In the absence of the TS team replying over here, this would be a nice win for me :)

ekilah avatar Nov 03 '23 21:11 ekilah

Thanks for this @ekilah, and sorry it took a long time.

mrmckeb avatar Feb 11 '24 08:02 mrmckeb

thanks :) It'll really help my workflow at least.

ekilah avatar Feb 11 '24 08:02 ekilah

This has now shipped in v5.1.0. Thanks again!

mrmckeb avatar Feb 11 '24 11:02 mrmckeb