Disable flow on transformClass, fix preset-env errors (#7605)

This commit is contained in:
Michał Pierzchała 2018-03-21 00:42:11 +01:00 committed by Brian Ng
parent 55bf55398a
commit 81c1b49f6a
3 changed files with 6 additions and 9 deletions

View File

@ -1,4 +1,3 @@
// @flow
import type { NodePath } from "@babel/traverse";
import nameFunction from "@babel/helper-function-name";
import ReplaceSupers from "@babel/helper-replace-supers";

View File

@ -15,7 +15,7 @@ const validIncludesAndExcludes = new Set([
...defaultWebIncludes,
]);
const pluginToRegExp = (plugin: any): RegExp => {
const pluginToRegExp = (plugin: any): ?RegExp => {
if (plugin instanceof RegExp) return plugin;
try {
return new RegExp(`^${normalizePluginName(plugin)}$`);
@ -24,7 +24,7 @@ const pluginToRegExp = (plugin: any): RegExp => {
}
};
const selectPlugins = (regexp: RegExp): Array<string> =>
const selectPlugins = (regexp: ?RegExp): Array<string> =>
Array.from(validIncludesAndExcludes).filter(
item => regexp instanceof RegExp && regexp.test(item),
);
@ -35,7 +35,7 @@ const expandIncludesAndExcludes = (
plugins: Array<string | RegExp> = [],
type: string,
): Array<string> => {
if (plugins.length === 0) return plugins;
if (plugins.length === 0) return [];
const selectedPlugins = plugins.map(plugin =>
selectPlugins(pluginToRegExp(plugin)),
@ -67,9 +67,7 @@ export const checkDuplicateIncludeExcludes = (
include: Array<string> = [],
exclude: Array<string> = [],
): void => {
const duplicates: Array<string> = include.filter(
opt => exclude.indexOf(opt) >= 0,
);
const duplicates = include.filter(opt => exclude.indexOf(opt) >= 0);
invariant(
duplicates.length === 0,

View File

@ -14,10 +14,10 @@ export type BuiltInsOption = false | "entry" | "usage";
export type Options = {
configPath: string,
debug: boolean,
exclude: Array<string>,
exclude: Array<string | RegExp>,
forceAllTransforms: boolean,
ignoreBrowserslistConfig: boolean,
include: Array<string>,
include: Array<string | RegExp>,
loose: boolean,
modules: ModuleOption,
shippedProposals: boolean,