joshbolduc / vscode-commitlint

commitlint integration for VS Code
MIT License
12 stars 1 forks source link

Can't get it to work with the built-in SCM input #744

Open only-su opened 1 year ago

only-su commented 1 year ago

List of things I have done:

on the last step nothing happened and the invalid message was commited with no warnings.

Is there something I'm missing?

joshbolduc commented 1 year ago

The extension won't prevent you from committing with a message that fails linting, if that's what you're expecting. You should see diagnostics (e.g., squiggly lines) but that's all.

Let's narrow down some other possibilities:

only-su commented 1 year ago

Okay, cheking:

✖ found 2 problems, 0 warnings ⓘ Get help: https://github.com/conventional-changelog/commitlint/#what-is-commitlint

joshbolduc commented 1 year ago

I'm going to need some time to dig into this. Globally installed commitlint on Windows is a bit of a blind spot and I don't have a good test environment for it handy.

You can probably work around the issue by installing any plugins locally in your project (and/or tweaking some config settings), but I understand that's not appealing for non-npm projects.

only-su commented 1 year ago

installing locally on project solves the issue, but the possibility to have it global would be nice!

additionally the commitlint site linked on the requirements of the project now instructs to install commitlint globally (see here), but their repo readme instructs to install locally to dev, maybe it changed in the way but as I followed the linked one I had this problem

joshbolduc commented 1 year ago

I think I got this working and published 2.4.3 with a fix. Let me know if it's still misbehaving for you. Thanks for the help reproducing the issue!

joshbolduc commented 1 year ago

I reverted the fix for this to fix #750--on review, my initial attempt was ill-conceived and effectively just undid the work that was done to improve compatibility with global installations for #491.

Short term, v2.4.6 is the latest version with this behavior, so if that works for you, feel free to stay on that version.

Longer term, I think the fix here might involve trying to load configs multiple times (e.g., with or without PREFIX) unless there's a better test or heuristic I can identify. But I will probably also want to prioritize #107 to establish some base level of automated test coverage for these different environments, which will be more reliable than my ad-hoc testing to date.

jibbers42 commented 1 week ago

https://github.com/joshbolduc/vscode-commitlint/issues/744#issuecomment-1591382624 says that installing locally may work and https://github.com/joshbolduc/vscode-commitlint/issues/744#issuecomment-1591737089 says that it does work, but I can't get diagnostics to show. I use the Commit button with a blank message to get the full editor COMMIT_EDITMSG view. When I type there is no diagnostic to help.

I have this installed locally...

  "devDependencies": {
    "@commitlint/cli": "^19.5.0",
    "@commitlint/config-conventional": "^19.5.0",
    "@commitlint/cz-commitlint": "^19.5.0",
    "commitizen": "^4.3.1",
    "husky": "^9.1.6"
  },

I've installed the extension, git cz works from terminal, and the documented commitlint seems to work fine:

> npx commitlint --from HEAD~1 --to HEAD --verbose
⧗   input: chore: add eslint rules
✔   found 0 problems, 0 warnings

Any suggestion as to what I could be missing?

joshbolduc commented 1 week ago

@jibbers42 What you've shared seems okay to me. If you could answer the questions from https://github.com/joshbolduc/vscode-commitlint/issues/744#issuecomment-1587696955 it could help narrow things down a bit more. (For instance, the commitlint command you shared did not show any problems, so one possibility could be that something is wrong with the configuration.)

jibbers42 commented 1 week ago

Here is the requested info...