Skip to content
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

Throw error on non-existent files unless allow-empty-input is enabled #3965

Conversation

Bilie
Copy link
Member

@Bilie Bilie commented Feb 25, 2019

Closes #3880

Copy link
Member

@jeddy3 jeddy3 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Bilie Thanks for doing this. It's looking good.

I have a query about the wording of the error message.


This is a breaking change, as should be within a major release.

Major releases can be tricky as most plugins with peer dependencies have to release new versions. @stylelint/core Do we release regardless?

@@ -191,8 +191,11 @@ describe("extending config with ignoreFiles glob ignoring one by negation", () =
});

describe("specified `ignorePath` file ignoring one file", () => {
let results;
const noFilesErrorMessage = new Error(
"The specified `files` glob returns no results"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shall we adopt the ESLint approach of?:

No files matching the pattern "${pattern}" were found.

This feels a little more explicit as we're stating the glob pattern in the error message, rather than just referring to it.

@jeddy3
Copy link
Member

jeddy3 commented Apr 2, 2019

With talk of a major release in #4000, I think we can get this in?

@jeddy3 jeddy3 mentioned this pull request Apr 2, 2019
6 tasks
Copy link
Member

@hudochenkov hudochenkov left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for working on this!

I just have two small change requests.

lib/cli.js Outdated Show resolved Hide resolved
@@ -14,6 +14,7 @@ const globby /*: Function*/ = require("globby");
const hash = require("./utils/hash");
const ignore = require("ignore");
const needlessDisables /*: Function*/ = require("./needlessDisables");
const NoFilesFoundError = require("./testUtils/noFilesFoundError");
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think noFilesFoundError should be in lib/utils directory, because it's a part of application.

config: configBlockNoEmpty
})
.then(() => {
throw new Error("should not have succeeded");
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm just curious why to throw an error here? Isn't stylelint should throw an error and catch will catch it?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi, I removed this, it was left over from testing

@jeddy3
Copy link
Member

jeddy3 commented Apr 4, 2019

@hudochenkov Good catches!

@jeddy3
Copy link
Member

jeddy3 commented Apr 11, 2019

@Bilie Do you think you'll have time to look into @hudochenkov suggestions before the weekend? We're planning to release 10.0.0 then.

@Bilie
Copy link
Member Author

Bilie commented Apr 11, 2019

Hi, thank you for the feedback! I have updated the PR, let me know if you spot anything else.

Copy link
Member

@hudochenkov hudochenkov left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for addressing feedback!

One last thing. I believe all throw new Error("should not have succeeded"); in ignore.test.js are also unnecessary for tests.

@hudochenkov
Copy link
Member

Look awesome! Thanks, @Bilie!

@jeddy3 jeddy3 merged commit 4ca75e7 into stylelint:master Apr 13, 2019
@jeddy3
Copy link
Member

jeddy3 commented Apr 13, 2019

  • Changed: throws error if glob matches no files, use the --allow-empty-input flag for the old behaviour (#3965).

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

Successfully merging this pull request may close these issues.

Change behaviour to exit with non-zero status code when no matching files
3 participants