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 type { NodePath } from "@babel/traverse";
import nameFunction from "@babel/helper-function-name"; import nameFunction from "@babel/helper-function-name";
import ReplaceSupers from "@babel/helper-replace-supers"; import ReplaceSupers from "@babel/helper-replace-supers";

View File

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

View File

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