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
Using lint-staged in a project with a package.json file that is missing a version field causes lint-staged to crash. It shouldn't.
Steps to reproduce
You can create a new project with a package.json file that is missing a version field and install lint-staged locally in the project. Run:
$ npx lint-staged
It will crash with an error like this (I replaced part of the file path with "{repo}"):
file:///{repo}/node_modules/lint-staged/bin/lint-staged.js:25
.option('--allow-empty', 'allow empty commits when tasks revert all staged changes', false)
^
TypeError: Cannot read properties of undefined (reading 'option')
at file:///{repo}/node_modules/lint-staged/bin/lint-staged.js:25:3
at ModuleJob.run (node:internal/modules/esm/module_job:185:25)
at async Promise.all (index 0)
at async ESMLoader.import (node:internal/modules/esm/loader:281:24)
at async loadESM (node:internal/process/esm_loader:88:5)
at async handleMainPromise (node:internal/modules/run_main:65:12)
Adding a version number to "{repo}/package.json" fixes this.
Debug Logs
I tried running in debug mode, but it didn't add anything else to the error printed above.
Environment
OS: macOS Big Sur
Node.js: 16.13.0
lint-staged: v12.0.0
Edit: I think I see the issue. Working on a PR atm.
The text was updated successfully, but these errors were encountered:
Description
This looks like a regression in v12.0.0
Using lint-staged in a project with a package.json file that is missing a version field causes lint-staged to crash. It shouldn't.
Steps to reproduce
You can create a new project with a package.json file that is missing a version field and install lint-staged locally in the project. Run:
It will crash with an error like this (I replaced part of the file path with "{repo}"):
Adding a version number to "{repo}/package.json" fixes this.
Debug Logs
I tried running in debug mode, but it didn't add anything else to the error printed above.
Environment
lint-staged
: v12.0.0Edit: I think I see the issue. Working on a PR atm.
The text was updated successfully, but these errors were encountered: