Skip to content

fix(cli): throw error if no file found to lint#2778

Merged
tomek-tursa-sb merged 7 commits into
stoplightio:developfrom
christopher-ayling:fix/throw-error-on-bad-filepath
Feb 13, 2026
Merged

fix(cli): throw error if no file found to lint#2778
tomek-tursa-sb merged 7 commits into
stoplightio:developfrom
christopher-ayling:fix/throw-error-on-bad-filepath

Conversation

@christopher-ayling

Copy link
Copy Markdown
Contributor

Fixes #2675.

Checklist

  • Tests added / updated
  • Docs added / updated

Does this PR introduce a breaking change?

  • Yes Maybe?
  • No

The cli used to show a success message if you passed a file to lint that didn't exist, leading you to believe everything was ok, when in fact no linting had been done. Now this throw's an error.

Screenshots
before:
Screenshot 2025-02-07 at 11 23 27 AM

after:

image

@christopher-ayling christopher-ayling requested a review from a team as a code owner February 7, 2025 16:25
@christopher-ayling christopher-ayling changed the title thow error if no file found to lint fix(cli): throw error if no file found to lint Feb 7, 2025
@christopher-ayling

Copy link
Copy Markdown
Contributor Author

Unable to get any harness tests to pass, even on the develop branch. Have run yarn build && yarn workspace @stoplight/spectral-cli build.binary before running yarn test.harness. still no luck

@mnaumanali94

Copy link
Copy Markdown
Contributor

@christopher-ayling We'll take a look at this and get back to you. Have you considered the case where the value is a glob instead of a file path? Should it fail in that case? 🤔

@YOU54F

YOU54F commented Apr 11, 2025

Copy link
Copy Markdown

Hey @christopher-ayling,

Did you manage to get your test harness to run locally?

Happy to take a look at that with you.

Any thoughts on @mnaumanali94's question above?

@YOU54F

YOU54F commented Apr 11, 2025

Copy link
Copy Markdown

Unable to get any harness tests to pass, even on the develop branch. Have run yarn build && yarn workspace @stoplight/spectral-cli build.binary before running yarn test.harness. still no luck

Looks like the same question was asked in another PR, wonder if this may help for you.

#2737 (comment)

I'll check the instructions for running locally, and update where appropriate in order to get a nice out of the box experience for contributors :)

Appreciate the change

@YOU54F

YOU54F commented Apr 15, 2025

Copy link
Copy Markdown

It actually looks like the test harness fails on node 20 upwards, and is excluded from testing the harness in CI, for node 20. It tests against lts releases and uses node 16/18 for the lts versions.

node 16 is already eol and node 18 is going eol in 2 weeks.

switching to node 18, gives me a green test harness

@tomek-tursa-sb tomek-tursa-sb merged commit 3e20072 into stoplightio:develop Feb 13, 2026
8 checks passed
stoplight-bot pushed a commit that referenced this pull request Apr 13, 2026
## [6.15.1](https://github.com/stoplightio/spectral/compare/@stoplight/spectral-cli-6.15.0...@stoplight/spectral-cli-6.15.1) (2026-04-13)

### Bug Fixes

* **cli:** fix bug where output gets truncated when too long ([#2862](#2862)) ([0e6fd33](0e6fd33))
* **cli:** throw error if no file found to lint ([#2778](#2778)) ([3e20072](3e20072))
* **core:** fix security issue of simple-eval package  ([#2886](#2886)) ([8120a76](8120a76))
* **core:** respect off severity in intermediate rulesets ([#2890](#2890)) ([5b99b99](5b99b99))
* **formatters:** Fix rendering of github actions documentationUrl ([#2895](#2895)) ([df27b06](df27b06))
* **formatters:** markdown formatter with invalid-ref crashes spectral ([#2905](#2905)) ([59728e4](59728e4))
* **functions:** export or function ([#2812](#2812)) ([03532a5](03532a5))
* **repo:** release step marking repo as save for git ([#2884](#2884)) ([87147a6](87147a6))
* **repo:** remove acceptance step on release ([#2882](#2882)) ([73496c6](73496c6))
* **ruleset-migrator:** fix ruleset migrator output when a rule name contains '/' ([#2859](#2859)) ([115d1d0](115d1d0))
* **rulesets:** use uri-reference for openIdConnectUrl ([#2796](#2796)) ([c57eb59](c57eb59))

### Features

* **core:** allow extending rulesets with aliases ([#2870](#2870)) ([8db9718](8db9718))
* **core:** further adjustments for extending rulesets with aliases ([#2939](#2939)) ([26144bc](26144bc))
* **repo:** circleci migration to GHA (OP-35885) ([#2867](#2867)) ([884f079](884f079))
* **repo:** npm release workflow as gha ([#2880](#2880)) ([0147d6e](0147d6e))
* **repo:** post develop merge workflow ([#2877](#2877)) ([9420713](9420713))
* **repo:** replace skypack usage with esm cdn ([#2940](#2940)) ([0d6a910](0d6a910))
stoplight-bot pushed a commit that referenced this pull request Apr 13, 2026
# [1.22.0](https://github.com/stoplightio/spectral/compare/@stoplight/spectral-core-1.21.0...@stoplight/spectral-core-1.22.0) (2026-04-13)

### Bug Fixes

* **cli:** fix bug where output gets truncated when too long ([#2862](#2862)) ([0e6fd33](0e6fd33))
* **cli:** throw error if no file found to lint ([#2778](#2778)) ([3e20072](3e20072))
* **core:** fix security issue of simple-eval package  ([#2886](#2886)) ([8120a76](8120a76))
* **core:** respect off severity in intermediate rulesets ([#2890](#2890)) ([5b99b99](5b99b99))
* **formatters:** Fix rendering of github actions documentationUrl ([#2895](#2895)) ([df27b06](df27b06))
* **formatters:** markdown formatter with invalid-ref crashes spectral ([#2905](#2905)) ([59728e4](59728e4))
* **rulesets:** use uri-reference for openIdConnectUrl ([#2796](#2796)) ([c57eb59](c57eb59))

### Features

* **core:** further adjustments for extending rulesets with aliases ([#2939](#2939)) ([26144bc](26144bc))
* **repo:** replace skypack usage with esm cdn ([#2940](#2940)) ([0d6a910](0d6a910))
@stoplight-bot

Copy link
Copy Markdown
Collaborator

🎉 This PR is included in version 6.15.1 🎉

The release is available on @stoplight/spectral-cli-6.15.1

Your semantic-release bot 📦🚀

stoplight-bot pushed a commit that referenced this pull request Apr 13, 2026
## [1.5.1](https://github.com/stoplightio/spectral/compare/@stoplight/spectral-formatters-1.5.0...@stoplight/spectral-formatters-1.5.1) (2026-04-13)

### Bug Fixes

* **cli:** fix bug where output gets truncated when too long ([#2862](#2862)) ([0e6fd33](0e6fd33))
* **cli:** throw error if no file found to lint ([#2778](#2778)) ([3e20072](3e20072))
* **core:** fix security issue of simple-eval package  ([#2886](#2886)) ([8120a76](8120a76))
* **core:** respect off severity in intermediate rulesets ([#2890](#2890)) ([5b99b99](5b99b99))
* **formatters:** Fix rendering of github actions documentationUrl ([#2895](#2895)) ([df27b06](df27b06))
* **formatters:** markdown formatter with invalid-ref crashes spectral ([#2905](#2905)) ([59728e4](59728e4))
* **functions:** export or function ([#2812](#2812)) ([03532a5](03532a5))
* **repo:** release step marking repo as save for git ([#2884](#2884)) ([87147a6](87147a6))
* **repo:** remove acceptance step on release ([#2882](#2882)) ([73496c6](73496c6))
* **ruleset-migrator:** fix ruleset migrator output when a rule name contains '/' ([#2859](#2859)) ([115d1d0](115d1d0))
* **rulesets:** use uri-reference for openIdConnectUrl ([#2796](#2796)) ([c57eb59](c57eb59))

### Features

* **core:** allow extending rulesets with aliases ([#2870](#2870)) ([8db9718](8db9718))
* **core:** further adjustments for extending rulesets with aliases ([#2939](#2939)) ([26144bc](26144bc))
* **repo:** circleci migration to GHA (OP-35885) ([#2867](#2867)) ([884f079](884f079))
* **repo:** npm release workflow as gha ([#2880](#2880)) ([0147d6e](0147d6e))
* **repo:** post develop merge workflow ([#2877](#2877)) ([9420713](9420713))
* **repo:** replace skypack usage with esm cdn ([#2940](#2940)) ([0d6a910](0d6a910))
stoplight-bot pushed a commit that referenced this pull request Apr 13, 2026
# [1.12.0](https://github.com/stoplightio/spectral/compare/@stoplight/spectral-ruleset-migrator-1.11.3...@stoplight/spectral-ruleset-migrator-1.12.0) (2026-04-13)

### Bug Fixes

* **cli:** fix bug where output gets truncated when too long ([#2862](#2862)) ([0e6fd33](0e6fd33))
* **cli:** throw error if no file found to lint ([#2778](#2778)) ([3e20072](3e20072))
* **core:** fix security issue of simple-eval package  ([#2886](#2886)) ([8120a76](8120a76))
* **core:** respect off severity in intermediate rulesets ([#2890](#2890)) ([5b99b99](5b99b99))
* **formatters:** Fix rendering of github actions documentationUrl ([#2895](#2895)) ([df27b06](df27b06))
* **formatters:** markdown formatter with invalid-ref crashes spectral ([#2905](#2905)) ([59728e4](59728e4))
* **repo:** release step marking repo as save for git ([#2884](#2884)) ([87147a6](87147a6))
* **repo:** remove acceptance step on release ([#2882](#2882)) ([73496c6](73496c6))
* **rulesets:** use uri-reference for openIdConnectUrl ([#2796](#2796)) ([c57eb59](c57eb59))

### Features

* **core:** allow extending rulesets with aliases ([#2870](#2870)) ([8db9718](8db9718))
* **core:** further adjustments for extending rulesets with aliases ([#2939](#2939)) ([26144bc](26144bc))
* **repo:** circleci migration to GHA (OP-35885) ([#2867](#2867)) ([884f079](884f079))
* **repo:** npm release workflow as gha ([#2880](#2880)) ([0147d6e](0147d6e))
* **repo:** post develop merge workflow ([#2877](#2877)) ([9420713](9420713))
* **repo:** replace skypack usage with esm cdn ([#2940](#2940)) ([0d6a910](0d6a910))
stoplight-bot pushed a commit that referenced this pull request Apr 13, 2026
## [1.22.1](https://github.com/stoplightio/spectral/compare/@stoplight/spectral-rulesets-1.22.0...@stoplight/spectral-rulesets-1.22.1) (2026-04-13)

### Bug Fixes

* **cli:** fix bug where output gets truncated when too long ([#2862](#2862)) ([0e6fd33](0e6fd33))
* **cli:** throw error if no file found to lint ([#2778](#2778)) ([3e20072](3e20072))
* **core:** fix security issue of simple-eval package  ([#2886](#2886)) ([8120a76](8120a76))
* **core:** respect off severity in intermediate rulesets ([#2890](#2890)) ([5b99b99](5b99b99))
* **formatters:** Fix rendering of github actions documentationUrl ([#2895](#2895)) ([df27b06](df27b06))
* **formatters:** markdown formatter with invalid-ref crashes spectral ([#2905](#2905)) ([59728e4](59728e4))
* **functions:** export or function ([#2812](#2812)) ([03532a5](03532a5))
* **repo:** release step marking repo as save for git ([#2884](#2884)) ([87147a6](87147a6))
* **repo:** remove acceptance step on release ([#2882](#2882)) ([73496c6](73496c6))
* **ruleset-migrator:** fix ruleset migrator output when a rule name contains '/' ([#2859](#2859)) ([115d1d0](115d1d0))
* **rulesets:** use uri-reference for openIdConnectUrl ([#2796](#2796)) ([c57eb59](c57eb59))

### Features

* **core:** allow extending rulesets with aliases ([#2870](#2870)) ([8db9718](8db9718))
* **core:** further adjustments for extending rulesets with aliases ([#2939](#2939)) ([26144bc](26144bc))
* **repo:** circleci migration to GHA (OP-35885) ([#2867](#2867)) ([884f079](884f079))
* **repo:** npm release workflow as gha ([#2880](#2880)) ([0147d6e](0147d6e))
* **repo:** post develop merge workflow ([#2877](#2877)) ([9420713](9420713))
* **repo:** replace skypack usage with esm cdn ([#2940](#2940)) ([0d6a910](0d6a910))
stoplight-bot pushed a commit that referenced this pull request Apr 14, 2026
## [1.1.5](https://github.com/stoplightio/spectral/compare/@stoplight/spectral-runtime-1.1.4...@stoplight/spectral-runtime-1.1.5) (2026-04-14)

### Bug Fixes

* **cli:** fix bug where output gets truncated when too long ([#2862](#2862)) ([0e6fd33](0e6fd33))
* **cli:** throw error if no file found to lint ([#2778](#2778)) ([3e20072](3e20072))
* **core:** fix security issue of simple-eval package  ([#2886](#2886)) ([8120a76](8120a76))
* **core:** respect off severity in intermediate rulesets ([#2890](#2890)) ([5b99b99](5b99b99))
* **deps:** bump elliptic from 6.6.0 to 6.6.1 ([#2782](#2782)) ([5ff9602](5ff9602))
* **deps:** fix yarn lockfile ([e6c3b9d](e6c3b9d))
* **deps:** post lodash update changes for semantic release ([#2942](#2942)) ([bf530dd](bf530dd))
* **deps:** update spectral-core in cli ([35687cd](35687cd))
* **formatters:** Fix rendering of github actions documentationUrl ([#2895](#2895)) ([df27b06](df27b06))
* **formatters:** markdown formatter with invalid-ref crashes spectral ([#2905](#2905)) ([59728e4](59728e4))
* **functions:** export or function ([#2812](#2812)) ([03532a5](03532a5))
* **repo:** release step marking repo as save for git ([#2884](#2884)) ([87147a6](87147a6))
* **repo:** remove acceptance step on release ([#2882](#2882)) ([73496c6](73496c6))
* **repo:** replace discord link with forum link ([#2793](#2793)) ([6229442](6229442))
* **ruleset-migrator:** fix ruleset migrator output when a rule name contains '/' ([#2859](#2859)) ([115d1d0](115d1d0))
* **rulesets:** use uri-reference for openIdConnectUrl ([#2796](#2796)) ([c57eb59](c57eb59))

### Features

* **core:** add documentUrl to JS api and cli formatters ([#2443](#2443)) ([e787728](e787728))
* **core:** allow extending rulesets with aliases ([#2870](#2870)) ([8db9718](8db9718))
* **core:** further adjustments for extending rulesets with aliases ([#2939](#2939)) ([26144bc](26144bc))
* **functions:** add or function ([#2798](#2798)) ([d9ef27f](d9ef27f))
* **repo:** circleci migration to GHA (OP-35885) ([#2867](#2867)) ([884f079](884f079))
* **repo:** npm release workflow as gha ([#2880](#2880)) ([0147d6e](0147d6e))
* **repo:** post develop merge workflow ([#2877](#2877)) ([9420713](9420713))
* **repo:** replace skypack usage with esm cdn ([#2940](#2940)) ([0d6a910](0d6a910))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants