“Cannot read property 'lastIndexOf' of undefined” when passing filename to spectral lint
See original GitHub issueDescribe 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)
Issue Analytics
- State:
- Created 3 years ago
- Reactions:9
- Comments:16 (5 by maintainers)
Top Results From Across the Web
No results found
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
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.