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

Update globby requirement from ^9.2.0 to ^10.0.1 #4254

Merged
merged 24 commits into from Jan 3, 2020
Merged
Show file tree
Hide file tree
Changes from 7 commits
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion lib/printConfig.js
Expand Up @@ -29,7 +29,7 @@ module.exports = function(

const filePath = files[0];

if (globby.hasMagic(filePath)) {
if (globby.hasMagic(filePath.replace(/\\/g, "/"))) {
return Promise.reject(
new Error("The --print-config option does not support globs.")
);
Expand Down
6 changes: 1 addition & 5 deletions lib/standalone.js
Expand Up @@ -170,11 +170,7 @@ module.exports = function(
});
}

let fileList = files;

if (typeof fileList === "string") {
fileList = [fileList];
}
let fileList = [].concat(files).map(file => file.replace(/\\/g, "/"));
Copy link
Member

Choose a reason for hiding this comment

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

It can potentially output linux paths on windows, we need test this

Copy link
Member

Choose a reason for hiding this comment

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

I did not understand what you exactly mean =(
If you mean that stylelint can try to output fixed code to wrong (linux-like) file path, than we have such tests, see https://github.com/stylelint/stylelint/blob/master/system-tests/fix/fix.test.js#L60

Copy link
Member

Choose a reason for hiding this comment

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

So I found only one workaround for

There is no way to pass \ in file name

and

no ability to use backslashes for escaping characters

allow users escape with double backslashes only 🙀


if (!options.disableDefaultIgnores) {
fileList = fileList.concat(ALWAYS_IGNORED_GLOBS.map(glob => "!" + glob));
Expand Down
7 changes: 6 additions & 1 deletion lib/utils/noFilesFoundError.js
@@ -1,5 +1,7 @@
"use strict";

const isWin = process.platform === "win32";

class NoFilesFoundError extends Error {
constructor(fileList) {
super();
Expand All @@ -8,7 +10,10 @@ class NoFilesFoundError extends Error {
fileList = [fileList];
}

const pattern = fileList.filter(i => !i.startsWith("!")).join(", ");
const pattern = fileList
.filter(i => !i.startsWith("!"))
.map(file => (isWin ? file.replace(/\//g, "\\") : file))
.join(", ");

this.message = `No files matching the pattern "${pattern}" were found.`;
}
Expand Down
2 changes: 1 addition & 1 deletion package.json
Expand Up @@ -48,7 +48,7 @@
"file-entry-cache": "^5.0.1",
"get-stdin": "^7.0.0",
"global-modules": "^2.0.0",
"globby": "^9.2.0",
"globby": "^10.0.1",
"globjoin": "^0.1.4",
"html-tags": "^3.0.0",
"ignore": "^5.0.6",
Expand Down