Skip to content

Commit

Permalink
Minor refactor to expandPatterns (prettier#15317)
Browse files Browse the repository at this point in the history
  • Loading branch information
fisker authored and medikoo committed Feb 15, 2024
1 parent f252428 commit 02f9ca1
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions src/cli/expand-patterns.js
Original file line number Diff line number Diff line change
Expand Up @@ -84,12 +84,12 @@ async function* expandPatternsInternal(context) {
it returns files like 'src/../index.js'
*/
const relativePath = path.relative(cwd, absolutePath) || ".";
const prefix = escapePathForGlob(fixWindowsSlashes(relativePath));
entries.push({
type: "dir",
glob:
escapePathForGlob(fixWindowsSlashes(relativePath)) +
"/" +
getSupportedFilesGlob(),
glob: getSupportedFilesGlob().map(
(pattern) => `${prefix}/**/${pattern}`,
),
input: pattern,
});
}
Expand Down Expand Up @@ -135,10 +135,10 @@ async function* expandPatternsInternal(context) {
const filenames = context.languages.flatMap(
(lang) => lang.filenames || [],
);
supportedFilesGlob = `**/{${[
supportedFilesGlob = [
...extensions.map((ext) => "*" + (ext[0] === "." ? ext : "." + ext)),
...filenames,
]}}`;
];
}
return supportedFilesGlob;
}
Expand Down

0 comments on commit 02f9ca1

Please sign in to comment.