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 8 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
3 changes: 2 additions & 1 deletion lib/printConfig.js
Expand Up @@ -2,6 +2,7 @@
"use strict";

const _ = require("lodash");
const convertToGlobbyPath = require("./utils/convertToGlobbyPath");
const createStylelint = require("./createStylelint");
const globby /*: Function*/ = require("globby");
const path = require("path");
Expand Down Expand Up @@ -29,7 +30,7 @@ module.exports = function(

const filePath = files[0];

if (globby.hasMagic(filePath)) {
if (globby.hasMagic(convertToGlobbyPath(filePath))) {
return Promise.reject(
new Error("The --print-config option does not support globs.")
);
Expand Down
9 changes: 3 additions & 6 deletions lib/standalone.js
Expand Up @@ -2,6 +2,7 @@
"use strict";

const _ = require("lodash");
const convertToGlobbyPath = require("./utils/convertToGlobbyPath");
const createStylelint = require("./createStylelint");
const createStylelintResult = require("./createStylelintResult");
const debug = require("debug")("stylelint:standalone");
Expand Down Expand Up @@ -170,11 +171,7 @@ module.exports = function(
});
}

let fileList = files;

if (typeof fileList === "string") {
fileList = [fileList];
}
let fileList = [].concat(files).map(convertToGlobbyPath);

if (!options.disableDefaultIgnores) {
fileList = fileList.concat(ALWAYS_IGNORED_GLOBS.map(glob => "!" + glob));
Expand Down Expand Up @@ -204,7 +201,7 @@ module.exports = function(

if (!filePaths.length) {
if (!allowEmptyInput) {
throw new NoFilesFoundError(fileList);
throw new NoFilesFoundError([].concat(files));
}

return Promise.all([]);
Expand Down
17 changes: 17 additions & 0 deletions lib/utils/convertToGlobbyPath.js
@@ -0,0 +1,17 @@
"use strict";

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

/**
* Convert file path to globby paths
* If you want escape any symbol use double backslashes, this way we can correctly support windows-like paths
* @param {string} path
* @return {string} result of conversion
*/
module.exports = function convertToGlobbyPath(path) {
if (!isWin) {
return path.replace(/\\\\/g, "\\");
}

return path.replace(/\\/g, "/").replace(/\/\//g, "\\");
};
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