You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm trying to migrate in our new mono-repo the frontend linting on staged files from husky to pre-commit as recommended here.
When I try to run
pre-commit run eslint
I get the following error
eslint...................................................................Failed
- hook id: eslint
- duration: 0.06s
- exit code: 1
/home/hans/.cache/pre-commit/repo0q_v76eh/node_env-system/lib/node_modules/eslint/bin/eslint.js:93
} catch {
^
SyntaxError: Unexpected token {
at createScript (vm.js:80:10)
at Object.runInThisContext (vm.js:139:10)
at Module._compile (module.js:617:28)
at Object.Module._extensions..js (module.js:664:10)
at Module.load (module.js:566:32)
at tryModuleLoad (module.js:506:12)
at Function.Module._load (module.js:498:3)
at Function.Module.runMain (module.js:694:10)
at startup (bootstrap_node.js:204:16)
at bootstrap_node.js:625:3
This is the eslint hook in the pre-commit-config.yaml
ah yeah that looks probably too old for that syntax
this changed recently, if pre-commit sees a global node + npm it will default to nodeenv -n system -- you can restore the old behaviour by using language_version: default (this defaults to latest node+npm) -- either on a per-hook bases or globally with default_language_version
Thanks for the quick help!
So, I'm trying to set the version in pre-commit-config.yaml since I have to prepare this for people who do not regularly work with node/npm and I do want to force them to update.
The first option - adding language_version: default to the hook - still produced the same error.
The second option - specifying the version globally - worked
I'm trying to migrate in our new mono-repo the frontend linting on staged files from husky to pre-commit as recommended here.
When I try to run
I get the following error
This is the eslint hook in the
pre-commit-config.yaml
My pre-commit version is 2.8.2
The text was updated successfully, but these errors were encountered: