{"name":"babel-plugin-react-flow-props-to-prop-types","version":"0.4.0","description":"Convert Flow React props annotation to PropTypes","main":"lib/index.js","author":{"name":"James Kyle","email":"me@thejameskyle.com"},"license":"MIT","repository":{"type":"git","url":"git+https://github.com/thejameskyle/babel-plugin-react-flow-props-to-prop-types.git"},"scripts":{"precommit":"lint-staged --verbose","prepublish":"yarn build","format":"yarn format-files -s '{src,test}/**/*.js'","format-files":"prettier --write --trailing-comma all --single-quote --no-bracket-spacing","flow":"flow","flow-coverage":"flow-coverage-report -f ./node_modules/.bin/flow -i '{src,test}/**/*.js' -o coverage/flow -t html -t json -t text --threshold 70","delete":"rm -rf lib","build":"yarn delete && babel src -d lib --ignore __tests__","watch":"yarn delete && yarn build -s -- -w","test":"jest","dev":"yarn test -s -- --watch","ci":"yarn test -- --runInBand --coverage && yarn flow && yarn flow-coverage"},"devDependencies":{"babel-cli":"^6.24.1","babel-plugin-tester":"^3.0.0","babel-preset-env":"^1.4.0","babel-preset-flow":"^6.23.0","flow-bin":"^0.46.0","flow-coverage-report":"^0.3.0","husky":"^0.13.3","jest":"^20.0.3","lint-staged":"^3.4.2","prettier":"^1.3.1","strip-indent":"^2.0.0"},"lint-staged":{"src/**/*.js":["yarn format-files -s","git add"]},"jest":{"coverageDirectory":"coverage/jest"},"dependencies":{"babel-errors":"^1.1.0","babel-explode-module":"^1.2.1","babel-file-loader":"^1.0.0","babel-helper-simplify-module":"^2.1.0","babel-log":"^1.0.3","babel-react-components":"^1.0.1","babel-types":"^6.24.1"},"gitHead":"cd066e22dee15b0f6fb08a3be8e9ae1a03870c86","bugs":{"url":"https://github.com/thejameskyle/babel-plugin-react-flow-props-to-prop-types/issues"},"homepage":"https://github.com/thejameskyle/babel-plugin-react-flow-props-to-prop-types#readme","_id":"babel-plugin-react-flow-props-to-prop-types@0.4.0","_shasum":"1642e4989f703ace0923b7b7845bd65c37ffb977","_from":".","_npmVersion":"4.2.0","_nodeVersion":"7.10.0","_npmUser":{"name":"thejameskyle","email":"me@thejameskyle.com"},"dist":{"shasum":"1642e4989f703ace0923b7b7845bd65c37ffb977","tarball":"http://registry-npm.ywwl.com/babel-plugin-react-flow-props-to-prop-types/download/babel-plugin-react-flow-props-to-prop-types-0.4.0.tgz","integrity":"sha512-top/4v0ZzZFpe9u/9zfCOrUZOdcbWhsmxPgkKjhIUh9RfP1UkTd9Q8okwRfGnsOTKgooOZegNuJ4laTRFKmNRQ==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQDlJ3En9XM1wKPe7FsC/fnU6YJtTQmCS/ca2ve2vwk2tQIgGJD4stv5m0EfFoQ4mArSZjvNz97ozY7sCzBoJ6gK0Fw="}],"size":940622,"noattachment":false,"key":"/babel-plugin-react-flow-props-to-prop-types/-/babel-plugin-react-flow-props-to-prop-types-0.4.0.tgz"},"maintainers":[{"name":"thejameskyle","email":"me@thejameskyle.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/babel-plugin-react-flow-props-to-prop-types-0.4.0.tgz_1495857335126_0.3678906662389636"},"directories":{},"readme":"# babel-plugin-react-flow-props-to-prop-types\n\n> Convert Flow React props annotation to PropTypes\n\n- Supports most Flow types (see below)\n- Maintains comments\n- Works across modules (can import types)\n\n**Supported:**\n\n- `any/mixed` Unknown types\n- `void/null` Empty types\n- `number / string / boolean` Primitives\n- `42 / \"hello\" / true` Literals\n- `[1, 2, 3]` Tuples\n- `{ ... }` Objects\n  - `{ prop: number }` Object Properties\n  - `{ prop?: number }` Optional properties\n  - `{ [prop: string]: number }` Optional Indexers\n- `{ [key: string]: number }` Object indexers\n- `Array<string>` Arrays\n- `Object` Unknown Objects\n- `Function` Unknown Functions\n- `RegExp` regular expressions\n- `boolean | string` Unions\n- `{ foo: number } & { bar: string }` Intersections\n- Referencing other types:\n  - `type Alias = number` - Type Aliases\n  - `interface Stuff {}` - Interfaces\n  - `class Thing {}` - Class Declarations\n  - `import type {Alias} from \"./other\";` Type imports\n\n**Unsupported:**\n\n- `{ a: number, [b: string]: number }` Combining properties and indexers\n- `{ [a: string]: number, [b: string]: number }` Multiple indexers\n- `{ (): void }` Object call properties\n- `a.b` Qualified type identifiers\n- `import typeof Export from \"./other\";` Typeof imports\n\n## Example\n\nIn:\n\n```js\nclass MyComponent extends React.Component {\n  props: {\n    // Add a class name to the root element\n    className: string\n  };\n\n  // ...\n}\n```\n\nOut:\n\n```js\nclass MyComponent extends React.Component {\n  props: {\n    // Add a class name to the root element\n    className: string\n  };\n  static propTypes = {\n    // Add a class name to the root element\n    className: PropTypes.string.isRequired\n  };\n\n  // ...\n}\n```\n\n## Installation\n\n```sh\n$ yarn add prop-types prop-types-extra\n$ yarn add --dev babel-plugin-react-flow-props-to-prop-types\n```\n\n> **Note:** [`prop-types-extra`](https://github.com/react-bootstrap/prop-types-extra)\n> is necessary for intersection type support.\n\n## Usage\n\n### Via `.babelrc` (Recommended)\n\n**.babelrc**\n\n```js\n{\n  \"plugins\": [\n    [\"react-flow-props-to-prop-types\", { /* options */ }]\n  ]\n}\n```\n\n### Via CLI\n\n```sh\n$ babel --plugins react-flow-props-to-prop-types script.js\n```\n\n### Via Node API\n\n```javascript\nrequire(\"babel-core\").transform(\"code\", {\n  plugins: [\n    [\"react-flow-props-to-prop-types\", { /* options */ }]\n  ]\n});\n```\n\n## Options\n\n### `resolveOpts` (optional)\n\nPassed through to [node-resolve](https://github.com/substack/node-resolve)\n\n### Override type used in propTypes\n\nSometimes you have Flow types which cannot be translated into PropTypes. In\nthese scenarios you can provide your own type:\n\n```js\nimport type {PropType} from \"babel-plugin-react-flow-props-to-prop-types\";\n\nclass MyComponent extends React.Component {\n  props: {\n    foo: PropType<UnknownFunctionType, Function>\n  };\n}\n```\n\nPropType is defined as:\n\n```js\ntype PropType<T, R> = T;\n```\n\nSo Flow will use the first type you provide, while this Babel plugin will use\nthe second.\n","publish_time":1495857335216,"_cnpm_publish_time":1495857335216,"dist-tags":{"latest":"0.15.0"}}