Skip to content

Commit 639c523

Browse files
committed
Skip folders in CLI pattern
1 parent 829616d commit 639c523

5 files changed

Lines changed: 24 additions & 1 deletion

File tree

src/cli-util.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -281,7 +281,7 @@ function eachFilename(argv, patterns, callback) {
281281

282282
try {
283283
const filePaths = globby
284-
.sync(patterns, { dot: true })
284+
.sync(patterns, { dot: true, nodir: true })
285285
.map(filePath => path.relative(process.cwd(), filePath));
286286

287287
if (filePaths.length === 0) {
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
// Jest Snapshot v1, https://goo.gl/fbAQLP
2+
3+
exports[`skips folders (stdout) 1`] = `
4+
"skip-folders/a/file.js
5+
skip-folders/b/file.js
6+
"
7+
`;
8+
9+
exports[`skips folders (write) 1`] = `Array []`;
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
"use strict";
2+
3+
const runPrettier = require("../runPrettier");
4+
5+
expect.addSnapshotSerializer(require("../path-serializer"));
6+
7+
describe("skips folders", () => {
8+
runPrettier("cli", ["skip-folders/**/*", "-l"]).test({
9+
status: 1,
10+
stderr: ""
11+
});
12+
});
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
fooA( )
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
fooB( )

0 commit comments

Comments
 (0)