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

VsCode's Source Control doesn't commit changes #3610

Open
osmancandulger opened this issue May 17, 2023 · 4 comments
Open

VsCode's Source Control doesn't commit changes #3610

osmancandulger opened this issue May 17, 2023 · 4 comments

Comments

@osmancandulger
Copy link

osmancandulger commented May 17, 2023

If i commit via terminal like git commit -m "feat:test", it's work. But when i try to commit via VSCode's UI, it throw error like below;
I got that error when i try to commit my changes Unexpected token '?' husky - commit-msg hook exited with code 1 (error)

> git -c user.useConfigOnly=true commit --quiet --allow-empty-message --file -
yarn run v1.22.19
warning package.json: No license field
$ npx husky install
npx: installed 1 in 0.965s
husky - Git hooks installed
Done in 1.32s.
yarn run v1.22.19
Stashing changes... [started]
Stashing changes... [completed]
Running linters... [started]
Running tasks for *.js [started]
eslint --fix [started]
eslint --fix [completed]
git add [started]
git add [completed]
Running tasks for *.js [completed]
Running linters... [completed]
Updating stash... [started]
Updating stash... [completed]
Restoring local changes... [started]
Restoring local changes... [completed]
Done in 5.09s.
npx: installed 1 in 1.213s
husky - updated .husky/commit-msg
npx: installed 199 in 18.821s
Unexpected token '?'
husky - commit-msg hook exited with code 1 (error)

Then i configured my commitlint file like that;

#!/usr/bin/env sh
. "$(dirname -- "$0")/_/husky.sh"

export PATH=/usr/local/bin:$PATH
npx commitlint --edit "$1"

Then i configured my pre-commit file file like that;

#!/usr/bin/env sh
. "$(dirname -- "$0")/_/husky.sh"

npm run prepare

Then i configured my commitlint.config.js file like that;

module.exports = {
  extends: ["@commitlint/config-conventional"],
  parserPreset: { parserPresets: preset },
  rules: {
    "type-enum": [2, "always", types]
  }
};
@osmancandulger osmancandulger changed the title VsCode VsCode's Source Control doesn't commit properly May 17, 2023
@osmancandulger osmancandulger changed the title VsCode's Source Control doesn't commit properly VsCode's Source Control doesn't commit changes May 17, 2023
@escapedcat
Copy link
Member

Does this help in any way?: typicode/husky#1014

@osmancandulger
Copy link
Author

I tried solutions that provided at that issue but it didn't work any way :(

@mauricioklein

This comment was marked as duplicate.

@artbandin
Copy link

artbandin commented Aug 17, 2023

Got the same issue with VSCode and Composer Git Hooks. Are there any solutions?
Also from console

➜  app git:(dev) ✗ npx commitlint
Unexpected token '?'

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

No branches or pull requests

4 participants