Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add env var to disable plugin #244

Merged
merged 4 commits into from
Feb 11, 2024
Merged

Conversation

ekilah
Copy link
Contributor

@ekilah ekilah commented Oct 24, 2023

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.

src/index.ts Outdated
Comment on lines 29 to 31
if (process.env.TS_PLUGIN_CSS_MODULES_DISALBED !== undefined) {
return info.languageService;
}
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have basically 0 experience with the TS language server, so I don't have a ton of knowledge re: whether this is the right thing to return early with. this was just copied from the eslint plugin I referenced in the PR description.

@ekilah ekilah changed the title add support for disabling the plugin via TS_PLUGIN_CSS_MODULES_DISALBED add support for disabling the plugin via env.TS_PLUGIN_CSS_MODULES_DISALBED Oct 24, 2023
@ekilah
Copy link
Contributor Author

ekilah commented Oct 24, 2023

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
Copy link
Contributor Author

ekilah commented Nov 3, 2023

Any thoughts on this @mrmckeb?

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

@mrmckeb mrmckeb changed the title add support for disabling the plugin via env.TS_PLUGIN_CSS_MODULES_DISALBED feat: add env var to disable plugin for special cases Feb 11, 2024
@mrmckeb mrmckeb changed the title feat: add env var to disable plugin for special cases feat: add env var to disable plugin Feb 11, 2024
@mrmckeb mrmckeb merged commit df465eb into mrmckeb:main Feb 11, 2024
1 check passed
@mrmckeb
Copy link
Owner

mrmckeb commented Feb 11, 2024

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

@ekilah
Copy link
Contributor Author

ekilah commented Feb 11, 2024

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

@mrmckeb
Copy link
Owner

mrmckeb commented Feb 11, 2024

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

davydkov pushed a commit to likec4/likec4 that referenced this pull request Feb 24, 2024
#586)

[![Mend
Renovate](https://app.renovatebot.com/images/banner.svg)](https://renovatebot.com)

This PR contains the following updates:

| Package | Change | Age | Adoption | Passing | Confidence |
|---|---|---|---|---|---|
|
[typescript-plugin-css-modules](https://togithub.com/mrmckeb/typescript-plugin-css-modules)
| [`^5.0.2` ->
`^5.1.0`](https://renovatebot.com/diffs/npm/typescript-plugin-css-modules/5.0.2/5.1.0)
|
[![age](https://developer.mend.io/api/mc/badges/age/npm/typescript-plugin-css-modules/5.1.0?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
[![adoption](https://developer.mend.io/api/mc/badges/adoption/npm/typescript-plugin-css-modules/5.1.0?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
[![passing](https://developer.mend.io/api/mc/badges/compatibility/npm/typescript-plugin-css-modules/5.0.2/5.1.0?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
[![confidence](https://developer.mend.io/api/mc/badges/confidence/npm/typescript-plugin-css-modules/5.0.2/5.1.0?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|

---

### Release Notes

<details>
<summary>mrmckeb/typescript-plugin-css-modules
(typescript-plugin-css-modules)</summary>

###
[`v5.1.0`](https://togithub.com/mrmckeb/typescript-plugin-css-modules/releases/tag/v5.1.0)

[Compare
Source](https://togithub.com/mrmckeb/typescript-plugin-css-modules/compare/v5.0.2...v5.1.0)

#### What's Changed

- chore: update dependencies by
[@&#8203;mrmckeb](https://togithub.com/mrmckeb) in
[mrmckeb/typescript-plugin-css-modules#255
- feat: add env var to disable plugin by
[@&#8203;ekilah](https://togithub.com/ekilah) in
[mrmckeb/typescript-plugin-css-modules#244
- docs: update README regexp by
[@&#8203;mrmckeb](https://togithub.com/mrmckeb) in
[mrmckeb/typescript-plugin-css-modules#256
- feat(getCssExports): adds support for SCSS/SASS partials via aliases
by [@&#8203;rmachado-studocu](https://togithub.com/rmachado-studocu) in
[mrmckeb/typescript-plugin-css-modules#251
- feat: customRender return sourceMap support by
[@&#8203;qyzzzz](https://togithub.com/qyzzzz) in
[mrmckeb/typescript-plugin-css-modules#249

#### New Contributors

- [@&#8203;rmachado-studocu](https://togithub.com/rmachado-studocu) made
their first contribution in
[mrmckeb/typescript-plugin-css-modules#251
- [@&#8203;qyzzzz](https://togithub.com/qyzzzz) made their first
contribution in
[mrmckeb/typescript-plugin-css-modules#249

**Full Changelog**:
mrmckeb/typescript-plugin-css-modules@v5.0.2...v5.1.0

</details>

---

### Configuration

📅 **Schedule**: Branch creation - At any time (no schedule defined),
Automerge - At any time (no schedule defined).

🚦 **Automerge**: Disabled by config. Please merge this manually once you
are satisfied.

♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the
rebase/retry checkbox.

🔕 **Ignore**: Close this PR and you won't be reminded about this update
again.

---

- [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check
this box

---

This PR has been generated by [Mend
Renovate](https://www.mend.io/free-developer-tools/renovate/). View
repository job log
[here](https://developer.mend.io/github/likec4/likec4).

<!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiIzNy4yMDAuMCIsInVwZGF0ZWRJblZlciI6IjM3LjIwMC4wIiwidGFyZ2V0QnJhbmNoIjoibWFpbiJ9-->

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants