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

🐛 commitlint plugin not enabled by all relevant dependencies #836

Open
6 tasks done
bigpopakap opened this issue Nov 14, 2024 · 3 comments
Open
6 tasks done

🐛 commitlint plugin not enabled by all relevant dependencies #836

bigpopakap opened this issue Nov 14, 2024 · 3 comments
Labels
bug Something isn't working

Comments

@bigpopakap
Copy link

bigpopakap commented Nov 14, 2024

Prerequisites

Reproduction url

https://stackblitz.com/edit/github-hfa3yv?file=commitlint.config.ts

Note that it flags commitlint.config.ts as an unused file, and the 3 dependencies as unused.
All these issues are fixed by manually enabling the plugin with commitlint: true in the Knip config.

Reproduction access

  • I've made sure the reproduction is publicly accessible

Description of the issue

Currently, the commitlint plugin only uses @commitlint/cli to be enabled

It should also probably also use the commitlint package itself

In my project, I don't use @commitlint/cli, but I do use commitlint (in a git hook and on CI with the commitlint orb), and I have these in my devDependencies

  "devDependencies": {
    "@commitlint/config-conventional": "19.5.0",
    "@commitlint/types": "19.5.0",
    "commitlint": "19.5.0",
  },
@bigpopakap bigpopakap added the bug Something isn't working label Nov 14, 2024
@bigpopakap bigpopakap changed the title 🐛 commitlint plugin should detect more files 🐛 commitlint plugin not enabled by all relevant dependencies Nov 14, 2024
@webpro
Copy link
Collaborator

webpro commented Nov 14, 2024

That doesn't like an actual reproduction? Any chance you could fix that up?

@bigpopakap
Copy link
Author

I updated my repro link. I think it should work now 🙏

@bigpopakap
Copy link
Author

bigpopakap commented Nov 14, 2024

Thinking about this more, it isn't clear to me whether the current behavior is broken or not.

The commitlint plugin correctly handles all dependencies and config files when it is enabled (which I currently do manually in my project). The question is whether @commitlint/cli should be the only dependency that causes it to be enabled. I don't think @commitlint/config-conventional or @commitlint/types should cause the dependency to be enabled - those are secondary packages that only make sense in your project if you are using commtlint.

However, maybe it does make sense to detect the commitlint package itself, as long as its used in some script. In my project (not included in the minimal repo link above), I use commitlint in:

  • .husky/commit-msg with the contents commitlint --edit "$1"
  • In my CircleCI config (.circleci/config.yml), with the commitlint/lint job (from this orb)

Perhaps that level of detection is getting too smart, and it's better to have projects manually enable the commitlint plugin in their Knip config

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants