commit
11624eec20
|
@ -9,7 +9,13 @@ const getExplorerMemoized = mem(opts =>
|
|||
cosmiconfig("prettier", {
|
||||
sync: opts.sync,
|
||||
cache: opts.cache,
|
||||
rcExtensions: true
|
||||
rcExtensions: true,
|
||||
transform: result => {
|
||||
if (result && result.config) {
|
||||
delete result.config.$schema;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
})
|
||||
);
|
||||
|
||||
|
|
|
@ -109,3 +109,23 @@ test("API resolveConfig.sync overrides work with absolute paths", () => {
|
|||
tabWidth: 6
|
||||
});
|
||||
});
|
||||
|
||||
test("API resolveConfig removes $schema option", () => {
|
||||
const file = path.resolve(
|
||||
path.join(__dirname, "../cli/config/$schema/index.js")
|
||||
);
|
||||
return prettier.resolveConfig(file).then(result => {
|
||||
expect(result).toEqual({
|
||||
tabWidth: 42
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
test("API resolveConfig.sync removes $schema option", () => {
|
||||
const file = path.resolve(
|
||||
path.join(__dirname, "../cli/config/$schema/index.js")
|
||||
);
|
||||
expect(prettier.resolveConfig.sync(file)).toEqual({
|
||||
tabWidth: 42
|
||||
});
|
||||
});
|
||||
|
|
|
@ -0,0 +1,4 @@
|
|||
{
|
||||
"$schema": "http://json.schemastore.org/prettierrc",
|
||||
"tabWidth": 42
|
||||
}
|
Loading…
Reference in New Issue