Open only-su opened 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:
{}
part of the language status and it should say whether it's able to load any rules:
Is it saying it's loaded any rules? There's also the commitlint.log.enabled
setting to enable logging to the output panel, which might also help narrow things down.commitlint.config.js
look like?Okay, cheking:
{}
I see an error "error loading config"
commitlint.log.enabled
but no new messages appearedcommitlint.config.js
, using as default:
/* global module */
module.exports = { extends: ["@commitlint/config-conventional"] };
$ npm list -g
C:\Users\user\AppData\Roaming\npm
├── @commitlint/cli@17.6.5
├── @commitlint/config-conventional@17.6.5
$ commitlint --from=HEAD~1
⧗ input: dsaiyugdiuysadisda
✖ subject may not be empty [subject-empty]
✖ type may not be empty [type-empty]
✖ found 2 problems, 0 warnings ⓘ Get help: https://github.com/conventional-changelog/commitlint/#what-is-commitlint
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.
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
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!
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.
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?
@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.)
Here is the requested info...
loading @commitlint/load dynamically via <absolute path to project>\node_modules\@commitlint\load\lib\load.js
loading @commitlint/load dynamically via <absolute path to project>\node_modules\@commitlint\load\lib\load.js
loading @commitlint/load dynamically via <absolute path to project>\node_modules\@commitlint\load\lib\load.js
loading @commitlint/load dynamically via <absolute path to project>\node_modules\@commitlint\load\lib\load.js
loading @commitlint/load dynamically via <absolute path to project>\node_modules\@commitlint\load\lib\load.js
loading @commitlint/parse dynamically via <absolute path to project>\node_modules\@commitlint\parse\lib\index.js
loading @commitlint/parse dynamically via <absolute path to project>\node_modules\@commitlint\parse\lib\index.js
loading @commitlint/parse dynamically via <absolute path to project>\node_modules\@commitlint\parse\lib\index.js
...
module.exports = {
// See config at https://github.com/conventional-changelog/commitlint/tree/master/@commitlint/config-conventional
extends: ['@commitlint/config-conventional'],
rules: {
// Add scopes as needed
// 'scope-enum': [2, 'always', [
// ]],
},
prompt: {
settings: {
enableMultipleScopes: true,
scopeEnumSeparator: ','
}
}
};
``
git cz
failed, but npx cz
still worked. I restarted vscode, but it had the same behavior.
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?