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

@@ -9,6 +9,16 @@ export default declare((api, options) => {
return {
manipulateOptions(opts, parserOpts) {
// If the file has already enabled TS, assume that this is not a
// valid Flowtype file.
if (
parserOpts.plugins.some(
p => (Array.isArray(p) ? p[0] : p) === "typescript",
)
) {
return;
}
parserOpts.plugins.push(["flow", { all }]);
},
};