Respect EditorConfig when --config is passed (#3992)

* Respect EditorConfig when `--config` is passed

* Clarify config-resolution test file

See https://github.com/prettier/prettier/pull/3255#issuecomment-348420546

* Update test snapshots
This commit is contained in:
Joseph Frazier authored and Lucas Azzola committed 2018-02-24 19:11:23 +11:00
1 parent a0668129da
commit 5153b15245
4 files changed
+9 -9

No files matched your search

+1 -1
View File
@@ -9,7 +9,7 @@ const findProjectRoot = require("find-project-root");
const maybeParse = (filePath, config, parse) => {
const root = findProjectRoot(path.dirname(path.resolve(filePath)));
return filePath && !config && parse(filePath, { root });
return filePath && parse(filePath, { root });
};
const editorconfigAsyncNoCache = (filePath, config) => {
@@ -34,7 +34,7 @@ console.log(
);
function js() {
console.log(
\\"js/file.js should have tab width 8\\"
\\"js/file.js should have tab width 8 (1 if CLI)\\"
);
}
\\"use strict\\";
@@ -81,7 +81,7 @@ exports[`accepts configuration from --config (stderr) 1`] = `""`;
exports[`accepts configuration from --config (stdout) 1`] = `
"function js() {
console.log(\\"js/file.js should have tab width 8\\")
console.log(\\"js/file.js should have tab width 8 (1 if CLI)\\")
}
"
`;
@@ -122,7 +122,7 @@ console.log(\\"jest/__best-tests__/file.js should have semi\\");
console.log(\\"jest/Component.js should not have semi\\")
console.log(\\"jest/Component.test.js should have semi\\");
function js() {
console.log(\\"js/file.js should have tab width 8\\");
console.log(\\"js/file.js should have tab width 8 (1 if CLI)\\");
}
\\"use strict\\";
@@ -49,7 +49,7 @@ exports[`CLI overrides gets ignored when config exists with --config-precedence
exports[`CLI overrides gets ignored when config exists with --config-precedence prefer-file (stdout) 1`] = `
"function js() {
console.log(\\"js/file.js should have tab width 8\\");
console.log(\\"js/file.js should have tab width 8 (1 if CLI)\\");
}
\\"use strict\\";
@@ -65,7 +65,7 @@ exports[`CLI overrides take lower precedence with --config-precedence file-overr
exports[`CLI overrides take lower precedence with --config-precedence file-override (stdout) 1`] = `
"function js() {
console.log(\\"js/file.js should have tab width 8\\");
console.log(\\"js/file.js should have tab width 8 (1 if CLI)\\");
}
\\"use strict\\";
@@ -111,7 +111,7 @@ console.log(
);
function js() {
console.log(
\\"js/file.js should have tab width 8\\"
\\"js/file.js should have tab width 8 (1 if CLI)\\"
);
}
\\"use strict\\";
@@ -188,7 +188,7 @@ console.log(
);
function js() {
console.log(
\\"js/file.js should have tab width 8\\"
\\"js/file.js should have tab width 8 (1 if CLI)\\"
);
}
\\"use strict\\";
+1 -1
View File
@@ -1,3 +1,3 @@
function js() {
console.log("js/file.js should have tab width 8");
console.log("js/file.js should have tab width 8 (1 if CLI)");
}