parent
440ab4f60b
commit
a938076ae5
|
@ -399,10 +399,12 @@ function createIgnorerFromContextOrDie(context) {
|
|||
}
|
||||
|
||||
function eachFilename(context, patterns, callback) {
|
||||
// The '!./' globs are due to https://github.com/prettier/prettier/issues/2110
|
||||
const ignoreNodeModules = context.argv["with-node-modules"] !== true;
|
||||
if (ignoreNodeModules) {
|
||||
patterns = patterns.concat(["!**/node_modules/**", "!./node_modules/**"]);
|
||||
}
|
||||
patterns = patterns.concat(["!**/.{git,svn,hg}/**", "!./.{git,svn,hg}/**"]);
|
||||
|
||||
try {
|
||||
const filePaths = globby
|
||||
|
|
|
@ -0,0 +1,10 @@
|
|||
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
||||
|
||||
exports[`ignores files in version control systems (stderr) 1`] = `""`;
|
||||
|
||||
exports[`ignores files in version control systems (stdout) 1`] = `
|
||||
"file.js
|
||||
"
|
||||
`;
|
||||
|
||||
exports[`ignores files in version control systems (write) 1`] = `Array []`;
|
|
@ -72,7 +72,7 @@ directory/nested-directory/nested-directory-file.js
|
|||
exports[`multiple patterns with non exists pattern (write) 1`] = `Array []`;
|
||||
|
||||
exports[`multiple patterns, throw error and exit with non zero code on non existing files (stderr) 1`] = `
|
||||
"[error] No matching files. Patterns tried: non-existent.js other-non-existent.js !**/node_modules/** !./node_modules/**
|
||||
"[error] No matching files. Patterns tried: non-existent.js other-non-existent.js !**/node_modules/** !./node_modules/** !**/.{git,svn,hg}/** !./.{git,svn,hg}/**
|
||||
"
|
||||
`;
|
||||
|
||||
|
|
|
@ -0,0 +1,16 @@
|
|||
"use strict";
|
||||
|
||||
const runPrettier = require("../runPrettier");
|
||||
|
||||
expect.addSnapshotSerializer(require("../path-serializer"));
|
||||
|
||||
describe("ignores files in version control systems", () => {
|
||||
runPrettier("cli/ignore-vcs-files", [
|
||||
".svn/file.js",
|
||||
".hg/file.js",
|
||||
"file.js",
|
||||
"-l"
|
||||
]).test({
|
||||
status: 1
|
||||
});
|
||||
});
|
|
@ -0,0 +1 @@
|
|||
'use strict';
|
|
@ -0,0 +1,2 @@
|
|||
/* eslint-disable */
|
||||
'use strict';
|
|
@ -0,0 +1 @@
|
|||
'use strict';
|
Loading…
Reference in New Issue