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

Fix allowEmptyInput in configuration files #6926

Closed
astorije opened this issue Jun 16, 2023 · 3 comments · Fixed by #6929
Closed

Fix allowEmptyInput in configuration files #6926

astorije opened this issue Jun 16, 2023 · 3 comments · Fixed by #6929
Labels
status: wip is being worked on by someone type: bug a problem with a feature or rule

Comments

@astorije
Copy link

astorije commented Jun 16, 2023

What steps are needed to reproduce the bug?

I made a reproduction repo at https://github.com/astorije/stylelint-allowEmptyInput-issue-repro. Or follow steps in this issue instead.

What Stylelint configuration is needed to reproduce the bug?

extends: stylelint-config-standard

allowEmptyInput: true

How did you run Stylelint?

Use the following package.json:

{
  "private": true,
  "scripts": {
    "pass": "stylelint \"**/*.css\" --allow-empty-input",
    "fail": "stylelint \"**/*.css\""
  },
  "devDependencies": {
    "stylelint": "15.7.0",
    "stylelint-config-standard": "33.0.0"
  }
}

Make sure to have no CSS file in the folder.

Run:

  • yarn pass works as expected
  • yarn fail should also work but instead the allowEmptyInput configuration is ignored.

Which version of Stylelint or dependencies are you using?

  • stylelint: 15.7.0
  • stylelint-config-standard: 33.0.0

What did you expect to happen?

Both ways of using the allowEmptyInput / --allow-empty-input options should produce the same results.

What actually happened?

$ stylelint "**/*.css"
Error: No files matching the pattern "**/*.css" were found.
    at standalone (/[...]node_modules/stylelint/lib/standalone.js:260:43)

(In case it might be related: #5142)

Does the bug relate to non-standard syntax?

No response

Proposal to fix the bug

No response

@ybiquitous
Copy link
Member

@astorije Thanks for the report with the reproduction!

Indeed, this is a bug, and we should fix the following logic:

stylelint/lib/standalone.js

Lines 254 to 255 in 1c44f18

} else if (allowEmptyInput ?? config?.allowEmptyInput) {
stylelintResults = await Promise.all([]);

I've labeled the issue as ready to implement. Please consider contributing if you have time.

@ybiquitous ybiquitous added status: ready to implement is ready to be worked on by someone type: bug a problem with a feature or rule labels Jun 17, 2023
@ybiquitous ybiquitous changed the title allowEmptyInput not taking effect in configuration file Fix allowEmptyInput in configuration files Jun 17, 2023
@ybiquitous ybiquitous added status: wip is being worked on by someone and removed status: ready to implement is ready to be worked on by someone labels Jun 17, 2023
@astorije
Copy link
Author

Please consider contributing if you have time.

You went faster than I could react :D
Next time!

Thank you so much for fixing this, works like a charm :)

@ybiquitous
Copy link
Member

Ya, I created a PR since I found the cause immediately. 😄
I'd expect your next time contribution!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
status: wip is being worked on by someone type: bug a problem with a feature or rule
Development

Successfully merging a pull request may close this issue.

2 participants