spectral: “Cannot read property 'lastIndexOf' of undefined” when passing filename to spectral lint
Describe the bug
When specifying a path (like I have always done) with spectral lint, it throws the following error:
Cannot read property ‘lastIndexOf’ of undefined
Even with verbose mode, no other information (such as file or line number) is printed.
However, if I run the same command with just a path (i.e. leaving the filename out), it works as intended.
To Reproduce
- Run, i.e.
spectral lint reference/vsapi/openapi.yaml - See error above printed in console
- Run
spectral lint reference/vsapi - See
No results with a severity of 'error' or higher found!printed in console.
Expected behavior
The help text for spectral lint says:
Positionals:
documents Location of JSON/YAML documents. Can be either a file, a glob or fetchable resource(s) on the web.
But, it seems specifying a file breaks it (or at least it does in my case). Am I still supposed to be able to use a file path in Spectral v5? As the error doesn’t happen in Spectral v4.
Environment:
- Library version: 5.3.0
- OS: macOS Catalina (10.15.4)
About this issue
- Original URL
- State: closed
- Created 4 years ago
- Reactions: 9
- Comments: 16 (5 by maintainers)
Commits related to this issue
- Merge #2480 2480: Make the build green r=D4nte a=bonomat * Remove MacOS e2e test * Cleared target cache as it seemed to have a problem there * Removed the GitHub workflow file linter and added it... — committed to comit-network/comit-rs by bors[bot] 4 years ago
- Merge #2480 2480: Make the build green r=D4nte a=bonomat * Remove MacOS e2e test * Cleared target cache as it seemed to have a problem there * Removed the GitHub workflow file linter and added it... — committed to comit-network/comit-rs by bors[bot] 4 years ago
- Merge #2480 2480: Make the build green r=D4nte a=bonomat * Remove MacOS e2e test * Cleared target cache as it seemed to have a problem there * Removed the GitHub workflow file linter and added it... — committed to comit-network/comit-rs by bors[bot] 4 years ago
I can repro the issue.
However, it doesn’t seem to reproduce against the development branch.
A new beta release should be issued shortly by @P0lip. We’ll ping you as soon as it’s available in order to check with you if the issue is still happening in your context.
Although, 5.4.0-beta1 has just been released, 5.3.0 should be working again, so feel free to stick to 5.3.0 in case you don’t want to try out beta (that’s pretty stable anyway, but just called beta) Just make sure to clean yarn/npm cache and re-install it again.
Hi, just to confirm the following (reinstalling 5.3.0) fixed it for me :