Remove Flow support in React preset (#6118)

This commit is contained in:
Ramiro Silveyra d'Avila
2017-08-21 11:48:18 -03:00
committed by Henry Zhu
parent 3569cb9922
commit 9e4e64dac9
14 changed files with 11 additions and 20 deletions

View File

@@ -5,7 +5,6 @@
This preset always includes the following plugins:
- [syntax-jsx](https://babeljs.io/docs/plugins/syntax-jsx/)
- [transform-flow-strip-types](https://babeljs.io/docs/plugins/transform-flow-strip-types/)
- [transform-react-jsx](https://babeljs.io/docs/plugins/transform-react-jsx/)
- [transform-react-display-name](https://babeljs.io/docs/plugins/transform-react-display-name/)
@@ -14,15 +13,7 @@ And with the `development` option:
- [transform-react-jsx-self](https://babeljs.io/docs/plugins/transform-react-jsx-self/)
- [transform-react-jsx-source](https://babeljs.io/docs/plugins/transform-react-jsx-source/)
Note: This preset sets the `requireDirective` option on
`transform-flow-strip-types`. This means Flow annotations and declarations
will _only_ be removed in files that have a `// @flow ` directive. It will also
throw errors for any Flow annotations found in files without the directive.
```js
// @flow
function foo(numVal: number, strVal: string) {}
```
> Note: Flow syntax support is no longer enabled in v7. For that, you will need to add the [Flow preset](https://babeljs.io/docs/plugins/preset-flow/).
## Install

View File

@@ -9,7 +9,6 @@
"main": "lib/index.js",
"dependencies": {
"babel-plugin-syntax-jsx": "7.0.0-alpha.19",
"babel-plugin-transform-flow-strip-types": "7.0.0-alpha.19",
"babel-plugin-transform-react-display-name": "7.0.0-alpha.19",
"babel-plugin-transform-react-jsx": "7.0.0-alpha.19",
"babel-plugin-transform-react-jsx-self": "7.0.0-alpha.19",

View File

@@ -1,4 +1,3 @@
import transformFlowStripTypes from "babel-plugin-transform-flow-strip-types";
import transformReactJSX from "babel-plugin-transform-react-jsx";
import transformSyntaxJSX from "babel-plugin-syntax-jsx";
import transformReactDisplayName from "babel-plugin-transform-react-display-name";
@@ -20,7 +19,6 @@ export default function(context, opts = {}) {
development && transformReactJSXSource,
development && transformReactJSXSelf,
[transformFlowStripTypes, { requireDirective: true }],
].filter(Boolean),
};
}

View File

@@ -1,5 +0,0 @@
{
"presets": [
"react"
]
}

View File

@@ -1,2 +0,0 @@
// @flow
function foo(numVal: number, strVal: string) {}

View File

@@ -1 +0,0 @@
function foo(numVal, strVal) {}

View File

@@ -1 +0,0 @@
function foo(numVal: number, strVal: string) {}

View File

@@ -1 +0,0 @@
function foo(numVal: number, strVal: string) {}

View File

@@ -1,3 +0,0 @@
{
"throws": "A @flow directive is required when using Flow annotations with babel-preset-react or the `requireDirective` option."
}