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

"No files matching the pattern" when using Windows #5122

Closed
nzacca opened this issue Feb 1, 2021 · 12 comments · Fixed by #5386
Closed

"No files matching the pattern" when using Windows #5122

nzacca opened this issue Feb 1, 2021 · 12 comments · Fixed by #5386
Labels
status: needs investigation triage needs further investigation

Comments

@nzacca
Copy link

nzacca commented Feb 1, 2021

Clearly describe the bug

When using stylelint on Windows using a file path with a normal Windows path ex. C:\dev\myfile.scss, stylelint reports "No files matching the pattern". This is the same issue that was reported in #4772 but that issue was closed as not enough information was provided.

This does work when forward slashes are used but this is not the standard file path used by Windows. This also affects other tools such as @speedy/build-angular which uses stylelint under the hood to pass a list of files to lint.

Which rule, if any, is the bug related to?

This is not related to any specific Rule. This is about running stylelint successfully on a Windows platform.

What code is needed to reproduce the bug?

N/A but a simple file may be used such as:

.foo { color: black; }

What stylelint configuration is needed to reproduce the bug?

N/A but the following can be used to match the example above.

{
  "rules": {
    "color-named": "never"
  }
}

Which version of stylelint are you using?

13.9.0

How are you running stylelint: CLI, PostCSS plugin, Node.js API?

Using the CLI with the following command: stylelint c:\dev\myfile.scss

Does the bug relate to non-standard syntax (e.g. SCSS, Less etc.)?

I am using SCSS but this is not a bug with the parsing of the file.

What did you expect to happen?

I expect the command to complete successfully when using standard Windows file path with backslashes.

What actually happened (e.g. what warnings or errors did you get)?

The following error message was written to the console:

Error: No files matching the pattern "c:\dev\myfile.scss" were found.
    at c:\dev\node_modules\stylelint\lib\standalone.js:212:12
    at processTicksAndRejections (internal/process/task_queues.js:97:5)

Notes:

To fix this, I think stylelint just needs to normalize the file paths for the files passed into it to a format that it expects.

@hudochenkov
Copy link
Member

hudochenkov commented Feb 1, 2021

Could you try to put a file path in double quotes?

stylelint "c:\dev\myfile.scss"

@nzacca
Copy link
Author

nzacca commented Feb 1, 2021

@hudochenkov

Thank you so much for the quick reply. I have tried placing the file in quotes and I receive the same error as in the original post.

Since posting, I have tried 13.8.0 and receive the same issue. I'm going to try 13.7.2 next.

@nzacca
Copy link
Author

nzacca commented Feb 1, 2021

@hudochenkov

I have also tried 13.7.2 now and same problem. I'm wondering now if this is possibly a dependency issue that could be causing this?

@jeddy3 jeddy3 added the status: needs investigation triage needs further investigation label Feb 4, 2021
@amiramix
Copy link

amiramix commented May 5, 2021

I started seeing this exact error after upgrading stylelint from 10.0.1 to 13.13.0. So a temporary workaround is to revert to an older version until this is fixed.

@glat
Copy link

glat commented Jun 24, 2021

It works by using slashes "/" in paths. If I use backslashes "\" I got that errors. Windows, of course. Can it be a bug of a base package?

@woutervanvliet
Copy link

We're seeing this issue as well on our team.

@woutervanvliet
Copy link

Apparently there's a change in the globby API causing this issue. My colleague is preparing a PR.

@tbowmo
Copy link
Contributor

tbowmo commented Jul 7, 2021

As mentioned by @woutervanvliet the problem lies in globby, from version 10 it doesn't support backward slashes in globs, which is also stated in their documentation here

A quick hack where backslashes where replaced with forward slashes on the fileList supplied to globby in standalone.js, makes a couple of tests break (when running the tests on both windows and linux), but makes stylelint work in windows with standard backslash paths.. So need to look into that part.

@jeddy3
Copy link
Member

jeddy3 commented Jul 14, 2021

Fixed by #5386

@jeddy3 jeddy3 closed this as completed Jul 14, 2021
@zcqno1
Copy link

zcqno1 commented Sep 6, 2021

It seems that the fix was not released yet. Should we wait unti stylint v14 ? @jeddy3

Fixed by #5386

@jeddy3
Copy link
Member

jeddy3 commented Sep 6, 2021

Yes, but we need help getting 14.0.0 ready for release.

The next task is adding a overrides configuration object property. Please consider contributing if you have time.

@robertYang1024
Copy link

I updated lint-staged to "10.0.0" and solved this problem

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
status: needs investigation triage needs further investigation
Development

Successfully merging a pull request may close this issue.

9 participants