Skip to content

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

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 4 commits into
base: develop
Choose a base branch
from

Conversation

christopher-ayling
Copy link

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
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
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
Copy link

YOU54F commented Apr 11, 2025

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
Copy link

YOU54F commented Apr 11, 2025

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
Copy link

YOU54F commented Apr 15, 2025

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants