Make the typescript preset require a filename unless the user configured it for general use.

This commit is contained in:
Logan Smyth
2018-05-16 15:06:35 -07:00
parent ca1c98b255
commit 43aa61d6be
10 changed files with 91 additions and 14 deletions

View File

@@ -5,6 +5,16 @@ export default declare(api => {
return {
manipulateOptions(opts, parserOpts) {
// If the Typescript plugin already ran, it will have decided whether
// or not this is a TSX file.
if (
parserOpts.plugins.some(
p => (Array.isArray(p) ? p[0] : p) === "typescript",
)
) {
return;
}
parserOpts.plugins.push("jsx");
},
};