├── docs ├── demo.gif ├── logo.png ├── logo.sketch └── screenshot.png ├── .gitignore ├── .eslintignore ├── .flowconfig ├── src ├── utils │ ├── __tests__ │ │ ├── __snapshots__ │ │ │ ├── API.test.js.snap │ │ │ ├── config.test.js.snap │ │ │ └── toMarkdown.test.js.snap │ │ ├── config.test.js │ │ ├── API.test.js │ │ ├── toMarkdown.test.js │ │ └── getCommand.test.js │ ├── config.js │ ├── getCommand.js │ ├── API.js │ └── toMarkdown.js ├── index.js ├── __tests__ │ ├── fixtures │ │ ├── issue.opened.json │ │ └── issue.edited.json │ ├── index.test.js │ └── listener.test.js ├── type │ └── index.flow.js └── listener.js ├── flow-typed └── npm │ ├── flow-bin_v0.x.x.js │ ├── eslint-config-react-app_vx.x.x.js │ ├── eslint-plugin-prettier_vx.x.x.js │ ├── await-url_vx.x.x.js │ ├── now_vx.x.x.js │ ├── request-promise_vx.x.x.js │ ├── argv-split_vx.x.x.js │ ├── eslint-config-prettier_vx.x.x.js │ ├── localtunnel_vx.x.x.js │ ├── eslint-plugin-jest_vx.x.x.js │ ├── prettier_vx.x.x.js │ ├── eslint-config-airbnb_vx.x.x.js │ ├── babel-eslint_vx.x.x.js │ ├── request_vx.x.x.js │ ├── probot_vx.x.x.js │ ├── nodemon_vx.x.x.js │ ├── codecov_vx.x.x.js │ ├── eslint-plugin-import_vx.x.x.js │ ├── eslint-plugin-flowtype_vx.x.x.js │ ├── jest_v21.x.x.js │ ├── eslint-plugin-react_vx.x.x.js │ └── ramda_v0.x.x.js ├── .editorconfig ├── .env.example ├── .travis.yml ├── tasks └── deploy.sh ├── LICENSE ├── CONTRIBUTING.md ├── CHANGELOG.md ├── CODE_OF_CONDUCT.md ├── package.json └── README.md /docs/demo.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/evenchange4/gh-polls-bot/HEAD/docs/demo.gif -------------------------------------------------------------------------------- /docs/logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/evenchange4/gh-polls-bot/HEAD/docs/logo.png -------------------------------------------------------------------------------- /docs/logo.sketch: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/evenchange4/gh-polls-bot/HEAD/docs/logo.sketch -------------------------------------------------------------------------------- /docs/screenshot.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/evenchange4/gh-polls-bot/HEAD/docs/screenshot.png -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | node_modules 2 | npm-debug.log 3 | *.pem 4 | .env 5 | package-lock.json 6 | /coverage 7 | /flow-coverage 8 | -------------------------------------------------------------------------------- /.eslintignore: -------------------------------------------------------------------------------- 1 | # dependencies 2 | /node_modules 3 | 4 | # testing 5 | /coverage 6 | 7 | # flow 8 | /flow-typed 9 | /flow-coverage 10 | -------------------------------------------------------------------------------- /.flowconfig: -------------------------------------------------------------------------------- 1 | [ignore] 2 | 3 | [include] 4 | 5 | [libs] 6 | /flow-typed 7 | ./src/type 8 | 9 | [lints] 10 | 11 | [options] 12 | 13 | [strict] 14 | -------------------------------------------------------------------------------- /src/utils/__tests__/__snapshots__/API.test.js.snap: -------------------------------------------------------------------------------- 1 | // Jest Snapshot v1, https://goo.gl/fbAQLP 2 | 3 | exports[`should resolve id with API response 1`] = `"MOCK_ID"`; 4 | -------------------------------------------------------------------------------- /src/utils/__tests__/config.test.js: -------------------------------------------------------------------------------- 1 | // @flow 2 | const config = require('../config'); 3 | 4 | it('should return config', () => { 5 | expect(config).toMatchSnapshot(); 6 | }); 7 | -------------------------------------------------------------------------------- /src/index.js: -------------------------------------------------------------------------------- 1 | // @flow 2 | const { addPollListener } = require('./listener'); 3 | 4 | module.exports = (robot /* : Robot */) => { 5 | robot.on(['issues.opened', 'issues.edited'], addPollListener); 6 | }; 7 | -------------------------------------------------------------------------------- /src/utils/__tests__/__snapshots__/config.test.js.snap: -------------------------------------------------------------------------------- 1 | // Jest Snapshot v1, https://goo.gl/fbAQLP 2 | 3 | exports[`should return config 1`] = ` 4 | Object { 5 | "BASE_URL": "https://api.gh-polls.com", 6 | "LABEL": "Polls", 7 | } 8 | `; 9 | -------------------------------------------------------------------------------- /flow-typed/npm/flow-bin_v0.x.x.js: -------------------------------------------------------------------------------- 1 | // flow-typed signature: 6a5610678d4b01e13bbfbbc62bdaf583 2 | // flow-typed version: 3817bc6980/flow-bin_v0.x.x/flow_>=v0.25.x 3 | 4 | declare module "flow-bin" { 5 | declare module.exports: string; 6 | } 7 | -------------------------------------------------------------------------------- /src/utils/__tests__/API.test.js: -------------------------------------------------------------------------------- 1 | // @flow 2 | const API = require('../API'); 3 | 4 | jest.mock('request-promise', () => () => ({ id: 'MOCK_ID' })); 5 | 6 | it('should resolve id with API response', async () => { 7 | expect(await API.addPoll(['1', '2'])).toMatchSnapshot(); 8 | }); 9 | -------------------------------------------------------------------------------- /src/utils/config.js: -------------------------------------------------------------------------------- 1 | // @flow 2 | 3 | /** 4 | * ref: https://github.com/srph/gh-polls-web/blob/master/src/config.js 5 | */ 6 | const BASE_URL /* : string */ = 'https://api.gh-polls.com'; 7 | const LABEL /* : string */ = 'Polls'; 8 | 9 | module.exports = { 10 | BASE_URL, 11 | LABEL, 12 | }; 13 | -------------------------------------------------------------------------------- /src/utils/getCommand.js: -------------------------------------------------------------------------------- 1 | // @flow 2 | const R = require('ramda'); 3 | 4 | /** 5 | * RegExp ref: https://regex101.com/r/0memMW/3 6 | */ 7 | const getCommand /* : (string) => any */ = R.pipe( 8 | R.match(/^\/polls\b[ \t]+(.*)+$/m), 9 | Array.from, 10 | ); 11 | 12 | module.exports = getCommand; 13 | -------------------------------------------------------------------------------- /.editorconfig: -------------------------------------------------------------------------------- 1 | # editorconfig.org 2 | root = true 3 | 4 | [*] 5 | indent_style = space 6 | indent_size = 2 7 | end_of_line = lf 8 | charset = utf-8 9 | trim_trailing_whitespace = true 10 | insert_final_newline = true 11 | 12 | [*.md] 13 | trim_trailing_whitespace = false 14 | 15 | [Makefile] 16 | indent_style = tab -------------------------------------------------------------------------------- /.env.example: -------------------------------------------------------------------------------- 1 | # The ID of your GitHub App 2 | APP_ID=6386 3 | WEBHOOK_SECRET=development 4 | PRIVATE_KEY_PATH=./private-key.pem 5 | 6 | # Uncomment this to get verbose logging 7 | # LOG_LEVEL=trace # or `info` to show less 8 | 9 | # Subdomain to use for localtunnel server. Defaults to your local username. 10 | # SUBDOMAIN= 11 | -------------------------------------------------------------------------------- /src/utils/__tests__/toMarkdown.test.js: -------------------------------------------------------------------------------- 1 | // @flow 2 | const toMarkdown = require('../toMarkdown'); 3 | 4 | it('should return markdown', () => { 5 | expect(toMarkdown('MOCK_ID')(['1', '2', '3'])).toMatchSnapshot(); 6 | }); 7 | 8 | it('should return markdown with only one option', () => { 9 | expect(toMarkdown('MOCK_ID')(['1'])).toMatchSnapshot(); 10 | }); 11 | -------------------------------------------------------------------------------- /src/__tests__/fixtures/issue.opened.json: -------------------------------------------------------------------------------- 1 | { 2 | "event": "issues", 3 | "payload": { 4 | "action": "opened", 5 | "issue": { 6 | "number": 1234, 7 | "labels": [], 8 | "body": "/polls Option1 'Option 2' \"Option 3\"" 9 | }, 10 | "repository": { 11 | "name": "test", 12 | "owner": { 13 | "login": "evenchange4" 14 | } 15 | }, 16 | "installation": { 17 | "id": 1234 18 | } 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /src/utils/API.js: -------------------------------------------------------------------------------- 1 | // @flow 2 | const request /* : Object => Promise */ = require('request-promise'); 3 | const { BASE_URL } = require('./config'); 4 | 5 | /* :: 6 | type GhPollsResponse = { 7 | id: string, 8 | }; 9 | */ 10 | 11 | async function addPoll(options /* : string[] */) /* : Promise */ { 12 | const res /* : GhPollsResponse */ = await request({ 13 | method: 'POST', 14 | uri: `${BASE_URL}/poll`, 15 | body: { 16 | options, 17 | }, 18 | json: true, 19 | }); 20 | 21 | return res.id; 22 | } 23 | 24 | module.exports = { 25 | addPoll, 26 | }; 27 | -------------------------------------------------------------------------------- /src/utils/__tests__/__snapshots__/toMarkdown.test.js.snap: -------------------------------------------------------------------------------- 1 | // Jest Snapshot v1, https://goo.gl/fbAQLP 2 | 3 | exports[`should return markdown 1`] = ` 4 | "[![](https://api.gh-polls.com/poll/MOCK_ID/1)](https://api.gh-polls.com/poll/MOCK_ID/1/vote) 5 | [![](https://api.gh-polls.com/poll/MOCK_ID/2)](https://api.gh-polls.com/poll/MOCK_ID/2/vote) 6 | [![](https://api.gh-polls.com/poll/MOCK_ID/3)](https://api.gh-polls.com/poll/MOCK_ID/3/vote)" 7 | `; 8 | 9 | exports[`should return markdown with only one option 1`] = `"[![](https://api.gh-polls.com/poll/MOCK_ID/1)](https://api.gh-polls.com/poll/MOCK_ID/1/vote)"`; 10 | -------------------------------------------------------------------------------- /src/utils/toMarkdown.js: -------------------------------------------------------------------------------- 1 | // @flow 2 | const R = require('ramda'); 3 | const { BASE_URL } = require('./config'); 4 | 5 | /** 6 | * ref: https://github.com/srph/gh-polls-web/blob/7c8c3a445e994e0307e6d2fef6d9eddd070173f2/src/App.vue#L123 7 | */ 8 | const toMarkdown /* : (string) => (string[]) => string */ = id => 9 | R.pipe( 10 | R.map(option => { 11 | const name = encodeURIComponent(option); 12 | const url = `${BASE_URL}/poll/${id}/${name}`; 13 | const image = `![](${url})`; 14 | return `[${image}](${url}/vote)`; 15 | }), 16 | R.join('\n'), 17 | ); 18 | 19 | module.exports = toMarkdown; 20 | -------------------------------------------------------------------------------- /src/__tests__/fixtures/issue.edited.json: -------------------------------------------------------------------------------- 1 | { 2 | "event": "issues", 3 | "payload": { 4 | "action": "edited", 5 | "issue": { 6 | "number": 1234, 7 | "labels": [ 8 | { 9 | "id": 737406747, 10 | "url": "url", 11 | "name": "Polls", 12 | "color": "ededed", 13 | "default": false 14 | } 15 | ], 16 | "body": "/polls Option4 'Option 5' \"Option 6\"" 17 | }, 18 | "repository": { 19 | "name": "test", 20 | "owner": { 21 | "login": "evenchange4" 22 | } 23 | }, 24 | "installation": { 25 | "id": 1234 26 | } 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /src/type/index.flow.js: -------------------------------------------------------------------------------- 1 | /* eslint no-undef: 0 */ 2 | /** 3 | * For Probot types 4 | */ 5 | 6 | declare type Label = { 7 | name: string, 8 | }; 9 | declare type GitHubApi = { 10 | issues: { 11 | addLabels: Object => Promise, 12 | edit: Object => Promise, 13 | }, 14 | }; 15 | declare type Context = { 16 | payload: { 17 | issue: { 18 | number: number, 19 | body: string, 20 | labels: Label[], 21 | }, 22 | }, 23 | issue: Object => Object, 24 | github: GitHubApi, 25 | }; 26 | declare type Listener = (Context) => Promise; 27 | declare type Robot = { 28 | on: (string | string[], Listener) => void, 29 | auth: () => Promise, 30 | receive: Object => void, 31 | }; 32 | -------------------------------------------------------------------------------- /.travis.yml: -------------------------------------------------------------------------------- 1 | sudo: false 2 | language: node_js 3 | node_js: 4 | - 9.0.0 5 | env: 6 | global: 7 | - YARN_VERSION=1.3.2 8 | 9 | before_install: 10 | - export PATH="$HOME/.yarn/bin:$PATH" 11 | - | 12 | if [[ ! -e ~/.yarn/bin/yarn || $(yarn --version) != "${YARN_VERSION}" ]]; then 13 | curl -o- -L https://yarnpkg.com/install.sh | bash -s -- --version $YARN_VERSION 14 | fi 15 | 16 | script: 17 | - yarn run eslint 18 | - yarn run test 19 | - yarn run flow-coverage 20 | 21 | after_success: 22 | - ./node_modules/.bin/codecov 23 | - | 24 | if [ "$TRAVIS_BRANCH" == 'master' ] && [ "$TRAVIS_PULL_REQUEST" == 'false' ]; then 25 | ./tasks/deploy.sh 26 | fi 27 | 28 | cache: 29 | yarn: true 30 | directories: 31 | - "~/.yarn" 32 | - node_modules 33 | 34 | notifications: 35 | email: evenchange4@gmail.com 36 | -------------------------------------------------------------------------------- /tasks/deploy.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | set -ex 3 | 4 | # ENV Variables, Note: NOW_TOKEN, WEBHOOK_SECRET, PRIVATE_KEY_BASE64 in travisCI 5 | APP_ID=6386 6 | # NOW config 7 | TEAM='gh-polls-bot' 8 | PROJECT='gh-polls-bot' 9 | ALIAS='gh-polls-bot.now.sh' 10 | 11 | export PATH="./node_modules/.bin:$PATH" 12 | 13 | # 1. Wair for deployment ready 14 | URL=$(now -e APP_ID="$APP_ID" -e WEBHOOK_SECRET="$WEBHOOK_SECRET" -e PRIVATE_KEY_BASE64="$PRIVATE_KEY_BASE64" --public --token "$NOW_TOKEN" --team $TEAM) 15 | await-url "$URL/probot" 16 | now ls --token "$NOW_TOKEN" --team $TEAM 17 | 18 | # 2. Alias 19 | now alias set "$URL" "$ALIAS" --token "$NOW_TOKEN" --team $TEAM 20 | 21 | # 3. Purge old services 22 | now remove --yes --safe --token "$NOW_TOKEN" --team $TEAM $PROJECT 23 | 24 | # 4. Scale to 1 25 | now scale "$ALIAS" 1 --token "$NOW_TOKEN" --team $TEAM 26 | 27 | # 5. Log results 28 | now ls --token "$NOW_TOKEN" --team $TEAM 29 | now alias ls --token "$NOW_TOKEN" --team $TEAM 30 | -------------------------------------------------------------------------------- /flow-typed/npm/eslint-config-react-app_vx.x.x.js: -------------------------------------------------------------------------------- 1 | // flow-typed signature: b6b5b58f7f8a793b4e74c3ab03c476f9 2 | // flow-typed version: <>/eslint-config-react-app_v^2.0.1/flow_v0.58.0 3 | 4 | /** 5 | * This is an autogenerated libdef stub for: 6 | * 7 | * 'eslint-config-react-app' 8 | * 9 | * Fill this stub out by replacing all the `any` types. 10 | * 11 | * Once filled out, we encourage you to share your work with the 12 | * community by sending a pull request to: 13 | * https://github.com/flowtype/flow-typed 14 | */ 15 | 16 | declare module 'eslint-config-react-app' { 17 | declare module.exports: any; 18 | } 19 | 20 | /** 21 | * We include stubs for each file inside this npm package in case you need to 22 | * require those files directly. Feel free to delete any files that aren't 23 | * needed. 24 | */ 25 | 26 | 27 | // Filename aliases 28 | declare module 'eslint-config-react-app/index' { 29 | declare module.exports: $Exports<'eslint-config-react-app'>; 30 | } 31 | declare module 'eslint-config-react-app/index.js' { 32 | declare module.exports: $Exports<'eslint-config-react-app'>; 33 | } 34 | -------------------------------------------------------------------------------- /flow-typed/npm/eslint-plugin-prettier_vx.x.x.js: -------------------------------------------------------------------------------- 1 | // flow-typed signature: 1de2a38dc19bba6e49c61592a428b793 2 | // flow-typed version: <>/eslint-plugin-prettier_v^2.3.1/flow_v0.58.0 3 | 4 | /** 5 | * This is an autogenerated libdef stub for: 6 | * 7 | * 'eslint-plugin-prettier' 8 | * 9 | * Fill this stub out by replacing all the `any` types. 10 | * 11 | * Once filled out, we encourage you to share your work with the 12 | * community by sending a pull request to: 13 | * https://github.com/flowtype/flow-typed 14 | */ 15 | 16 | declare module 'eslint-plugin-prettier' { 17 | declare module.exports: any; 18 | } 19 | 20 | /** 21 | * We include stubs for each file inside this npm package in case you need to 22 | * require those files directly. Feel free to delete any files that aren't 23 | * needed. 24 | */ 25 | declare module 'eslint-plugin-prettier/eslint-plugin-prettier' { 26 | declare module.exports: any; 27 | } 28 | 29 | // Filename aliases 30 | declare module 'eslint-plugin-prettier/eslint-plugin-prettier.js' { 31 | declare module.exports: $Exports<'eslint-plugin-prettier/eslint-plugin-prettier'>; 32 | } 33 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2017 Michael Hsu 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /flow-typed/npm/await-url_vx.x.x.js: -------------------------------------------------------------------------------- 1 | // flow-typed signature: a87db0657ca35d1ef5fb4c5a37e935de 2 | // flow-typed version: <>/await-url_v^0.3.0/flow_v0.58.0 3 | 4 | /** 5 | * This is an autogenerated libdef stub for: 6 | * 7 | * 'await-url' 8 | * 9 | * Fill this stub out by replacing all the `any` types. 10 | * 11 | * Once filled out, we encourage you to share your work with the 12 | * community by sending a pull request to: 13 | * https://github.com/flowtype/flow-typed 14 | */ 15 | 16 | declare module 'await-url' { 17 | declare module.exports: any; 18 | } 19 | 20 | /** 21 | * We include stubs for each file inside this npm package in case you need to 22 | * require those files directly. Feel free to delete any files that aren't 23 | * needed. 24 | */ 25 | declare module 'await-url/cli' { 26 | declare module.exports: any; 27 | } 28 | 29 | // Filename aliases 30 | declare module 'await-url/cli.js' { 31 | declare module.exports: $Exports<'await-url/cli'>; 32 | } 33 | declare module 'await-url/index' { 34 | declare module.exports: $Exports<'await-url'>; 35 | } 36 | declare module 'await-url/index.js' { 37 | declare module.exports: $Exports<'await-url'>; 38 | } 39 | -------------------------------------------------------------------------------- /flow-typed/npm/now_vx.x.x.js: -------------------------------------------------------------------------------- 1 | // flow-typed signature: f363534529e5833348f2512d05efc997 2 | // flow-typed version: <>/now_v^8.3.11/flow_v0.58.0 3 | 4 | /** 5 | * This is an autogenerated libdef stub for: 6 | * 7 | * 'now' 8 | * 9 | * Fill this stub out by replacing all the `any` types. 10 | * 11 | * Once filled out, we encourage you to share your work with the 12 | * community by sending a pull request to: 13 | * https://github.com/flowtype/flow-typed 14 | */ 15 | 16 | declare module 'now' { 17 | declare module.exports: any; 18 | } 19 | 20 | /** 21 | * We include stubs for each file inside this npm package in case you need to 22 | * require those files directly. Feel free to delete any files that aren't 23 | * needed. 24 | */ 25 | declare module 'now/download/dist/download' { 26 | declare module.exports: any; 27 | } 28 | 29 | declare module 'now/download/install' { 30 | declare module.exports: any; 31 | } 32 | 33 | // Filename aliases 34 | declare module 'now/download/dist/download.js' { 35 | declare module.exports: $Exports<'now/download/dist/download'>; 36 | } 37 | declare module 'now/download/install.js' { 38 | declare module.exports: $Exports<'now/download/install'>; 39 | } 40 | -------------------------------------------------------------------------------- /flow-typed/npm/request-promise_vx.x.x.js: -------------------------------------------------------------------------------- 1 | // flow-typed signature: 9d0b84dfbf804f42491f5a0311fbc038 2 | // flow-typed version: <>/request-promise_v^4.2.2/flow_v0.58.0 3 | 4 | /** 5 | * This is an autogenerated libdef stub for: 6 | * 7 | * 'request-promise' 8 | * 9 | * Fill this stub out by replacing all the `any` types. 10 | * 11 | * Once filled out, we encourage you to share your work with the 12 | * community by sending a pull request to: 13 | * https://github.com/flowtype/flow-typed 14 | */ 15 | 16 | declare module 'request-promise' { 17 | declare module.exports: any; 18 | } 19 | 20 | /** 21 | * We include stubs for each file inside this npm package in case you need to 22 | * require those files directly. Feel free to delete any files that aren't 23 | * needed. 24 | */ 25 | declare module 'request-promise/errors' { 26 | declare module.exports: any; 27 | } 28 | 29 | declare module 'request-promise/lib/rp' { 30 | declare module.exports: any; 31 | } 32 | 33 | // Filename aliases 34 | declare module 'request-promise/errors.js' { 35 | declare module.exports: $Exports<'request-promise/errors'>; 36 | } 37 | declare module 'request-promise/lib/rp.js' { 38 | declare module.exports: $Exports<'request-promise/lib/rp'>; 39 | } 40 | -------------------------------------------------------------------------------- /src/listener.js: -------------------------------------------------------------------------------- 1 | // @flow 2 | const split /* : string => string[] */ = require('argv-split'); 3 | const R = require('ramda'); 4 | const getCommand = require('./utils/getCommand'); 5 | const { addPoll } = require('./utils/API'); 6 | const toMarkdown = require('./utils/toMarkdown'); 7 | const { LABEL } = require('./utils/config'); 8 | 9 | const addPollListener /* : Listener */ = async context => { 10 | const { body, labels } = context.payload.issue; 11 | const [command, argument] /* : [string, string|void] */ = getCommand(body); 12 | 13 | if (!command || !argument) return; 14 | 15 | try { 16 | // 1. Post API 17 | const options = split(argument); 18 | const id = await addPoll(options); 19 | 20 | // 2. Add Label 21 | if (!R.any(R.propEq('name', LABEL))(labels)) { 22 | await context.github.issues.addLabels(context.issue({ labels: [LABEL] })); 23 | } 24 | 25 | // 3. Update Issue Body 26 | const markdown = toMarkdown(id)(options); 27 | await context.github.issues.edit( 28 | context.issue({ 29 | body: body.replace(command, markdown), 30 | }), 31 | ); 32 | } catch (error) { 33 | console.log(error); // eslint-disable-line 34 | } 35 | }; 36 | 37 | module.exports = { 38 | addPollListener, 39 | }; 40 | -------------------------------------------------------------------------------- /flow-typed/npm/argv-split_vx.x.x.js: -------------------------------------------------------------------------------- 1 | // flow-typed signature: c9faa4940534ad3fbf048710fd3f9287 2 | // flow-typed version: <>/argv-split_v^2.0.1/flow_v0.58.0 3 | 4 | /** 5 | * This is an autogenerated libdef stub for: 6 | * 7 | * 'argv-split' 8 | * 9 | * Fill this stub out by replacing all the `any` types. 10 | * 11 | * Once filled out, we encourage you to share your work with the 12 | * community by sending a pull request to: 13 | * https://github.com/flowtype/flow-typed 14 | */ 15 | 16 | declare module 'argv-split' { 17 | declare module.exports: any; 18 | } 19 | 20 | /** 21 | * We include stubs for each file inside this npm package in case you need to 22 | * require those files directly. Feel free to delete any files that aren't 23 | * needed. 24 | */ 25 | declare module 'argv-split/split' { 26 | declare module.exports: any; 27 | } 28 | 29 | declare module 'argv-split/test' { 30 | declare module.exports: any; 31 | } 32 | 33 | declare module 'argv-split/test/argv-split' { 34 | declare module.exports: any; 35 | } 36 | 37 | // Filename aliases 38 | declare module 'argv-split/split.js' { 39 | declare module.exports: $Exports<'argv-split/split'>; 40 | } 41 | declare module 'argv-split/test.js' { 42 | declare module.exports: $Exports<'argv-split/test'>; 43 | } 44 | declare module 'argv-split/test/argv-split.js' { 45 | declare module.exports: $Exports<'argv-split/test/argv-split'>; 46 | } 47 | -------------------------------------------------------------------------------- /CONTRIBUTING.md: -------------------------------------------------------------------------------- 1 | ## Contributing 2 | 3 | [fork]: /fork 4 | [pr]: /compare 5 | [style]: https://standardjs.com/ 6 | [code-of-conduct]: CODE_OF_CONDUCT.md 7 | 8 | Hi there! We're thrilled that you'd like to contribute to this project. Your help is essential for keeping it great. 9 | 10 | Please note that this project is released with a [Contributor Code of Conduct][code-of-conduct]. By participating in this project you agree to abide by its terms. 11 | 12 | ## Submitting a pull request 13 | 14 | 1. [Fork][fork] and clone the repository 15 | 1. Configure and install the dependencies: `npm install` 16 | 1. Make sure the tests pass on your machine: `npm test`, note: these tests also apply the linter, so no need to lint seperately 17 | 1. Create a new branch: `git checkout -b my-branch-name` 18 | 1. Make your change, add tests, and make sure the tests still pass 19 | 1. Push to your fork and [submit a pull request][pr] 20 | 1. Pat your self on the back and wait for your pull request to be reviewed and merged. 21 | 22 | Here are a few things you can do that will increase the likelihood of your pull request being accepted: 23 | 24 | - Follow the [style guide][style] which is using standard. Any linting errors should be shown when running `npm test` 25 | - Write and update tests. 26 | - Keep your change as focused as possible. If there are multiple changes you would like to make that are not dependent upon each other, consider submitting them as separate pull requests. 27 | - Write a [good commit message](http://tbaggery.com/2008/04/19/a-note-about-git-commit-messages.html). 28 | 29 | Work in Progress pull request are also welcome to get feedback early on, or if there is something blocked you. 30 | 31 | ## Resources 32 | 33 | - [How to Contribute to Open Source](https://opensource.guide/how-to-contribute/) 34 | - [Using Pull Requests](https://help.github.com/articles/about-pull-requests/) 35 | - [GitHub Help](https://help.github.com) 36 | -------------------------------------------------------------------------------- /CHANGELOG.md: -------------------------------------------------------------------------------- 1 | ## Change Log 2 | 3 | ### v1.0.3 (2017/11/07 03:52 +00:00) 4 | - [#14](https://github.com/evenchange4/gh-polls-bot/pull/14) fix(getCommand): update regular expression to check command carefully (#14) (@evenchange4) 5 | - [#11](https://github.com/evenchange4/gh-polls-bot/pull/11) fix: BASE_URL to point to official api (#11) (@tj) 6 | - [84e0990](https://github.com/evenchange4/gh-polls-bot/commit/84e0990973eb8e48029076c491f909ef7fdf634c) docs(CHANGELOG): release (@evenchange4) 7 | 8 | ### v1.0.2 (2017/11/04 02:52 +00:00) 9 | - [fd3c19c](https://github.com/evenchange4/gh-polls-bot/commit/fd3c19c67f8d8cd8fbbe5b78bda0e18bf2d92422) 1.0.2 (@evenchange4) 10 | - [#10](https://github.com/evenchange4/gh-polls-bot/pull/10) fix(addLabel): update Label type & add some integration test (#10) (@evenchange4) 11 | - [#9](https://github.com/evenchange4/gh-polls-bot/pull/9) test(flow): add flow-coverage (#9) (@evenchange4) 12 | - [#8](https://github.com/evenchange4/gh-polls-bot/pull/8) chore(yarn): upgrade to 1.3.2 (#8) (@evenchange4) 13 | 14 | ### v1.0.1 (2017/11/03 02:22 +00:00) 15 | - [566efa3](https://github.com/evenchange4/gh-polls-bot/commit/566efa30d2955207795e3519ce3697bb783cdca9) 1.0.1 (@evenchange4) 16 | - [b445a8f](https://github.com/evenchange4/gh-polls-bot/commit/b445a8fcc663216fc621c00faf403d5f50d79101) docs(CHANGELOG): release (@evenchange4) 17 | - [#7](https://github.com/evenchange4/gh-polls-bot/pull/7) feat(changelog): add github-changelog to automatically create markdown. (#7) (@evenchange4) 18 | - [#6](https://github.com/evenchange4/gh-polls-bot/pull/6) fix(listener): return if there is no arguments (#6) (@evenchange4) 19 | - [#4](https://github.com/evenchange4/gh-polls-bot/pull/4) docs: typo in Readme (#4) (@mohnish) 20 | - [#3](https://github.com/evenchange4/gh-polls-bot/pull/3) test: add flowtype (#3) (@evenchange4) 21 | 22 | ### v1.0.0 (2017/11/02 11:40 +00:00) 23 | - [53d8832](https://github.com/evenchange4/gh-polls-bot/commit/53d883274de73df67ffc3475815bf2b1b180ca0d) docs: update readme and images (@evenchange4) 24 | - [#1](https://github.com/evenchange4/gh-polls-bot/pull/1) docs(README): use MIT license (+9 squashed commits) (@evenchange4) 25 | - [e74fd40](https://github.com/evenchange4/gh-polls-bot/commit/e74fd40d019a6bf127c48d27299137f09d233a04) create-probot-app init (@evenchange4) 26 | -------------------------------------------------------------------------------- /flow-typed/npm/eslint-config-prettier_vx.x.x.js: -------------------------------------------------------------------------------- 1 | // flow-typed signature: c6c919becb9bc99eea73fb0179a7eff9 2 | // flow-typed version: <>/eslint-config-prettier_v^2.7.0/flow_v0.58.0 3 | 4 | /** 5 | * This is an autogenerated libdef stub for: 6 | * 7 | * 'eslint-config-prettier' 8 | * 9 | * Fill this stub out by replacing all the `any` types. 10 | * 11 | * Once filled out, we encourage you to share your work with the 12 | * community by sending a pull request to: 13 | * https://github.com/flowtype/flow-typed 14 | */ 15 | 16 | declare module 'eslint-config-prettier' { 17 | declare module.exports: any; 18 | } 19 | 20 | /** 21 | * We include stubs for each file inside this npm package in case you need to 22 | * require those files directly. Feel free to delete any files that aren't 23 | * needed. 24 | */ 25 | declare module 'eslint-config-prettier/bin/cli' { 26 | declare module.exports: any; 27 | } 28 | 29 | declare module 'eslint-config-prettier/bin/validators' { 30 | declare module.exports: any; 31 | } 32 | 33 | declare module 'eslint-config-prettier/flowtype' { 34 | declare module.exports: any; 35 | } 36 | 37 | declare module 'eslint-config-prettier/react' { 38 | declare module.exports: any; 39 | } 40 | 41 | declare module 'eslint-config-prettier/standard' { 42 | declare module.exports: any; 43 | } 44 | 45 | // Filename aliases 46 | declare module 'eslint-config-prettier/bin/cli.js' { 47 | declare module.exports: $Exports<'eslint-config-prettier/bin/cli'>; 48 | } 49 | declare module 'eslint-config-prettier/bin/validators.js' { 50 | declare module.exports: $Exports<'eslint-config-prettier/bin/validators'>; 51 | } 52 | declare module 'eslint-config-prettier/flowtype.js' { 53 | declare module.exports: $Exports<'eslint-config-prettier/flowtype'>; 54 | } 55 | declare module 'eslint-config-prettier/index' { 56 | declare module.exports: $Exports<'eslint-config-prettier'>; 57 | } 58 | declare module 'eslint-config-prettier/index.js' { 59 | declare module.exports: $Exports<'eslint-config-prettier'>; 60 | } 61 | declare module 'eslint-config-prettier/react.js' { 62 | declare module.exports: $Exports<'eslint-config-prettier/react'>; 63 | } 64 | declare module 'eslint-config-prettier/standard.js' { 65 | declare module.exports: $Exports<'eslint-config-prettier/standard'>; 66 | } 67 | -------------------------------------------------------------------------------- /flow-typed/npm/localtunnel_vx.x.x.js: -------------------------------------------------------------------------------- 1 | // flow-typed signature: e4deecce8c92d8a5f4dd936a9efeaa16 2 | // flow-typed version: <>/localtunnel_v^1.8.3/flow_v0.58.0 3 | 4 | /** 5 | * This is an autogenerated libdef stub for: 6 | * 7 | * 'localtunnel' 8 | * 9 | * Fill this stub out by replacing all the `any` types. 10 | * 11 | * Once filled out, we encourage you to share your work with the 12 | * community by sending a pull request to: 13 | * https://github.com/flowtype/flow-typed 14 | */ 15 | 16 | declare module 'localtunnel' { 17 | declare module.exports: any; 18 | } 19 | 20 | /** 21 | * We include stubs for each file inside this npm package in case you need to 22 | * require those files directly. Feel free to delete any files that aren't 23 | * needed. 24 | */ 25 | declare module 'localtunnel/client' { 26 | declare module.exports: any; 27 | } 28 | 29 | declare module 'localtunnel/fail' { 30 | declare module.exports: any; 31 | } 32 | 33 | declare module 'localtunnel/lib/HeaderHostTransformer' { 34 | declare module.exports: any; 35 | } 36 | 37 | declare module 'localtunnel/lib/Tunnel' { 38 | declare module.exports: any; 39 | } 40 | 41 | declare module 'localtunnel/lib/TunnelCluster' { 42 | declare module.exports: any; 43 | } 44 | 45 | declare module 'localtunnel/request' { 46 | declare module.exports: any; 47 | } 48 | 49 | declare module 'localtunnel/test/index' { 50 | declare module.exports: any; 51 | } 52 | 53 | // Filename aliases 54 | declare module 'localtunnel/client.js' { 55 | declare module.exports: $Exports<'localtunnel/client'>; 56 | } 57 | declare module 'localtunnel/fail.js' { 58 | declare module.exports: $Exports<'localtunnel/fail'>; 59 | } 60 | declare module 'localtunnel/lib/HeaderHostTransformer.js' { 61 | declare module.exports: $Exports<'localtunnel/lib/HeaderHostTransformer'>; 62 | } 63 | declare module 'localtunnel/lib/Tunnel.js' { 64 | declare module.exports: $Exports<'localtunnel/lib/Tunnel'>; 65 | } 66 | declare module 'localtunnel/lib/TunnelCluster.js' { 67 | declare module.exports: $Exports<'localtunnel/lib/TunnelCluster'>; 68 | } 69 | declare module 'localtunnel/request.js' { 70 | declare module.exports: $Exports<'localtunnel/request'>; 71 | } 72 | declare module 'localtunnel/test/index.js' { 73 | declare module.exports: $Exports<'localtunnel/test/index'>; 74 | } 75 | -------------------------------------------------------------------------------- /src/__tests__/index.test.js: -------------------------------------------------------------------------------- 1 | // @flow 2 | const { createRobot } = require('probot'); 3 | const app = require('../index'); 4 | const issueOpenedPayload /* : Object */ = require('./fixtures/issue.opened.json'); 5 | const issueEditedPayload /* : Object */ = require('./fixtures/issue.edited.json'); 6 | 7 | jest.mock('../utils/API', () => ({ 8 | addPoll: () => new Promise(resolve => resolve('ID')), 9 | })); 10 | 11 | /** 12 | * ref: https://probot.github.io/docs/testing/ 13 | */ 14 | describe('App Integration Test', () => { 15 | let robot /* : Robot */; 16 | let mockGitHubAPI; 17 | 18 | beforeEach(() => { 19 | robot /* : Robot */ = createRobot(); 20 | app(robot); 21 | mockGitHubAPI = { 22 | issues: { 23 | addLabels: jest.fn(), 24 | edit: jest.fn(), 25 | }, 26 | }; 27 | robot.auth = () => Promise.resolve(mockGitHubAPI); 28 | }); 29 | 30 | it('should performs actions when issue opened', async () => { 31 | await robot.receive(issueOpenedPayload); 32 | 33 | expect(mockGitHubAPI.issues.addLabels).toHaveBeenCalledWith({ 34 | labels: ['Polls'], 35 | number: 1234, 36 | owner: 'evenchange4', 37 | repo: 'test', 38 | }); 39 | expect(mockGitHubAPI.issues.edit).toHaveBeenCalledWith({ 40 | body: `[![](https://api.gh-polls.com/poll/ID/Option1)](https://api.gh-polls.com/poll/ID/Option1/vote) 41 | [![](https://api.gh-polls.com/poll/ID/Option%202)](https://api.gh-polls.com/poll/ID/Option%202/vote) 42 | [![](https://api.gh-polls.com/poll/ID/Option%203)](https://api.gh-polls.com/poll/ID/Option%203/vote)`, 43 | number: 1234, 44 | owner: 'evenchange4', 45 | repo: 'test', 46 | }); 47 | }); 48 | 49 | it('should performs actions when issue edited', async () => { 50 | await robot.receive(issueEditedPayload); 51 | 52 | expect(mockGitHubAPI.issues.addLabels).not.toHaveBeenCalled(); 53 | expect(mockGitHubAPI.issues.edit).toHaveBeenCalledWith({ 54 | body: `[![](https://api.gh-polls.com/poll/ID/Option4)](https://api.gh-polls.com/poll/ID/Option4/vote) 55 | [![](https://api.gh-polls.com/poll/ID/Option%205)](https://api.gh-polls.com/poll/ID/Option%205/vote) 56 | [![](https://api.gh-polls.com/poll/ID/Option%206)](https://api.gh-polls.com/poll/ID/Option%206/vote)`, 57 | number: 1234, 58 | owner: 'evenchange4', 59 | repo: 'test', 60 | }); 61 | }); 62 | }); 63 | -------------------------------------------------------------------------------- /flow-typed/npm/eslint-plugin-jest_vx.x.x.js: -------------------------------------------------------------------------------- 1 | // flow-typed signature: 4158e82ff72dd74e975236280d0ab12f 2 | // flow-typed version: <>/eslint-plugin-jest_v^21.2.0/flow_v0.58.0 3 | 4 | /** 5 | * This is an autogenerated libdef stub for: 6 | * 7 | * 'eslint-plugin-jest' 8 | * 9 | * Fill this stub out by replacing all the `any` types. 10 | * 11 | * Once filled out, we encourage you to share your work with the 12 | * community by sending a pull request to: 13 | * https://github.com/flowtype/flow-typed 14 | */ 15 | 16 | declare module 'eslint-plugin-jest' { 17 | declare module.exports: any; 18 | } 19 | 20 | /** 21 | * We include stubs for each file inside this npm package in case you need to 22 | * require those files directly. Feel free to delete any files that aren't 23 | * needed. 24 | */ 25 | declare module 'eslint-plugin-jest/build/index' { 26 | declare module.exports: any; 27 | } 28 | 29 | declare module 'eslint-plugin-jest/build/rules/no_disabled_tests' { 30 | declare module.exports: any; 31 | } 32 | 33 | declare module 'eslint-plugin-jest/build/rules/no_focused_tests' { 34 | declare module.exports: any; 35 | } 36 | 37 | declare module 'eslint-plugin-jest/build/rules/no_identical_title' { 38 | declare module.exports: any; 39 | } 40 | 41 | declare module 'eslint-plugin-jest/build/rules/types' { 42 | declare module.exports: any; 43 | } 44 | 45 | declare module 'eslint-plugin-jest/build/rules/valid_expect' { 46 | declare module.exports: any; 47 | } 48 | 49 | // Filename aliases 50 | declare module 'eslint-plugin-jest/build/index.js' { 51 | declare module.exports: $Exports<'eslint-plugin-jest/build/index'>; 52 | } 53 | declare module 'eslint-plugin-jest/build/rules/no_disabled_tests.js' { 54 | declare module.exports: $Exports<'eslint-plugin-jest/build/rules/no_disabled_tests'>; 55 | } 56 | declare module 'eslint-plugin-jest/build/rules/no_focused_tests.js' { 57 | declare module.exports: $Exports<'eslint-plugin-jest/build/rules/no_focused_tests'>; 58 | } 59 | declare module 'eslint-plugin-jest/build/rules/no_identical_title.js' { 60 | declare module.exports: $Exports<'eslint-plugin-jest/build/rules/no_identical_title'>; 61 | } 62 | declare module 'eslint-plugin-jest/build/rules/types.js' { 63 | declare module.exports: $Exports<'eslint-plugin-jest/build/rules/types'>; 64 | } 65 | declare module 'eslint-plugin-jest/build/rules/valid_expect.js' { 66 | declare module.exports: $Exports<'eslint-plugin-jest/build/rules/valid_expect'>; 67 | } 68 | -------------------------------------------------------------------------------- /flow-typed/npm/prettier_vx.x.x.js: -------------------------------------------------------------------------------- 1 | // flow-typed signature: b3094f28e9fccdabf3915f52972b4259 2 | // flow-typed version: <>/prettier_v^1.7.4/flow_v0.58.0 3 | 4 | /** 5 | * This is an autogenerated libdef stub for: 6 | * 7 | * 'prettier' 8 | * 9 | * Fill this stub out by replacing all the `any` types. 10 | * 11 | * Once filled out, we encourage you to share your work with the 12 | * community by sending a pull request to: 13 | * https://github.com/flowtype/flow-typed 14 | */ 15 | 16 | declare module 'prettier' { 17 | declare module.exports: any; 18 | } 19 | 20 | /** 21 | * We include stubs for each file inside this npm package in case you need to 22 | * require those files directly. Feel free to delete any files that aren't 23 | * needed. 24 | */ 25 | declare module 'prettier/bin/prettier' { 26 | declare module.exports: any; 27 | } 28 | 29 | declare module 'prettier/parser-babylon' { 30 | declare module.exports: any; 31 | } 32 | 33 | declare module 'prettier/parser-flow' { 34 | declare module.exports: any; 35 | } 36 | 37 | declare module 'prettier/parser-graphql' { 38 | declare module.exports: any; 39 | } 40 | 41 | declare module 'prettier/parser-parse5' { 42 | declare module.exports: any; 43 | } 44 | 45 | declare module 'prettier/parser-postcss' { 46 | declare module.exports: any; 47 | } 48 | 49 | declare module 'prettier/parser-typescript' { 50 | declare module.exports: any; 51 | } 52 | 53 | // Filename aliases 54 | declare module 'prettier/bin/prettier.js' { 55 | declare module.exports: $Exports<'prettier/bin/prettier'>; 56 | } 57 | declare module 'prettier/index' { 58 | declare module.exports: $Exports<'prettier'>; 59 | } 60 | declare module 'prettier/index.js' { 61 | declare module.exports: $Exports<'prettier'>; 62 | } 63 | declare module 'prettier/parser-babylon.js' { 64 | declare module.exports: $Exports<'prettier/parser-babylon'>; 65 | } 66 | declare module 'prettier/parser-flow.js' { 67 | declare module.exports: $Exports<'prettier/parser-flow'>; 68 | } 69 | declare module 'prettier/parser-graphql.js' { 70 | declare module.exports: $Exports<'prettier/parser-graphql'>; 71 | } 72 | declare module 'prettier/parser-parse5.js' { 73 | declare module.exports: $Exports<'prettier/parser-parse5'>; 74 | } 75 | declare module 'prettier/parser-postcss.js' { 76 | declare module.exports: $Exports<'prettier/parser-postcss'>; 77 | } 78 | declare module 'prettier/parser-typescript.js' { 79 | declare module.exports: $Exports<'prettier/parser-typescript'>; 80 | } 81 | -------------------------------------------------------------------------------- /flow-typed/npm/eslint-config-airbnb_vx.x.x.js: -------------------------------------------------------------------------------- 1 | // flow-typed signature: 25b93f069555f22afe944123ad9e8746 2 | // flow-typed version: <>/eslint-config-airbnb_v^15.1.0/flow_v0.58.0 3 | 4 | /** 5 | * This is an autogenerated libdef stub for: 6 | * 7 | * 'eslint-config-airbnb' 8 | * 9 | * Fill this stub out by replacing all the `any` types. 10 | * 11 | * Once filled out, we encourage you to share your work with the 12 | * community by sending a pull request to: 13 | * https://github.com/flowtype/flow-typed 14 | */ 15 | 16 | declare module 'eslint-config-airbnb' { 17 | declare module.exports: any; 18 | } 19 | 20 | /** 21 | * We include stubs for each file inside this npm package in case you need to 22 | * require those files directly. Feel free to delete any files that aren't 23 | * needed. 24 | */ 25 | declare module 'eslint-config-airbnb/base' { 26 | declare module.exports: any; 27 | } 28 | 29 | declare module 'eslint-config-airbnb/legacy' { 30 | declare module.exports: any; 31 | } 32 | 33 | declare module 'eslint-config-airbnb/rules/react-a11y' { 34 | declare module.exports: any; 35 | } 36 | 37 | declare module 'eslint-config-airbnb/rules/react' { 38 | declare module.exports: any; 39 | } 40 | 41 | declare module 'eslint-config-airbnb/test/test-base' { 42 | declare module.exports: any; 43 | } 44 | 45 | declare module 'eslint-config-airbnb/test/test-react-order' { 46 | declare module.exports: any; 47 | } 48 | 49 | // Filename aliases 50 | declare module 'eslint-config-airbnb/base.js' { 51 | declare module.exports: $Exports<'eslint-config-airbnb/base'>; 52 | } 53 | declare module 'eslint-config-airbnb/index' { 54 | declare module.exports: $Exports<'eslint-config-airbnb'>; 55 | } 56 | declare module 'eslint-config-airbnb/index.js' { 57 | declare module.exports: $Exports<'eslint-config-airbnb'>; 58 | } 59 | declare module 'eslint-config-airbnb/legacy.js' { 60 | declare module.exports: $Exports<'eslint-config-airbnb/legacy'>; 61 | } 62 | declare module 'eslint-config-airbnb/rules/react-a11y.js' { 63 | declare module.exports: $Exports<'eslint-config-airbnb/rules/react-a11y'>; 64 | } 65 | declare module 'eslint-config-airbnb/rules/react.js' { 66 | declare module.exports: $Exports<'eslint-config-airbnb/rules/react'>; 67 | } 68 | declare module 'eslint-config-airbnb/test/test-base.js' { 69 | declare module.exports: $Exports<'eslint-config-airbnb/test/test-base'>; 70 | } 71 | declare module 'eslint-config-airbnb/test/test-react-order.js' { 72 | declare module.exports: $Exports<'eslint-config-airbnb/test/test-react-order'>; 73 | } 74 | -------------------------------------------------------------------------------- /flow-typed/npm/babel-eslint_vx.x.x.js: -------------------------------------------------------------------------------- 1 | // flow-typed signature: 7f9ff1170369673e9e113cbdbbdf0737 2 | // flow-typed version: <>/babel-eslint_v^8.0.1/flow_v0.58.0 3 | 4 | /** 5 | * This is an autogenerated libdef stub for: 6 | * 7 | * 'babel-eslint' 8 | * 9 | * Fill this stub out by replacing all the `any` types. 10 | * 11 | * Once filled out, we encourage you to share your work with the 12 | * community by sending a pull request to: 13 | * https://github.com/flowtype/flow-typed 14 | */ 15 | 16 | declare module 'babel-eslint' { 17 | declare module.exports: any; 18 | } 19 | 20 | /** 21 | * We include stubs for each file inside this npm package in case you need to 22 | * require those files directly. Feel free to delete any files that aren't 23 | * needed. 24 | */ 25 | declare module 'babel-eslint/babylon-to-espree/attachComments' { 26 | declare module.exports: any; 27 | } 28 | 29 | declare module 'babel-eslint/babylon-to-espree/convertComments' { 30 | declare module.exports: any; 31 | } 32 | 33 | declare module 'babel-eslint/babylon-to-espree/convertTemplateType' { 34 | declare module.exports: any; 35 | } 36 | 37 | declare module 'babel-eslint/babylon-to-espree/index' { 38 | declare module.exports: any; 39 | } 40 | 41 | declare module 'babel-eslint/babylon-to-espree/toAST' { 42 | declare module.exports: any; 43 | } 44 | 45 | declare module 'babel-eslint/babylon-to-espree/toToken' { 46 | declare module.exports: any; 47 | } 48 | 49 | declare module 'babel-eslint/babylon-to-espree/toTokens' { 50 | declare module.exports: any; 51 | } 52 | 53 | // Filename aliases 54 | declare module 'babel-eslint/babylon-to-espree/attachComments.js' { 55 | declare module.exports: $Exports<'babel-eslint/babylon-to-espree/attachComments'>; 56 | } 57 | declare module 'babel-eslint/babylon-to-espree/convertComments.js' { 58 | declare module.exports: $Exports<'babel-eslint/babylon-to-espree/convertComments'>; 59 | } 60 | declare module 'babel-eslint/babylon-to-espree/convertTemplateType.js' { 61 | declare module.exports: $Exports<'babel-eslint/babylon-to-espree/convertTemplateType'>; 62 | } 63 | declare module 'babel-eslint/babylon-to-espree/index.js' { 64 | declare module.exports: $Exports<'babel-eslint/babylon-to-espree/index'>; 65 | } 66 | declare module 'babel-eslint/babylon-to-espree/toAST.js' { 67 | declare module.exports: $Exports<'babel-eslint/babylon-to-espree/toAST'>; 68 | } 69 | declare module 'babel-eslint/babylon-to-espree/toToken.js' { 70 | declare module.exports: $Exports<'babel-eslint/babylon-to-espree/toToken'>; 71 | } 72 | declare module 'babel-eslint/babylon-to-espree/toTokens.js' { 73 | declare module.exports: $Exports<'babel-eslint/babylon-to-espree/toTokens'>; 74 | } 75 | declare module 'babel-eslint/index' { 76 | declare module.exports: $Exports<'babel-eslint'>; 77 | } 78 | declare module 'babel-eslint/index.js' { 79 | declare module.exports: $Exports<'babel-eslint'>; 80 | } 81 | -------------------------------------------------------------------------------- /src/utils/__tests__/getCommand.test.js: -------------------------------------------------------------------------------- 1 | // @flow 2 | const getCommand = require('../getCommand'); 3 | 4 | it('should return correct regular expression', () => { 5 | expect(getCommand(`/polls`)).toEqual([]); 6 | expect(getCommand(`/polls `)).toEqual(['/polls ', '']); 7 | expect(getCommand(`/polls 1`)).toEqual(['/polls 1', '1']); 8 | expect(getCommand(`/Polls 1`)).toEqual([]); 9 | expect(getCommand(`/pollss 1`)).toEqual([]); 10 | expect(getCommand(`/polls 1 2`)).toEqual(['/polls 1 2', '1 2']); 11 | expect(getCommand(`/polls 1 2 3`)).toEqual(['/polls 1 2 3', '1 2 3']); 12 | expect(getCommand(`/polls 1 2 3 4 `)).toEqual([ 13 | '/polls 1 2 3 4 ', 14 | '1 2 3 4 ', 15 | ]); 16 | expect( 17 | getCommand(`/polls 1 2 3 4 18 | 5`), 19 | ).toEqual(['/polls 1 2 3 4', '1 2 3 4']); 20 | expect(getCommand(`/polls 1 '23' "5 5" 66`)).toEqual([ 21 | `/polls 1 '23' "5 5" 66`, 22 | `1 '23' "5 5" 66`, 23 | ]); 24 | expect(getCommand(`/polls option1 'option 2' "option 3" `)).toEqual([ 25 | `/polls option1 'option 2' "option 3" `, 26 | `option1 'option 2' "option 3" `, 27 | ]); 28 | expect(getCommand(`/polls/travis/.rvm/rubies`)).toEqual([]); 29 | expect(getCommand(`/polls 1 2 3 `)).toEqual([ 30 | `/polls 1 2 3 `, 31 | `1 2 3 `, 32 | ]); 33 | expect(getCommand(`/polls\t1\t2\t3\ttab`)).toEqual([ 34 | `/polls\t1\t2\t3\ttab`, 35 | `1\t2\t3\ttab`, 36 | ]); 37 | expect( 38 | getCommand( 39 | `/home/travis/.rvm/rubies/ruby-2.4.0/lib/ruby/site_ruby/2.4.0/bundler/templates/Executable`, 40 | ), 41 | ).toEqual([]); 42 | }); 43 | 44 | it('should return command with body content', () => { 45 | const body = ` 46 | # H1 47 | ## H2 48 | > code 49 | /polls 1 2 3 50 | 4`; 51 | expect(getCommand(body)).toEqual(['/polls 1 2 3', '1 2 3']); 52 | }); 53 | 54 | it('should return only one command', () => { 55 | const body = ` 56 | # H1 57 | ## H2 58 | > code 59 | /polls 4 5 6 60 | /polls 1 2 3 61 | `; 62 | expect(getCommand(body)).toEqual(['/polls 4 5 6', '4 5 6']); 63 | }); 64 | 65 | it('should return the first matched command', () => { 66 | const body = ` 67 | # H1 68 | ## H2 69 | /polls 7 8 69 70 | > code 71 | /polls 1 2 3 72 | `; 73 | expect(getCommand(body)).toEqual(['/polls 7 8 69', '7 8 69']); 74 | }); 75 | 76 | it('should return command without argument', () => { 77 | const body = ` 78 | # H1 79 | ## H2 80 | /polls 81 | `; 82 | expect(getCommand(body)).toEqual([]); 83 | }); 84 | 85 | it('should return empty array without any argument matched issue#13', () => { 86 | const body = `Errno::ENOENT: No such file or directory @ rb_sysopen - 87 | /home/travis/.rvm/rubies/ruby-2.4.0/lib/ruby/site_ruby/2.4.0/bundler/templates/Executable 88 | An error occurred while installing concurrent-ruby (1.0.5), and Bundler cannot 89 | continue. 90 | Make sure that gem install concurrent-ruby -v '1.0.5' succeeds before 91 | bundling.`; 92 | expect(getCommand(body)).toEqual([]); 93 | }); 94 | -------------------------------------------------------------------------------- /flow-typed/npm/request_vx.x.x.js: -------------------------------------------------------------------------------- 1 | // flow-typed signature: 9514582ff8f421ab70a5b6b9ac0d16fd 2 | // flow-typed version: <>/request_v^2.83.0/flow_v0.58.0 3 | 4 | /** 5 | * This is an autogenerated libdef stub for: 6 | * 7 | * 'request' 8 | * 9 | * Fill this stub out by replacing all the `any` types. 10 | * 11 | * Once filled out, we encourage you to share your work with the 12 | * community by sending a pull request to: 13 | * https://github.com/flowtype/flow-typed 14 | */ 15 | 16 | declare module 'request' { 17 | declare module.exports: any; 18 | } 19 | 20 | /** 21 | * We include stubs for each file inside this npm package in case you need to 22 | * require those files directly. Feel free to delete any files that aren't 23 | * needed. 24 | */ 25 | declare module 'request/lib/auth' { 26 | declare module.exports: any; 27 | } 28 | 29 | declare module 'request/lib/cookies' { 30 | declare module.exports: any; 31 | } 32 | 33 | declare module 'request/lib/getProxyFromURI' { 34 | declare module.exports: any; 35 | } 36 | 37 | declare module 'request/lib/har' { 38 | declare module.exports: any; 39 | } 40 | 41 | declare module 'request/lib/helpers' { 42 | declare module.exports: any; 43 | } 44 | 45 | declare module 'request/lib/multipart' { 46 | declare module.exports: any; 47 | } 48 | 49 | declare module 'request/lib/oauth' { 50 | declare module.exports: any; 51 | } 52 | 53 | declare module 'request/lib/querystring' { 54 | declare module.exports: any; 55 | } 56 | 57 | declare module 'request/lib/redirect' { 58 | declare module.exports: any; 59 | } 60 | 61 | declare module 'request/lib/tunnel' { 62 | declare module.exports: any; 63 | } 64 | 65 | declare module 'request/request' { 66 | declare module.exports: any; 67 | } 68 | 69 | // Filename aliases 70 | declare module 'request/index' { 71 | declare module.exports: $Exports<'request'>; 72 | } 73 | declare module 'request/index.js' { 74 | declare module.exports: $Exports<'request'>; 75 | } 76 | declare module 'request/lib/auth.js' { 77 | declare module.exports: $Exports<'request/lib/auth'>; 78 | } 79 | declare module 'request/lib/cookies.js' { 80 | declare module.exports: $Exports<'request/lib/cookies'>; 81 | } 82 | declare module 'request/lib/getProxyFromURI.js' { 83 | declare module.exports: $Exports<'request/lib/getProxyFromURI'>; 84 | } 85 | declare module 'request/lib/har.js' { 86 | declare module.exports: $Exports<'request/lib/har'>; 87 | } 88 | declare module 'request/lib/helpers.js' { 89 | declare module.exports: $Exports<'request/lib/helpers'>; 90 | } 91 | declare module 'request/lib/multipart.js' { 92 | declare module.exports: $Exports<'request/lib/multipart'>; 93 | } 94 | declare module 'request/lib/oauth.js' { 95 | declare module.exports: $Exports<'request/lib/oauth'>; 96 | } 97 | declare module 'request/lib/querystring.js' { 98 | declare module.exports: $Exports<'request/lib/querystring'>; 99 | } 100 | declare module 'request/lib/redirect.js' { 101 | declare module.exports: $Exports<'request/lib/redirect'>; 102 | } 103 | declare module 'request/lib/tunnel.js' { 104 | declare module.exports: $Exports<'request/lib/tunnel'>; 105 | } 106 | declare module 'request/request.js' { 107 | declare module.exports: $Exports<'request/request'>; 108 | } 109 | -------------------------------------------------------------------------------- /CODE_OF_CONDUCT.md: -------------------------------------------------------------------------------- 1 | # Contributor Covenant Code of Conduct 2 | 3 | ## Our Pledge 4 | 5 | In the interest of fostering an open and welcoming environment, we as contributors and maintainers pledge to making participation in our project and our community a harassment-free experience for everyone, regardless of age, body size, disability, ethnicity, gender identity and expression, level of experience, nationality, personal appearance, race, religion, or sexual identity and orientation. 6 | 7 | ## Our Standards 8 | 9 | Examples of behavior that contributes to creating a positive environment include: 10 | 11 | * Using welcoming and inclusive language 12 | * Being respectful of differing viewpoints and experiences 13 | * Gracefully accepting constructive criticism 14 | * Focusing on what is best for the community 15 | * Showing empathy towards other community members 16 | 17 | Examples of unacceptable behavior by participants include: 18 | 19 | * The use of sexualized language or imagery and unwelcome sexual attention or advances 20 | * Trolling, insulting/derogatory comments, and personal or political attacks 21 | * Public or private harassment 22 | * Publishing others' private information, such as a physical or electronic address, without explicit permission 23 | * Other conduct which could reasonably be considered inappropriate in a professional setting 24 | 25 | ## Our Responsibilities 26 | 27 | Project maintainers are responsible for clarifying the standards of acceptable behavior and are expected to take appropriate and fair corrective action in response to any instances of unacceptable behavior. 28 | 29 | Project maintainers have the right and responsibility to remove, edit, or reject comments, commits, code, wiki edits, issues, and other contributions that are not aligned to this Code of Conduct, or to ban temporarily or permanently any contributor for other behaviors that they deem inappropriate, threatening, offensive, or harmful. 30 | 31 | ## Scope 32 | 33 | This Code of Conduct applies both within project spaces and in public spaces when an individual is representing the project or its community. Examples of representing a project or community include using an official project e-mail address, posting via an official social media account, or acting as an appointed representative at an online or offline event. Representation of a project may be further defined and clarified by project maintainers. 34 | 35 | ## Enforcement 36 | 37 | Instances of abusive, harassing, or otherwise unacceptable behavior may be reported by contacting the project team at evenchange4@gmail.com. The project team will review and investigate all complaints, and will respond in a way that it deems appropriate to the circumstances. The project team is obligated to maintain confidentiality with regard to the reporter of an incident. Further details of specific enforcement policies may be posted separately. 38 | 39 | Project maintainers who do not follow or enforce the Code of Conduct in good faith may face temporary or permanent repercussions as determined by other members of the project's leadership. 40 | 41 | ## Attribution 42 | 43 | This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4, available at [http://contributor-covenant.org/version/1/4][version] 44 | 45 | [homepage]: http://contributor-covenant.org 46 | [version]: http://contributor-covenant.org/version/1/4/ 47 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "gh-polls-bot", 3 | "version": "1.0.3", 4 | "description": "Automatically create polls in GitHub issues.", 5 | "author": "Michael Hsu (徐承志) ", 6 | "license": "MIT", 7 | "repository": "https://github.com/evenchange4/gh-polls-bot.git", 8 | "scripts": { 9 | "start": "probot run ./src/index.js --port 3000", 10 | "now-start": "PRIVATE_KEY=$(echo $PRIVATE_KEY_BASE64 | base64 -d) npm start", 11 | "dev": "nodemon --exec 'npm start'", 12 | "test": "NODE_ENV='test' TZ='UTC' jest --coverage --runInBand --forceExit", 13 | "test:watch": "npm run test -- --watch", 14 | "eslint": "eslint ./", 15 | "format": "prettier --write 'src/**/*.{js,json}'", 16 | "flow": "flow", 17 | "flow-coverage": "flow-coverage-report", 18 | "changelog": "github-changes -o evenchange4 -r gh-polls-bot -b master -f ./CHANGELOG.md --order-semver --use-commit-body" 19 | }, 20 | "now": { 21 | "type": "npm", 22 | "env": { 23 | "NODE_ENV": "production" 24 | } 25 | }, 26 | "dependencies": { 27 | "argv-split": "^2.0.1", 28 | "probot": "^3.0.2", 29 | "ramda": "^0.25.0", 30 | "request": "^2.83.0", 31 | "request-promise": "^4.2.2" 32 | }, 33 | "devDependencies": { 34 | "await-url": "^0.3.0", 35 | "babel-eslint": "^8.0.1", 36 | "codecov": "^3.0.0", 37 | "eslint": "^4.10.0", 38 | "eslint-config-airbnb": "^15.1.0", 39 | "eslint-config-prettier": "^2.7.0", 40 | "eslint-config-react-app": "^2.0.1", 41 | "eslint-plugin-flowtype": "^2.39.1", 42 | "eslint-plugin-import": "^2.8.0", 43 | "eslint-plugin-jest": "^21.2.0", 44 | "eslint-plugin-jsx-a11y": "^5.1.1", 45 | "eslint-plugin-prettier": "^2.3.1", 46 | "eslint-plugin-react": "^7.4.0", 47 | "flow-bin": "^0.58.0", 48 | "flow-coverage-report": "^0.4.0", 49 | "github-changes": "^1.1.0", 50 | "jest": "^21.2.1", 51 | "localtunnel": "^1.8.3", 52 | "nodemon": "^1.12.1", 53 | "now": "^8.3.11", 54 | "prettier": "^1.7.4" 55 | }, 56 | "engines": { 57 | "node": ">=9.0.0" 58 | }, 59 | "jest": { 60 | "testEnvironment": "node", 61 | "collectCoverageFrom": [ 62 | "src/**/*.{js,jsx}", 63 | "!src/**/*.test.{js,jsx}", 64 | "!src/**/*.flow.js" 65 | ], 66 | "testPathIgnorePatterns": [ 67 | "/node_modules/", 68 | "/coverage/", 69 | "/flow-typed/", 70 | "/flow-coverage/" 71 | ] 72 | }, 73 | "flow-coverage-report": { 74 | "excludeGlob": [ 75 | "node_modules/**", 76 | "src/**/*.flow.js" 77 | ], 78 | "includeGlob": [ 79 | "src/**/*.js" 80 | ], 81 | "threshold": 90, 82 | "type": "text" 83 | }, 84 | "prettier": { 85 | "trailingComma": "all", 86 | "singleQuote": true 87 | }, 88 | "eslintConfig": { 89 | "parser": "babel-eslint", 90 | "extends": [ 91 | "react-app", 92 | "airbnb", 93 | "prettier", 94 | "prettier/flowtype", 95 | "prettier/react", 96 | "plugin:jest/recommended" 97 | ], 98 | "plugins": [ 99 | "prettier", 100 | "jest" 101 | ], 102 | "env": { 103 | "jest/globals": true 104 | }, 105 | "rules": { 106 | "react/jsx-filename-extension": [ 107 | 1, 108 | { 109 | "extensions": [ 110 | ".js" 111 | ] 112 | } 113 | ], 114 | "import/no-extraneous-dependencies": 0, 115 | "jsx-a11y/no-static-element-interactions": 0, 116 | "react/forbid-prop-types": 0, 117 | "react/require-default-props": 0, 118 | "prettier/prettier": "error" 119 | } 120 | } 121 | } 122 | -------------------------------------------------------------------------------- /src/__tests__/listener.test.js: -------------------------------------------------------------------------------- 1 | // @flow 2 | const { addPollListener } = require('../listener'); 3 | 4 | jest.mock('../utils/API', () => ({ 5 | addPoll: () => new Promise(resolve => resolve('ID')), 6 | })); 7 | 8 | it('should handle addPollListener', async () => { 9 | const mockGitHubAPI = { 10 | issues: { 11 | addLabels: jest.fn(), 12 | edit: jest.fn(), 13 | }, 14 | }; 15 | const mockContext = { 16 | payload: { 17 | issue: { 18 | number: 1234, 19 | body: 'H1H3\n/polls 1 2 3', 20 | labels: [], 21 | }, 22 | }, 23 | github: mockGitHubAPI, 24 | issue: data => data, 25 | }; 26 | await addPollListener(mockContext); 27 | 28 | expect(mockGitHubAPI.issues.addLabels).toHaveBeenCalledWith({ 29 | labels: ['Polls'], 30 | }); 31 | 32 | expect(mockGitHubAPI.issues.edit).toHaveBeenCalledWith({ 33 | body: `H1H3 34 | [![](https://api.gh-polls.com/poll/ID/1)](https://api.gh-polls.com/poll/ID/1/vote) 35 | [![](https://api.gh-polls.com/poll/ID/2)](https://api.gh-polls.com/poll/ID/2/vote) 36 | [![](https://api.gh-polls.com/poll/ID/3)](https://api.gh-polls.com/poll/ID/3/vote)`, 37 | }); 38 | }); 39 | 40 | it('should not perform addLabels action when there is one', async () => { 41 | const mockGitHubAPI = { 42 | issues: { 43 | addLabels: jest.fn(), 44 | edit: jest.fn(), 45 | }, 46 | }; 47 | const mockContext = { 48 | payload: { 49 | issue: { 50 | number: 1234, 51 | body: 'H1H3\n/polls 1 2 3', 52 | labels: [{ name: 'Polls' }], 53 | }, 54 | }, 55 | github: mockGitHubAPI, 56 | issue: data => data, 57 | }; 58 | await addPollListener(mockContext); 59 | 60 | expect(mockGitHubAPI.issues.addLabels).not.toHaveBeenCalled(); 61 | expect(mockGitHubAPI.issues.edit).toHaveBeenCalledWith({ 62 | body: `H1H3 63 | [![](https://api.gh-polls.com/poll/ID/1)](https://api.gh-polls.com/poll/ID/1/vote) 64 | [![](https://api.gh-polls.com/poll/ID/2)](https://api.gh-polls.com/poll/ID/2/vote) 65 | [![](https://api.gh-polls.com/poll/ID/3)](https://api.gh-polls.com/poll/ID/3/vote)`, 66 | }); 67 | }); 68 | 69 | it('should not performs actions with empty arguments', async () => { 70 | const mockGitHubAPI = { 71 | issues: { 72 | addLabels: jest.fn(), 73 | edit: jest.fn(), 74 | }, 75 | }; 76 | const mockContext = { 77 | payload: { 78 | issue: { 79 | number: 1234, 80 | body: 'H1H3\n/polls', 81 | labels: [{ name: 'Polls' }], 82 | }, 83 | }, 84 | github: mockGitHubAPI, 85 | issue: data => data, 86 | }; 87 | await addPollListener(mockContext); 88 | 89 | expect(mockGitHubAPI.issues.addLabels).not.toHaveBeenCalled(); 90 | expect(mockGitHubAPI.issues.edit).not.toHaveBeenCalled(); 91 | }); 92 | 93 | it('should not performs actions without command matched issue#13', async () => { 94 | const mockGitHubAPI = { 95 | issues: { 96 | addLabels: jest.fn(), 97 | edit: jest.fn(), 98 | }, 99 | }; 100 | const mockContext = { 101 | payload: { 102 | issue: { 103 | number: 1234, 104 | body: `Errno::ENOENT: No such file or directory @ rb_sysopen - 105 | /home/travis/.rvm/rubies/ruby-2.4.0/lib/ruby/site_ruby/2.4.0/bundler/templates/Executable 106 | An error occurred while installing concurrent-ruby (1.0.5), and Bundler cannot 107 | continue. 108 | Make sure that gem install concurrent-ruby -v '1.0.5' succeeds before 109 | bundling.`, 110 | labels: [], 111 | }, 112 | }, 113 | github: mockGitHubAPI, 114 | issue: data => data, 115 | }; 116 | await addPollListener(mockContext); 117 | 118 | expect(mockGitHubAPI.issues.addLabels).not.toHaveBeenCalled(); 119 | expect(mockGitHubAPI.issues.edit).not.toHaveBeenCalled(); 120 | }); 121 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 |

2 | 3 | 4 | 5 |

6 | 7 | # GitHub Polls Bot 8 | 9 | > A GitHub App built with [Probot](https://github.com/probot/probot) that automatically creates [gh-polls](https://github.com/apex/gh-polls) in GitHub issues. 10 | 11 | [![Travis][travis-badge]][travis] 12 | [![Codecov Status][codecov-badge]][codecov] 13 | [![Dependency Status][dependency-badge]][dependency] 14 | [![devDependency Status][devDependency-badge]][devDependency] 15 | [![peerDependency Status][peerDependency-badge]][peerDependency] 16 | [![Greenkeeper badge][greenkeeper-badge]][greenkeeper] 17 | [![prettier][prettier-badge]][prettier] 18 | [![license][license-badge]][license] 19 | 20 | ## Usage 21 | 22 | 1. Configure the GitHub App: [github.com/apps/polls](https://github.com/apps/polls) 23 | 2. Add command to issue: 24 | 25 | ```md 26 | /polls Option1 'Option 2' "Option 3" 27 | 28 | # Automatically replace with the following markdown => 29 | [![](https://api.gh-polls.com/poll/01BY7ECS60GG8F9AR1VMR8745S/Option1)](https://api.gh-polls.com/poll/01BY7ECS60GG8F9AR1VMR8745S/Option1/vote) 30 | [![](https://api.gh-polls.com/poll/01BY7ECS60GG8F9AR1VMR8745S/Option%202)](https://api.gh-polls.com/poll/01BY7ECS60GG8F9AR1VMR8745S/Option%202/vote) 31 | [![](https://api.gh-polls.com/poll/01BY7ECS60GG8F9AR1VMR8745S/Option%203)](https://api.gh-polls.com/poll/01BY7ECS60GG8F9AR1VMR8745S/Option%203/vote) 32 | ``` 33 | 34 | | **Screenshot** | [![](./docs/screenshot.png)](https://github.com/evenchange4/gh-polls-bot/issues/2) | 35 | | -------------- | -------- | 36 | | **Demo** | ![](./docs/demo.gif) | 37 | 38 | ## Developer Guide 39 | 40 | ### Environments 41 | 42 | - Create a `.env` file from `.env.example`. 43 | - Download the `private-key.pem` from GitHub and move it to your project’s directory. 44 | 45 | > Note: Please follow the [Developing an App](https://probot.github.io/docs/development/) section of Probot documents. 46 | 47 | ### Requirements 48 | 49 | - node >= 9.0.0 50 | - yarn >= 1.3.2 51 | 52 | ``` 53 | $ git clone https://github.com/evenchange4/gh-polls-bot 54 | $ yarn install --pure-lockfile 55 | 56 | $ yarn run dev # dev server 57 | $ yarn start # prod server 58 | ``` 59 | 60 | ### Test 61 | 62 | ``` 63 | $ yarn run format 64 | $ yarn run eslint 65 | $ yarn run test:watch 66 | $ yarn run flow 67 | $ yarn run flow-coverage 68 | ``` 69 | 70 | ### Deploy to Now.sh 71 | 72 | Any git commits push to master branch. 73 | 74 | ```cmd 75 | $ npm version patch 76 | $ yarn run changelog 77 | ``` 78 | 79 | > Note: PRIVATE_KEY pem workaround: [first-timers-bot #89](https://github.com/hoodiehq/first-timers-bot/pull/89) 80 | 81 | ### Technology Stacks 82 | 83 | - [Create-Probot-App](https://github.com/probot/create-probot-app) 84 | - Travis - CI 85 | - [Zeit Now.sh](https://zeit.co/now) 86 | 87 | ## Inspiration 88 | 89 | - https://github.com/probot/commands 90 | - https://github.com/srph/gh-polls-web 91 | 92 | ## Misc 93 | 94 | - Redirect to github.com for private repos. [\[apex/gh-polls#3\]](https://github.com/apex/gh-polls/issues/3#issuecomment-312964372) 95 | - PEM format doesn't play nicely with now.sh secrets/env vars. [\[probot/friction#17\]](https://github.com/probot/friction/issues/17) 96 | - Links related to GH polls: 97 | - [Web App](https://app.gh-polls.com/) – GH polls web app 98 | - [apex/gh-polls](https://github.com/apex/gh-polls) – Polls for user feedback in GitHub issues [gh-polls.com](https://gh-polls.com/) 99 | - [bukinoshita/gh-polls](https://github.com/bukinoshita/gh-polls) – node module to create gh-polls 100 | 101 | ## CONTRIBUTING 102 | 103 | * ⇄ Pull requests and ★ Stars are always welcome. 104 | * For bugs and feature requests, please create an issue. 105 | * Pull requests must be accompanied by passing automated tests (`$ yarn run test`). 106 | 107 | ## [CHANGELOG](CHANGELOG.md) 108 | 109 | ## [LICENSE](LICENSE) 110 | 111 | MIT: [http://michaelhsu.mit-license.org](http://michaelhsu.mit-license.org) 112 | 113 | [travis-badge]: https://img.shields.io/travis/evenchange4/gh-polls-bot/master.svg?style=flat-square 114 | [travis]: https://travis-ci.org/evenchange4/gh-polls-bot 115 | [codecov-badge]: https://img.shields.io/codecov/c/github/evenchange4/gh-polls-bot.svg?style=flat-square 116 | [codecov]: https://codecov.io/github/evenchange4/gh-polls-bot?branch=master 117 | [dependency-badge]: https://david-dm.org/evenchange4/gh-polls-bot.svg?style=flat-square 118 | [dependency]: https://david-dm.org/evenchange4/gh-polls-bot 119 | [devDependency-badge]: https://david-dm.org/evenchange4/gh-polls-bot/dev-status.svg?style=flat-square 120 | [devDependency]: https://david-dm.org/evenchange4/gh-polls-bot#info=devDependencies 121 | [peerDependency-badge]: https://david-dm.org/evenchange4/gh-polls-bot/peer-status.svg?style=flat-square 122 | [peerDependency]: https://david-dm.org/evenchange4/gh-polls-bot#info=peerDependencies 123 | [license-badge]: https://img.shields.io/github/license/evenchange4/gh-polls-bot.svg?style=flat-square 124 | [license]: http://michaelhsu.mit-license.org/ 125 | [greenkeeper-badge]: https://badges.greenkeeper.io/evenchange4/gh-polls-bot.svg 126 | [greenkeeper]: https://greenkeeper.io/ 127 | [prettier-badge]: https://img.shields.io/badge/styled_with-prettier-ff69b4.svg?style=flat-square 128 | [prettier]: https://github.com/prettier/prettier 129 | -------------------------------------------------------------------------------- /flow-typed/npm/probot_vx.x.x.js: -------------------------------------------------------------------------------- 1 | // flow-typed signature: dbc2576d107b9aab4482d7e48bb3f1e3 2 | // flow-typed version: <>/probot_v^3.0.1/flow_v0.58.0 3 | 4 | /** 5 | * This is an autogenerated libdef stub for: 6 | * 7 | * 'probot' 8 | * 9 | * Fill this stub out by replacing all the `any` types. 10 | * 11 | * Once filled out, we encourage you to share your work with the 12 | * community by sending a pull request to: 13 | * https://github.com/flowtype/flow-typed 14 | */ 15 | 16 | declare module 'probot' { 17 | declare module.exports: any; 18 | } 19 | 20 | /** 21 | * We include stubs for each file inside this npm package in case you need to 22 | * require those files directly. Feel free to delete any files that aren't 23 | * needed. 24 | */ 25 | declare module 'probot/bin/probot-run' { 26 | declare module.exports: any; 27 | } 28 | 29 | declare module 'probot/bin/probot-simulate' { 30 | declare module.exports: any; 31 | } 32 | 33 | declare module 'probot/bin/probot' { 34 | declare module.exports: any; 35 | } 36 | 37 | declare module 'probot/lib/context' { 38 | declare module.exports: any; 39 | } 40 | 41 | declare module 'probot/lib/paginate' { 42 | declare module.exports: any; 43 | } 44 | 45 | declare module 'probot/lib/plugins/default' { 46 | declare module.exports: any; 47 | } 48 | 49 | declare module 'probot/lib/plugins/stats' { 50 | declare module.exports: any; 51 | } 52 | 53 | declare module 'probot/lib/private-key' { 54 | declare module.exports: any; 55 | } 56 | 57 | declare module 'probot/lib/resolver' { 58 | declare module.exports: any; 59 | } 60 | 61 | declare module 'probot/lib/robot' { 62 | declare module.exports: any; 63 | } 64 | 65 | declare module 'probot/lib/serializers' { 66 | declare module.exports: any; 67 | } 68 | 69 | declare module 'probot/lib/server' { 70 | declare module.exports: any; 71 | } 72 | 73 | declare module 'probot/lib/tunnel' { 74 | declare module.exports: any; 75 | } 76 | 77 | declare module 'probot/test/context' { 78 | declare module.exports: any; 79 | } 80 | 81 | declare module 'probot/test/fixtures/example' { 82 | declare module.exports: any; 83 | } 84 | 85 | declare module 'probot/test/fixtures/plugin/stub-plugin' { 86 | declare module.exports: any; 87 | } 88 | 89 | declare module 'probot/test/index' { 90 | declare module.exports: any; 91 | } 92 | 93 | declare module 'probot/test/plugins/default' { 94 | declare module.exports: any; 95 | } 96 | 97 | declare module 'probot/test/plugins/helper' { 98 | declare module.exports: any; 99 | } 100 | 101 | declare module 'probot/test/plugins/stats' { 102 | declare module.exports: any; 103 | } 104 | 105 | declare module 'probot/test/private-key' { 106 | declare module.exports: any; 107 | } 108 | 109 | declare module 'probot/test/resolver' { 110 | declare module.exports: any; 111 | } 112 | 113 | declare module 'probot/test/robot' { 114 | declare module.exports: any; 115 | } 116 | 117 | declare module 'probot/test/serializers' { 118 | declare module.exports: any; 119 | } 120 | 121 | declare module 'probot/test/server' { 122 | declare module.exports: any; 123 | } 124 | 125 | declare module 'probot/test/setup' { 126 | declare module.exports: any; 127 | } 128 | 129 | // Filename aliases 130 | declare module 'probot/bin/probot-run.js' { 131 | declare module.exports: $Exports<'probot/bin/probot-run'>; 132 | } 133 | declare module 'probot/bin/probot-simulate.js' { 134 | declare module.exports: $Exports<'probot/bin/probot-simulate'>; 135 | } 136 | declare module 'probot/bin/probot.js' { 137 | declare module.exports: $Exports<'probot/bin/probot'>; 138 | } 139 | declare module 'probot/index' { 140 | declare module.exports: $Exports<'probot'>; 141 | } 142 | declare module 'probot/index.js' { 143 | declare module.exports: $Exports<'probot'>; 144 | } 145 | declare module 'probot/lib/context.js' { 146 | declare module.exports: $Exports<'probot/lib/context'>; 147 | } 148 | declare module 'probot/lib/paginate.js' { 149 | declare module.exports: $Exports<'probot/lib/paginate'>; 150 | } 151 | declare module 'probot/lib/plugins/default.js' { 152 | declare module.exports: $Exports<'probot/lib/plugins/default'>; 153 | } 154 | declare module 'probot/lib/plugins/stats.js' { 155 | declare module.exports: $Exports<'probot/lib/plugins/stats'>; 156 | } 157 | declare module 'probot/lib/private-key.js' { 158 | declare module.exports: $Exports<'probot/lib/private-key'>; 159 | } 160 | declare module 'probot/lib/resolver.js' { 161 | declare module.exports: $Exports<'probot/lib/resolver'>; 162 | } 163 | declare module 'probot/lib/robot.js' { 164 | declare module.exports: $Exports<'probot/lib/robot'>; 165 | } 166 | declare module 'probot/lib/serializers.js' { 167 | declare module.exports: $Exports<'probot/lib/serializers'>; 168 | } 169 | declare module 'probot/lib/server.js' { 170 | declare module.exports: $Exports<'probot/lib/server'>; 171 | } 172 | declare module 'probot/lib/tunnel.js' { 173 | declare module.exports: $Exports<'probot/lib/tunnel'>; 174 | } 175 | declare module 'probot/test/context.js' { 176 | declare module.exports: $Exports<'probot/test/context'>; 177 | } 178 | declare module 'probot/test/fixtures/example.js' { 179 | declare module.exports: $Exports<'probot/test/fixtures/example'>; 180 | } 181 | declare module 'probot/test/fixtures/plugin/stub-plugin.js' { 182 | declare module.exports: $Exports<'probot/test/fixtures/plugin/stub-plugin'>; 183 | } 184 | declare module 'probot/test/index.js' { 185 | declare module.exports: $Exports<'probot/test/index'>; 186 | } 187 | declare module 'probot/test/plugins/default.js' { 188 | declare module.exports: $Exports<'probot/test/plugins/default'>; 189 | } 190 | declare module 'probot/test/plugins/helper.js' { 191 | declare module.exports: $Exports<'probot/test/plugins/helper'>; 192 | } 193 | declare module 'probot/test/plugins/stats.js' { 194 | declare module.exports: $Exports<'probot/test/plugins/stats'>; 195 | } 196 | declare module 'probot/test/private-key.js' { 197 | declare module.exports: $Exports<'probot/test/private-key'>; 198 | } 199 | declare module 'probot/test/resolver.js' { 200 | declare module.exports: $Exports<'probot/test/resolver'>; 201 | } 202 | declare module 'probot/test/robot.js' { 203 | declare module.exports: $Exports<'probot/test/robot'>; 204 | } 205 | declare module 'probot/test/serializers.js' { 206 | declare module.exports: $Exports<'probot/test/serializers'>; 207 | } 208 | declare module 'probot/test/server.js' { 209 | declare module.exports: $Exports<'probot/test/server'>; 210 | } 211 | declare module 'probot/test/setup.js' { 212 | declare module.exports: $Exports<'probot/test/setup'>; 213 | } 214 | -------------------------------------------------------------------------------- /flow-typed/npm/nodemon_vx.x.x.js: -------------------------------------------------------------------------------- 1 | // flow-typed signature: 1e46801d22bef6a4ce8290d76fb09147 2 | // flow-typed version: <>/nodemon_v^1.12.1/flow_v0.58.0 3 | 4 | /** 5 | * This is an autogenerated libdef stub for: 6 | * 7 | * 'nodemon' 8 | * 9 | * Fill this stub out by replacing all the `any` types. 10 | * 11 | * Once filled out, we encourage you to share your work with the 12 | * community by sending a pull request to: 13 | * https://github.com/flowtype/flow-typed 14 | */ 15 | 16 | declare module 'nodemon' { 17 | declare module.exports: any; 18 | } 19 | 20 | /** 21 | * We include stubs for each file inside this npm package in case you need to 22 | * require those files directly. Feel free to delete any files that aren't 23 | * needed. 24 | */ 25 | declare module 'nodemon/bin/nodemon' { 26 | declare module.exports: any; 27 | } 28 | 29 | declare module 'nodemon/commitlint.config' { 30 | declare module.exports: any; 31 | } 32 | 33 | declare module 'nodemon/docs/index' { 34 | declare module.exports: any; 35 | } 36 | 37 | declare module 'nodemon/lib/cli/index' { 38 | declare module.exports: any; 39 | } 40 | 41 | declare module 'nodemon/lib/cli/parse' { 42 | declare module.exports: any; 43 | } 44 | 45 | declare module 'nodemon/lib/config/command' { 46 | declare module.exports: any; 47 | } 48 | 49 | declare module 'nodemon/lib/config/defaults' { 50 | declare module.exports: any; 51 | } 52 | 53 | declare module 'nodemon/lib/config/exec' { 54 | declare module.exports: any; 55 | } 56 | 57 | declare module 'nodemon/lib/config/index' { 58 | declare module.exports: any; 59 | } 60 | 61 | declare module 'nodemon/lib/config/load' { 62 | declare module.exports: any; 63 | } 64 | 65 | declare module 'nodemon/lib/help/index' { 66 | declare module.exports: any; 67 | } 68 | 69 | declare module 'nodemon/lib/index' { 70 | declare module.exports: any; 71 | } 72 | 73 | declare module 'nodemon/lib/monitor/index' { 74 | declare module.exports: any; 75 | } 76 | 77 | declare module 'nodemon/lib/monitor/match' { 78 | declare module.exports: any; 79 | } 80 | 81 | declare module 'nodemon/lib/monitor/run' { 82 | declare module.exports: any; 83 | } 84 | 85 | declare module 'nodemon/lib/monitor/watch' { 86 | declare module.exports: any; 87 | } 88 | 89 | declare module 'nodemon/lib/nodemon' { 90 | declare module.exports: any; 91 | } 92 | 93 | declare module 'nodemon/lib/rules/add' { 94 | declare module.exports: any; 95 | } 96 | 97 | declare module 'nodemon/lib/rules/index' { 98 | declare module.exports: any; 99 | } 100 | 101 | declare module 'nodemon/lib/rules/parse' { 102 | declare module.exports: any; 103 | } 104 | 105 | declare module 'nodemon/lib/spawn' { 106 | declare module.exports: any; 107 | } 108 | 109 | declare module 'nodemon/lib/utils/bus' { 110 | declare module.exports: any; 111 | } 112 | 113 | declare module 'nodemon/lib/utils/clone' { 114 | declare module.exports: any; 115 | } 116 | 117 | declare module 'nodemon/lib/utils/colour' { 118 | declare module.exports: any; 119 | } 120 | 121 | declare module 'nodemon/lib/utils/index' { 122 | declare module.exports: any; 123 | } 124 | 125 | declare module 'nodemon/lib/utils/log' { 126 | declare module.exports: any; 127 | } 128 | 129 | declare module 'nodemon/lib/utils/merge' { 130 | declare module.exports: any; 131 | } 132 | 133 | declare module 'nodemon/lib/version' { 134 | declare module.exports: any; 135 | } 136 | 137 | // Filename aliases 138 | declare module 'nodemon/bin/nodemon.js' { 139 | declare module.exports: $Exports<'nodemon/bin/nodemon'>; 140 | } 141 | declare module 'nodemon/commitlint.config.js' { 142 | declare module.exports: $Exports<'nodemon/commitlint.config'>; 143 | } 144 | declare module 'nodemon/docs/index.js' { 145 | declare module.exports: $Exports<'nodemon/docs/index'>; 146 | } 147 | declare module 'nodemon/lib/cli/index.js' { 148 | declare module.exports: $Exports<'nodemon/lib/cli/index'>; 149 | } 150 | declare module 'nodemon/lib/cli/parse.js' { 151 | declare module.exports: $Exports<'nodemon/lib/cli/parse'>; 152 | } 153 | declare module 'nodemon/lib/config/command.js' { 154 | declare module.exports: $Exports<'nodemon/lib/config/command'>; 155 | } 156 | declare module 'nodemon/lib/config/defaults.js' { 157 | declare module.exports: $Exports<'nodemon/lib/config/defaults'>; 158 | } 159 | declare module 'nodemon/lib/config/exec.js' { 160 | declare module.exports: $Exports<'nodemon/lib/config/exec'>; 161 | } 162 | declare module 'nodemon/lib/config/index.js' { 163 | declare module.exports: $Exports<'nodemon/lib/config/index'>; 164 | } 165 | declare module 'nodemon/lib/config/load.js' { 166 | declare module.exports: $Exports<'nodemon/lib/config/load'>; 167 | } 168 | declare module 'nodemon/lib/help/index.js' { 169 | declare module.exports: $Exports<'nodemon/lib/help/index'>; 170 | } 171 | declare module 'nodemon/lib/index.js' { 172 | declare module.exports: $Exports<'nodemon/lib/index'>; 173 | } 174 | declare module 'nodemon/lib/monitor/index.js' { 175 | declare module.exports: $Exports<'nodemon/lib/monitor/index'>; 176 | } 177 | declare module 'nodemon/lib/monitor/match.js' { 178 | declare module.exports: $Exports<'nodemon/lib/monitor/match'>; 179 | } 180 | declare module 'nodemon/lib/monitor/run.js' { 181 | declare module.exports: $Exports<'nodemon/lib/monitor/run'>; 182 | } 183 | declare module 'nodemon/lib/monitor/watch.js' { 184 | declare module.exports: $Exports<'nodemon/lib/monitor/watch'>; 185 | } 186 | declare module 'nodemon/lib/nodemon.js' { 187 | declare module.exports: $Exports<'nodemon/lib/nodemon'>; 188 | } 189 | declare module 'nodemon/lib/rules/add.js' { 190 | declare module.exports: $Exports<'nodemon/lib/rules/add'>; 191 | } 192 | declare module 'nodemon/lib/rules/index.js' { 193 | declare module.exports: $Exports<'nodemon/lib/rules/index'>; 194 | } 195 | declare module 'nodemon/lib/rules/parse.js' { 196 | declare module.exports: $Exports<'nodemon/lib/rules/parse'>; 197 | } 198 | declare module 'nodemon/lib/spawn.js' { 199 | declare module.exports: $Exports<'nodemon/lib/spawn'>; 200 | } 201 | declare module 'nodemon/lib/utils/bus.js' { 202 | declare module.exports: $Exports<'nodemon/lib/utils/bus'>; 203 | } 204 | declare module 'nodemon/lib/utils/clone.js' { 205 | declare module.exports: $Exports<'nodemon/lib/utils/clone'>; 206 | } 207 | declare module 'nodemon/lib/utils/colour.js' { 208 | declare module.exports: $Exports<'nodemon/lib/utils/colour'>; 209 | } 210 | declare module 'nodemon/lib/utils/index.js' { 211 | declare module.exports: $Exports<'nodemon/lib/utils/index'>; 212 | } 213 | declare module 'nodemon/lib/utils/log.js' { 214 | declare module.exports: $Exports<'nodemon/lib/utils/log'>; 215 | } 216 | declare module 'nodemon/lib/utils/merge.js' { 217 | declare module.exports: $Exports<'nodemon/lib/utils/merge'>; 218 | } 219 | declare module 'nodemon/lib/version.js' { 220 | declare module.exports: $Exports<'nodemon/lib/version'>; 221 | } 222 | -------------------------------------------------------------------------------- /flow-typed/npm/codecov_vx.x.x.js: -------------------------------------------------------------------------------- 1 | // flow-typed signature: d2013b1d94f60bfabff9acf432c21bdf 2 | // flow-typed version: <>/codecov_v^3.0.0/flow_v0.58.0 3 | 4 | /** 5 | * This is an autogenerated libdef stub for: 6 | * 7 | * 'codecov' 8 | * 9 | * Fill this stub out by replacing all the `any` types. 10 | * 11 | * Once filled out, we encourage you to share your work with the 12 | * community by sending a pull request to: 13 | * https://github.com/flowtype/flow-typed 14 | */ 15 | 16 | declare module 'codecov' { 17 | declare module.exports: any; 18 | } 19 | 20 | /** 21 | * We include stubs for each file inside this npm package in case you need to 22 | * require those files directly. Feel free to delete any files that aren't 23 | * needed. 24 | */ 25 | declare module 'codecov/lib/codecov' { 26 | declare module.exports: any; 27 | } 28 | 29 | declare module 'codecov/lib/detect' { 30 | declare module.exports: any; 31 | } 32 | 33 | declare module 'codecov/lib/git' { 34 | declare module.exports: any; 35 | } 36 | 37 | declare module 'codecov/lib/offline' { 38 | declare module.exports: any; 39 | } 40 | 41 | declare module 'codecov/lib/services/appveyor' { 42 | declare module.exports: any; 43 | } 44 | 45 | declare module 'codecov/lib/services/buildkite' { 46 | declare module.exports: any; 47 | } 48 | 49 | declare module 'codecov/lib/services/circle' { 50 | declare module.exports: any; 51 | } 52 | 53 | declare module 'codecov/lib/services/codeship' { 54 | declare module.exports: any; 55 | } 56 | 57 | declare module 'codecov/lib/services/drone' { 58 | declare module.exports: any; 59 | } 60 | 61 | declare module 'codecov/lib/services/gitlab' { 62 | declare module.exports: any; 63 | } 64 | 65 | declare module 'codecov/lib/services/jenkins' { 66 | declare module.exports: any; 67 | } 68 | 69 | declare module 'codecov/lib/services/localGit' { 70 | declare module.exports: any; 71 | } 72 | 73 | declare module 'codecov/lib/services/semaphore' { 74 | declare module.exports: any; 75 | } 76 | 77 | declare module 'codecov/lib/services/shippable' { 78 | declare module.exports: any; 79 | } 80 | 81 | declare module 'codecov/lib/services/snap' { 82 | declare module.exports: any; 83 | } 84 | 85 | declare module 'codecov/lib/services/travis' { 86 | declare module.exports: any; 87 | } 88 | 89 | declare module 'codecov/lib/services/wercker' { 90 | declare module.exports: any; 91 | } 92 | 93 | declare module 'codecov/test/detect' { 94 | declare module.exports: any; 95 | } 96 | 97 | declare module 'codecov/test/git' { 98 | declare module.exports: any; 99 | } 100 | 101 | declare module 'codecov/test/index' { 102 | declare module.exports: any; 103 | } 104 | 105 | declare module 'codecov/test/services/appveyor' { 106 | declare module.exports: any; 107 | } 108 | 109 | declare module 'codecov/test/services/buildkite' { 110 | declare module.exports: any; 111 | } 112 | 113 | declare module 'codecov/test/services/circle' { 114 | declare module.exports: any; 115 | } 116 | 117 | declare module 'codecov/test/services/codeship' { 118 | declare module.exports: any; 119 | } 120 | 121 | declare module 'codecov/test/services/drone' { 122 | declare module.exports: any; 123 | } 124 | 125 | declare module 'codecov/test/services/gitlab' { 126 | declare module.exports: any; 127 | } 128 | 129 | declare module 'codecov/test/services/jenkins' { 130 | declare module.exports: any; 131 | } 132 | 133 | declare module 'codecov/test/services/localGit' { 134 | declare module.exports: any; 135 | } 136 | 137 | declare module 'codecov/test/services/semaphore' { 138 | declare module.exports: any; 139 | } 140 | 141 | declare module 'codecov/test/services/shippable' { 142 | declare module.exports: any; 143 | } 144 | 145 | declare module 'codecov/test/services/snap' { 146 | declare module.exports: any; 147 | } 148 | 149 | declare module 'codecov/test/services/travis' { 150 | declare module.exports: any; 151 | } 152 | 153 | declare module 'codecov/test/services/wercker' { 154 | declare module.exports: any; 155 | } 156 | 157 | declare module 'codecov/test/upload' { 158 | declare module.exports: any; 159 | } 160 | 161 | declare module 'codecov/testinit' { 162 | declare module.exports: any; 163 | } 164 | 165 | // Filename aliases 166 | declare module 'codecov/index' { 167 | declare module.exports: $Exports<'codecov'>; 168 | } 169 | declare module 'codecov/index.js' { 170 | declare module.exports: $Exports<'codecov'>; 171 | } 172 | declare module 'codecov/lib/codecov.js' { 173 | declare module.exports: $Exports<'codecov/lib/codecov'>; 174 | } 175 | declare module 'codecov/lib/detect.js' { 176 | declare module.exports: $Exports<'codecov/lib/detect'>; 177 | } 178 | declare module 'codecov/lib/git.js' { 179 | declare module.exports: $Exports<'codecov/lib/git'>; 180 | } 181 | declare module 'codecov/lib/offline.js' { 182 | declare module.exports: $Exports<'codecov/lib/offline'>; 183 | } 184 | declare module 'codecov/lib/services/appveyor.js' { 185 | declare module.exports: $Exports<'codecov/lib/services/appveyor'>; 186 | } 187 | declare module 'codecov/lib/services/buildkite.js' { 188 | declare module.exports: $Exports<'codecov/lib/services/buildkite'>; 189 | } 190 | declare module 'codecov/lib/services/circle.js' { 191 | declare module.exports: $Exports<'codecov/lib/services/circle'>; 192 | } 193 | declare module 'codecov/lib/services/codeship.js' { 194 | declare module.exports: $Exports<'codecov/lib/services/codeship'>; 195 | } 196 | declare module 'codecov/lib/services/drone.js' { 197 | declare module.exports: $Exports<'codecov/lib/services/drone'>; 198 | } 199 | declare module 'codecov/lib/services/gitlab.js' { 200 | declare module.exports: $Exports<'codecov/lib/services/gitlab'>; 201 | } 202 | declare module 'codecov/lib/services/jenkins.js' { 203 | declare module.exports: $Exports<'codecov/lib/services/jenkins'>; 204 | } 205 | declare module 'codecov/lib/services/localGit.js' { 206 | declare module.exports: $Exports<'codecov/lib/services/localGit'>; 207 | } 208 | declare module 'codecov/lib/services/semaphore.js' { 209 | declare module.exports: $Exports<'codecov/lib/services/semaphore'>; 210 | } 211 | declare module 'codecov/lib/services/shippable.js' { 212 | declare module.exports: $Exports<'codecov/lib/services/shippable'>; 213 | } 214 | declare module 'codecov/lib/services/snap.js' { 215 | declare module.exports: $Exports<'codecov/lib/services/snap'>; 216 | } 217 | declare module 'codecov/lib/services/travis.js' { 218 | declare module.exports: $Exports<'codecov/lib/services/travis'>; 219 | } 220 | declare module 'codecov/lib/services/wercker.js' { 221 | declare module.exports: $Exports<'codecov/lib/services/wercker'>; 222 | } 223 | declare module 'codecov/test/detect.js' { 224 | declare module.exports: $Exports<'codecov/test/detect'>; 225 | } 226 | declare module 'codecov/test/git.js' { 227 | declare module.exports: $Exports<'codecov/test/git'>; 228 | } 229 | declare module 'codecov/test/index.js' { 230 | declare module.exports: $Exports<'codecov/test/index'>; 231 | } 232 | declare module 'codecov/test/services/appveyor.js' { 233 | declare module.exports: $Exports<'codecov/test/services/appveyor'>; 234 | } 235 | declare module 'codecov/test/services/buildkite.js' { 236 | declare module.exports: $Exports<'codecov/test/services/buildkite'>; 237 | } 238 | declare module 'codecov/test/services/circle.js' { 239 | declare module.exports: $Exports<'codecov/test/services/circle'>; 240 | } 241 | declare module 'codecov/test/services/codeship.js' { 242 | declare module.exports: $Exports<'codecov/test/services/codeship'>; 243 | } 244 | declare module 'codecov/test/services/drone.js' { 245 | declare module.exports: $Exports<'codecov/test/services/drone'>; 246 | } 247 | declare module 'codecov/test/services/gitlab.js' { 248 | declare module.exports: $Exports<'codecov/test/services/gitlab'>; 249 | } 250 | declare module 'codecov/test/services/jenkins.js' { 251 | declare module.exports: $Exports<'codecov/test/services/jenkins'>; 252 | } 253 | declare module 'codecov/test/services/localGit.js' { 254 | declare module.exports: $Exports<'codecov/test/services/localGit'>; 255 | } 256 | declare module 'codecov/test/services/semaphore.js' { 257 | declare module.exports: $Exports<'codecov/test/services/semaphore'>; 258 | } 259 | declare module 'codecov/test/services/shippable.js' { 260 | declare module.exports: $Exports<'codecov/test/services/shippable'>; 261 | } 262 | declare module 'codecov/test/services/snap.js' { 263 | declare module.exports: $Exports<'codecov/test/services/snap'>; 264 | } 265 | declare module 'codecov/test/services/travis.js' { 266 | declare module.exports: $Exports<'codecov/test/services/travis'>; 267 | } 268 | declare module 'codecov/test/services/wercker.js' { 269 | declare module.exports: $Exports<'codecov/test/services/wercker'>; 270 | } 271 | declare module 'codecov/test/upload.js' { 272 | declare module.exports: $Exports<'codecov/test/upload'>; 273 | } 274 | declare module 'codecov/testinit.js' { 275 | declare module.exports: $Exports<'codecov/testinit'>; 276 | } 277 | -------------------------------------------------------------------------------- /flow-typed/npm/eslint-plugin-import_vx.x.x.js: -------------------------------------------------------------------------------- 1 | // flow-typed signature: d7e445ca2589cbca713cde0e50c0147f 2 | // flow-typed version: <>/eslint-plugin-import_v^2.8.0/flow_v0.58.0 3 | 4 | /** 5 | * This is an autogenerated libdef stub for: 6 | * 7 | * 'eslint-plugin-import' 8 | * 9 | * Fill this stub out by replacing all the `any` types. 10 | * 11 | * Once filled out, we encourage you to share your work with the 12 | * community by sending a pull request to: 13 | * https://github.com/flowtype/flow-typed 14 | */ 15 | 16 | declare module 'eslint-plugin-import' { 17 | declare module.exports: any; 18 | } 19 | 20 | /** 21 | * We include stubs for each file inside this npm package in case you need to 22 | * require those files directly. Feel free to delete any files that aren't 23 | * needed. 24 | */ 25 | declare module 'eslint-plugin-import/config/electron' { 26 | declare module.exports: any; 27 | } 28 | 29 | declare module 'eslint-plugin-import/config/errors' { 30 | declare module.exports: any; 31 | } 32 | 33 | declare module 'eslint-plugin-import/config/react-native' { 34 | declare module.exports: any; 35 | } 36 | 37 | declare module 'eslint-plugin-import/config/react' { 38 | declare module.exports: any; 39 | } 40 | 41 | declare module 'eslint-plugin-import/config/recommended' { 42 | declare module.exports: any; 43 | } 44 | 45 | declare module 'eslint-plugin-import/config/stage-0' { 46 | declare module.exports: any; 47 | } 48 | 49 | declare module 'eslint-plugin-import/config/warnings' { 50 | declare module.exports: any; 51 | } 52 | 53 | declare module 'eslint-plugin-import/lib/core/importType' { 54 | declare module.exports: any; 55 | } 56 | 57 | declare module 'eslint-plugin-import/lib/core/staticRequire' { 58 | declare module.exports: any; 59 | } 60 | 61 | declare module 'eslint-plugin-import/lib/ExportMap' { 62 | declare module.exports: any; 63 | } 64 | 65 | declare module 'eslint-plugin-import/lib/importDeclaration' { 66 | declare module.exports: any; 67 | } 68 | 69 | declare module 'eslint-plugin-import/lib/index' { 70 | declare module.exports: any; 71 | } 72 | 73 | declare module 'eslint-plugin-import/lib/rules/default' { 74 | declare module.exports: any; 75 | } 76 | 77 | declare module 'eslint-plugin-import/lib/rules/export' { 78 | declare module.exports: any; 79 | } 80 | 81 | declare module 'eslint-plugin-import/lib/rules/exports-last' { 82 | declare module.exports: any; 83 | } 84 | 85 | declare module 'eslint-plugin-import/lib/rules/extensions' { 86 | declare module.exports: any; 87 | } 88 | 89 | declare module 'eslint-plugin-import/lib/rules/first' { 90 | declare module.exports: any; 91 | } 92 | 93 | declare module 'eslint-plugin-import/lib/rules/imports-first' { 94 | declare module.exports: any; 95 | } 96 | 97 | declare module 'eslint-plugin-import/lib/rules/max-dependencies' { 98 | declare module.exports: any; 99 | } 100 | 101 | declare module 'eslint-plugin-import/lib/rules/named' { 102 | declare module.exports: any; 103 | } 104 | 105 | declare module 'eslint-plugin-import/lib/rules/namespace' { 106 | declare module.exports: any; 107 | } 108 | 109 | declare module 'eslint-plugin-import/lib/rules/newline-after-import' { 110 | declare module.exports: any; 111 | } 112 | 113 | declare module 'eslint-plugin-import/lib/rules/no-absolute-path' { 114 | declare module.exports: any; 115 | } 116 | 117 | declare module 'eslint-plugin-import/lib/rules/no-amd' { 118 | declare module.exports: any; 119 | } 120 | 121 | declare module 'eslint-plugin-import/lib/rules/no-anonymous-default-export' { 122 | declare module.exports: any; 123 | } 124 | 125 | declare module 'eslint-plugin-import/lib/rules/no-commonjs' { 126 | declare module.exports: any; 127 | } 128 | 129 | declare module 'eslint-plugin-import/lib/rules/no-deprecated' { 130 | declare module.exports: any; 131 | } 132 | 133 | declare module 'eslint-plugin-import/lib/rules/no-duplicates' { 134 | declare module.exports: any; 135 | } 136 | 137 | declare module 'eslint-plugin-import/lib/rules/no-dynamic-require' { 138 | declare module.exports: any; 139 | } 140 | 141 | declare module 'eslint-plugin-import/lib/rules/no-extraneous-dependencies' { 142 | declare module.exports: any; 143 | } 144 | 145 | declare module 'eslint-plugin-import/lib/rules/no-internal-modules' { 146 | declare module.exports: any; 147 | } 148 | 149 | declare module 'eslint-plugin-import/lib/rules/no-mutable-exports' { 150 | declare module.exports: any; 151 | } 152 | 153 | declare module 'eslint-plugin-import/lib/rules/no-named-as-default-member' { 154 | declare module.exports: any; 155 | } 156 | 157 | declare module 'eslint-plugin-import/lib/rules/no-named-as-default' { 158 | declare module.exports: any; 159 | } 160 | 161 | declare module 'eslint-plugin-import/lib/rules/no-named-default' { 162 | declare module.exports: any; 163 | } 164 | 165 | declare module 'eslint-plugin-import/lib/rules/no-namespace' { 166 | declare module.exports: any; 167 | } 168 | 169 | declare module 'eslint-plugin-import/lib/rules/no-nodejs-modules' { 170 | declare module.exports: any; 171 | } 172 | 173 | declare module 'eslint-plugin-import/lib/rules/no-restricted-paths' { 174 | declare module.exports: any; 175 | } 176 | 177 | declare module 'eslint-plugin-import/lib/rules/no-unassigned-import' { 178 | declare module.exports: any; 179 | } 180 | 181 | declare module 'eslint-plugin-import/lib/rules/no-unresolved' { 182 | declare module.exports: any; 183 | } 184 | 185 | declare module 'eslint-plugin-import/lib/rules/no-webpack-loader-syntax' { 186 | declare module.exports: any; 187 | } 188 | 189 | declare module 'eslint-plugin-import/lib/rules/order' { 190 | declare module.exports: any; 191 | } 192 | 193 | declare module 'eslint-plugin-import/lib/rules/prefer-default-export' { 194 | declare module.exports: any; 195 | } 196 | 197 | declare module 'eslint-plugin-import/lib/rules/unambiguous' { 198 | declare module.exports: any; 199 | } 200 | 201 | declare module 'eslint-plugin-import/memo-parser/index' { 202 | declare module.exports: any; 203 | } 204 | 205 | // Filename aliases 206 | declare module 'eslint-plugin-import/config/electron.js' { 207 | declare module.exports: $Exports<'eslint-plugin-import/config/electron'>; 208 | } 209 | declare module 'eslint-plugin-import/config/errors.js' { 210 | declare module.exports: $Exports<'eslint-plugin-import/config/errors'>; 211 | } 212 | declare module 'eslint-plugin-import/config/react-native.js' { 213 | declare module.exports: $Exports<'eslint-plugin-import/config/react-native'>; 214 | } 215 | declare module 'eslint-plugin-import/config/react.js' { 216 | declare module.exports: $Exports<'eslint-plugin-import/config/react'>; 217 | } 218 | declare module 'eslint-plugin-import/config/recommended.js' { 219 | declare module.exports: $Exports<'eslint-plugin-import/config/recommended'>; 220 | } 221 | declare module 'eslint-plugin-import/config/stage-0.js' { 222 | declare module.exports: $Exports<'eslint-plugin-import/config/stage-0'>; 223 | } 224 | declare module 'eslint-plugin-import/config/warnings.js' { 225 | declare module.exports: $Exports<'eslint-plugin-import/config/warnings'>; 226 | } 227 | declare module 'eslint-plugin-import/lib/core/importType.js' { 228 | declare module.exports: $Exports<'eslint-plugin-import/lib/core/importType'>; 229 | } 230 | declare module 'eslint-plugin-import/lib/core/staticRequire.js' { 231 | declare module.exports: $Exports<'eslint-plugin-import/lib/core/staticRequire'>; 232 | } 233 | declare module 'eslint-plugin-import/lib/ExportMap.js' { 234 | declare module.exports: $Exports<'eslint-plugin-import/lib/ExportMap'>; 235 | } 236 | declare module 'eslint-plugin-import/lib/importDeclaration.js' { 237 | declare module.exports: $Exports<'eslint-plugin-import/lib/importDeclaration'>; 238 | } 239 | declare module 'eslint-plugin-import/lib/index.js' { 240 | declare module.exports: $Exports<'eslint-plugin-import/lib/index'>; 241 | } 242 | declare module 'eslint-plugin-import/lib/rules/default.js' { 243 | declare module.exports: $Exports<'eslint-plugin-import/lib/rules/default'>; 244 | } 245 | declare module 'eslint-plugin-import/lib/rules/export.js' { 246 | declare module.exports: $Exports<'eslint-plugin-import/lib/rules/export'>; 247 | } 248 | declare module 'eslint-plugin-import/lib/rules/exports-last.js' { 249 | declare module.exports: $Exports<'eslint-plugin-import/lib/rules/exports-last'>; 250 | } 251 | declare module 'eslint-plugin-import/lib/rules/extensions.js' { 252 | declare module.exports: $Exports<'eslint-plugin-import/lib/rules/extensions'>; 253 | } 254 | declare module 'eslint-plugin-import/lib/rules/first.js' { 255 | declare module.exports: $Exports<'eslint-plugin-import/lib/rules/first'>; 256 | } 257 | declare module 'eslint-plugin-import/lib/rules/imports-first.js' { 258 | declare module.exports: $Exports<'eslint-plugin-import/lib/rules/imports-first'>; 259 | } 260 | declare module 'eslint-plugin-import/lib/rules/max-dependencies.js' { 261 | declare module.exports: $Exports<'eslint-plugin-import/lib/rules/max-dependencies'>; 262 | } 263 | declare module 'eslint-plugin-import/lib/rules/named.js' { 264 | declare module.exports: $Exports<'eslint-plugin-import/lib/rules/named'>; 265 | } 266 | declare module 'eslint-plugin-import/lib/rules/namespace.js' { 267 | declare module.exports: $Exports<'eslint-plugin-import/lib/rules/namespace'>; 268 | } 269 | declare module 'eslint-plugin-import/lib/rules/newline-after-import.js' { 270 | declare module.exports: $Exports<'eslint-plugin-import/lib/rules/newline-after-import'>; 271 | } 272 | declare module 'eslint-plugin-import/lib/rules/no-absolute-path.js' { 273 | declare module.exports: $Exports<'eslint-plugin-import/lib/rules/no-absolute-path'>; 274 | } 275 | declare module 'eslint-plugin-import/lib/rules/no-amd.js' { 276 | declare module.exports: $Exports<'eslint-plugin-import/lib/rules/no-amd'>; 277 | } 278 | declare module 'eslint-plugin-import/lib/rules/no-anonymous-default-export.js' { 279 | declare module.exports: $Exports<'eslint-plugin-import/lib/rules/no-anonymous-default-export'>; 280 | } 281 | declare module 'eslint-plugin-import/lib/rules/no-commonjs.js' { 282 | declare module.exports: $Exports<'eslint-plugin-import/lib/rules/no-commonjs'>; 283 | } 284 | declare module 'eslint-plugin-import/lib/rules/no-deprecated.js' { 285 | declare module.exports: $Exports<'eslint-plugin-import/lib/rules/no-deprecated'>; 286 | } 287 | declare module 'eslint-plugin-import/lib/rules/no-duplicates.js' { 288 | declare module.exports: $Exports<'eslint-plugin-import/lib/rules/no-duplicates'>; 289 | } 290 | declare module 'eslint-plugin-import/lib/rules/no-dynamic-require.js' { 291 | declare module.exports: $Exports<'eslint-plugin-import/lib/rules/no-dynamic-require'>; 292 | } 293 | declare module 'eslint-plugin-import/lib/rules/no-extraneous-dependencies.js' { 294 | declare module.exports: $Exports<'eslint-plugin-import/lib/rules/no-extraneous-dependencies'>; 295 | } 296 | declare module 'eslint-plugin-import/lib/rules/no-internal-modules.js' { 297 | declare module.exports: $Exports<'eslint-plugin-import/lib/rules/no-internal-modules'>; 298 | } 299 | declare module 'eslint-plugin-import/lib/rules/no-mutable-exports.js' { 300 | declare module.exports: $Exports<'eslint-plugin-import/lib/rules/no-mutable-exports'>; 301 | } 302 | declare module 'eslint-plugin-import/lib/rules/no-named-as-default-member.js' { 303 | declare module.exports: $Exports<'eslint-plugin-import/lib/rules/no-named-as-default-member'>; 304 | } 305 | declare module 'eslint-plugin-import/lib/rules/no-named-as-default.js' { 306 | declare module.exports: $Exports<'eslint-plugin-import/lib/rules/no-named-as-default'>; 307 | } 308 | declare module 'eslint-plugin-import/lib/rules/no-named-default.js' { 309 | declare module.exports: $Exports<'eslint-plugin-import/lib/rules/no-named-default'>; 310 | } 311 | declare module 'eslint-plugin-import/lib/rules/no-namespace.js' { 312 | declare module.exports: $Exports<'eslint-plugin-import/lib/rules/no-namespace'>; 313 | } 314 | declare module 'eslint-plugin-import/lib/rules/no-nodejs-modules.js' { 315 | declare module.exports: $Exports<'eslint-plugin-import/lib/rules/no-nodejs-modules'>; 316 | } 317 | declare module 'eslint-plugin-import/lib/rules/no-restricted-paths.js' { 318 | declare module.exports: $Exports<'eslint-plugin-import/lib/rules/no-restricted-paths'>; 319 | } 320 | declare module 'eslint-plugin-import/lib/rules/no-unassigned-import.js' { 321 | declare module.exports: $Exports<'eslint-plugin-import/lib/rules/no-unassigned-import'>; 322 | } 323 | declare module 'eslint-plugin-import/lib/rules/no-unresolved.js' { 324 | declare module.exports: $Exports<'eslint-plugin-import/lib/rules/no-unresolved'>; 325 | } 326 | declare module 'eslint-plugin-import/lib/rules/no-webpack-loader-syntax.js' { 327 | declare module.exports: $Exports<'eslint-plugin-import/lib/rules/no-webpack-loader-syntax'>; 328 | } 329 | declare module 'eslint-plugin-import/lib/rules/order.js' { 330 | declare module.exports: $Exports<'eslint-plugin-import/lib/rules/order'>; 331 | } 332 | declare module 'eslint-plugin-import/lib/rules/prefer-default-export.js' { 333 | declare module.exports: $Exports<'eslint-plugin-import/lib/rules/prefer-default-export'>; 334 | } 335 | declare module 'eslint-plugin-import/lib/rules/unambiguous.js' { 336 | declare module.exports: $Exports<'eslint-plugin-import/lib/rules/unambiguous'>; 337 | } 338 | declare module 'eslint-plugin-import/memo-parser/index.js' { 339 | declare module.exports: $Exports<'eslint-plugin-import/memo-parser/index'>; 340 | } 341 | -------------------------------------------------------------------------------- /flow-typed/npm/eslint-plugin-flowtype_vx.x.x.js: -------------------------------------------------------------------------------- 1 | // flow-typed signature: b56f5adc02632c11429bdcfc7fcd8acd 2 | // flow-typed version: <>/eslint-plugin-flowtype_v^2.39.1/flow_v0.58.0 3 | 4 | /** 5 | * This is an autogenerated libdef stub for: 6 | * 7 | * 'eslint-plugin-flowtype' 8 | * 9 | * Fill this stub out by replacing all the `any` types. 10 | * 11 | * Once filled out, we encourage you to share your work with the 12 | * community by sending a pull request to: 13 | * https://github.com/flowtype/flow-typed 14 | */ 15 | 16 | declare module 'eslint-plugin-flowtype' { 17 | declare module.exports: any; 18 | } 19 | 20 | /** 21 | * We include stubs for each file inside this npm package in case you need to 22 | * require those files directly. Feel free to delete any files that aren't 23 | * needed. 24 | */ 25 | declare module 'eslint-plugin-flowtype/bin/readmeAssertions' { 26 | declare module.exports: any; 27 | } 28 | 29 | declare module 'eslint-plugin-flowtype/dist/index' { 30 | declare module.exports: any; 31 | } 32 | 33 | declare module 'eslint-plugin-flowtype/dist/rules/booleanStyle' { 34 | declare module.exports: any; 35 | } 36 | 37 | declare module 'eslint-plugin-flowtype/dist/rules/defineFlowType' { 38 | declare module.exports: any; 39 | } 40 | 41 | declare module 'eslint-plugin-flowtype/dist/rules/delimiterDangle' { 42 | declare module.exports: any; 43 | } 44 | 45 | declare module 'eslint-plugin-flowtype/dist/rules/genericSpacing' { 46 | declare module.exports: any; 47 | } 48 | 49 | declare module 'eslint-plugin-flowtype/dist/rules/noDupeKeys' { 50 | declare module.exports: any; 51 | } 52 | 53 | declare module 'eslint-plugin-flowtype/dist/rules/noMutableArray' { 54 | declare module.exports: any; 55 | } 56 | 57 | declare module 'eslint-plugin-flowtype/dist/rules/noPrimitiveConstructorTypes' { 58 | declare module.exports: any; 59 | } 60 | 61 | declare module 'eslint-plugin-flowtype/dist/rules/noTypesMissingFileAnnotation' { 62 | declare module.exports: any; 63 | } 64 | 65 | declare module 'eslint-plugin-flowtype/dist/rules/noUnusedExpressions' { 66 | declare module.exports: any; 67 | } 68 | 69 | declare module 'eslint-plugin-flowtype/dist/rules/noWeakTypes' { 70 | declare module.exports: any; 71 | } 72 | 73 | declare module 'eslint-plugin-flowtype/dist/rules/objectTypeDelimiter' { 74 | declare module.exports: any; 75 | } 76 | 77 | declare module 'eslint-plugin-flowtype/dist/rules/requireParameterType' { 78 | declare module.exports: any; 79 | } 80 | 81 | declare module 'eslint-plugin-flowtype/dist/rules/requireReturnType' { 82 | declare module.exports: any; 83 | } 84 | 85 | declare module 'eslint-plugin-flowtype/dist/rules/requireValidFileAnnotation' { 86 | declare module.exports: any; 87 | } 88 | 89 | declare module 'eslint-plugin-flowtype/dist/rules/requireVariableType' { 90 | declare module.exports: any; 91 | } 92 | 93 | declare module 'eslint-plugin-flowtype/dist/rules/semi' { 94 | declare module.exports: any; 95 | } 96 | 97 | declare module 'eslint-plugin-flowtype/dist/rules/sortKeys' { 98 | declare module.exports: any; 99 | } 100 | 101 | declare module 'eslint-plugin-flowtype/dist/rules/spaceAfterTypeColon' { 102 | declare module.exports: any; 103 | } 104 | 105 | declare module 'eslint-plugin-flowtype/dist/rules/spaceBeforeGenericBracket' { 106 | declare module.exports: any; 107 | } 108 | 109 | declare module 'eslint-plugin-flowtype/dist/rules/spaceBeforeTypeColon' { 110 | declare module.exports: any; 111 | } 112 | 113 | declare module 'eslint-plugin-flowtype/dist/rules/typeColonSpacing/evaluateFunctions' { 114 | declare module.exports: any; 115 | } 116 | 117 | declare module 'eslint-plugin-flowtype/dist/rules/typeColonSpacing/evaluateObjectTypeIndexer' { 118 | declare module.exports: any; 119 | } 120 | 121 | declare module 'eslint-plugin-flowtype/dist/rules/typeColonSpacing/evaluateObjectTypeProperty' { 122 | declare module.exports: any; 123 | } 124 | 125 | declare module 'eslint-plugin-flowtype/dist/rules/typeColonSpacing/evaluateReturnType' { 126 | declare module.exports: any; 127 | } 128 | 129 | declare module 'eslint-plugin-flowtype/dist/rules/typeColonSpacing/evaluateTypeCastExpression' { 130 | declare module.exports: any; 131 | } 132 | 133 | declare module 'eslint-plugin-flowtype/dist/rules/typeColonSpacing/evaluateTypical' { 134 | declare module.exports: any; 135 | } 136 | 137 | declare module 'eslint-plugin-flowtype/dist/rules/typeColonSpacing/index' { 138 | declare module.exports: any; 139 | } 140 | 141 | declare module 'eslint-plugin-flowtype/dist/rules/typeColonSpacing/reporter' { 142 | declare module.exports: any; 143 | } 144 | 145 | declare module 'eslint-plugin-flowtype/dist/rules/typeIdMatch' { 146 | declare module.exports: any; 147 | } 148 | 149 | declare module 'eslint-plugin-flowtype/dist/rules/unionIntersectionSpacing' { 150 | declare module.exports: any; 151 | } 152 | 153 | declare module 'eslint-plugin-flowtype/dist/rules/useFlowType' { 154 | declare module.exports: any; 155 | } 156 | 157 | declare module 'eslint-plugin-flowtype/dist/rules/validSyntax' { 158 | declare module.exports: any; 159 | } 160 | 161 | declare module 'eslint-plugin-flowtype/dist/utilities/checkFlowFileAnnotation' { 162 | declare module.exports: any; 163 | } 164 | 165 | declare module 'eslint-plugin-flowtype/dist/utilities/fuzzyStringMatch' { 166 | declare module.exports: any; 167 | } 168 | 169 | declare module 'eslint-plugin-flowtype/dist/utilities/getParameterName' { 170 | declare module.exports: any; 171 | } 172 | 173 | declare module 'eslint-plugin-flowtype/dist/utilities/getTokenAfterParens' { 174 | declare module.exports: any; 175 | } 176 | 177 | declare module 'eslint-plugin-flowtype/dist/utilities/getTokenBeforeParens' { 178 | declare module.exports: any; 179 | } 180 | 181 | declare module 'eslint-plugin-flowtype/dist/utilities/index' { 182 | declare module.exports: any; 183 | } 184 | 185 | declare module 'eslint-plugin-flowtype/dist/utilities/isFlowFile' { 186 | declare module.exports: any; 187 | } 188 | 189 | declare module 'eslint-plugin-flowtype/dist/utilities/isFlowFileAnnotation' { 190 | declare module.exports: any; 191 | } 192 | 193 | declare module 'eslint-plugin-flowtype/dist/utilities/iterateFunctionNodes' { 194 | declare module.exports: any; 195 | } 196 | 197 | declare module 'eslint-plugin-flowtype/dist/utilities/quoteName' { 198 | declare module.exports: any; 199 | } 200 | 201 | declare module 'eslint-plugin-flowtype/dist/utilities/spacingFixers' { 202 | declare module.exports: any; 203 | } 204 | 205 | // Filename aliases 206 | declare module 'eslint-plugin-flowtype/bin/readmeAssertions.js' { 207 | declare module.exports: $Exports<'eslint-plugin-flowtype/bin/readmeAssertions'>; 208 | } 209 | declare module 'eslint-plugin-flowtype/dist/index.js' { 210 | declare module.exports: $Exports<'eslint-plugin-flowtype/dist/index'>; 211 | } 212 | declare module 'eslint-plugin-flowtype/dist/rules/booleanStyle.js' { 213 | declare module.exports: $Exports<'eslint-plugin-flowtype/dist/rules/booleanStyle'>; 214 | } 215 | declare module 'eslint-plugin-flowtype/dist/rules/defineFlowType.js' { 216 | declare module.exports: $Exports<'eslint-plugin-flowtype/dist/rules/defineFlowType'>; 217 | } 218 | declare module 'eslint-plugin-flowtype/dist/rules/delimiterDangle.js' { 219 | declare module.exports: $Exports<'eslint-plugin-flowtype/dist/rules/delimiterDangle'>; 220 | } 221 | declare module 'eslint-plugin-flowtype/dist/rules/genericSpacing.js' { 222 | declare module.exports: $Exports<'eslint-plugin-flowtype/dist/rules/genericSpacing'>; 223 | } 224 | declare module 'eslint-plugin-flowtype/dist/rules/noDupeKeys.js' { 225 | declare module.exports: $Exports<'eslint-plugin-flowtype/dist/rules/noDupeKeys'>; 226 | } 227 | declare module 'eslint-plugin-flowtype/dist/rules/noMutableArray.js' { 228 | declare module.exports: $Exports<'eslint-plugin-flowtype/dist/rules/noMutableArray'>; 229 | } 230 | declare module 'eslint-plugin-flowtype/dist/rules/noPrimitiveConstructorTypes.js' { 231 | declare module.exports: $Exports<'eslint-plugin-flowtype/dist/rules/noPrimitiveConstructorTypes'>; 232 | } 233 | declare module 'eslint-plugin-flowtype/dist/rules/noTypesMissingFileAnnotation.js' { 234 | declare module.exports: $Exports<'eslint-plugin-flowtype/dist/rules/noTypesMissingFileAnnotation'>; 235 | } 236 | declare module 'eslint-plugin-flowtype/dist/rules/noUnusedExpressions.js' { 237 | declare module.exports: $Exports<'eslint-plugin-flowtype/dist/rules/noUnusedExpressions'>; 238 | } 239 | declare module 'eslint-plugin-flowtype/dist/rules/noWeakTypes.js' { 240 | declare module.exports: $Exports<'eslint-plugin-flowtype/dist/rules/noWeakTypes'>; 241 | } 242 | declare module 'eslint-plugin-flowtype/dist/rules/objectTypeDelimiter.js' { 243 | declare module.exports: $Exports<'eslint-plugin-flowtype/dist/rules/objectTypeDelimiter'>; 244 | } 245 | declare module 'eslint-plugin-flowtype/dist/rules/requireParameterType.js' { 246 | declare module.exports: $Exports<'eslint-plugin-flowtype/dist/rules/requireParameterType'>; 247 | } 248 | declare module 'eslint-plugin-flowtype/dist/rules/requireReturnType.js' { 249 | declare module.exports: $Exports<'eslint-plugin-flowtype/dist/rules/requireReturnType'>; 250 | } 251 | declare module 'eslint-plugin-flowtype/dist/rules/requireValidFileAnnotation.js' { 252 | declare module.exports: $Exports<'eslint-plugin-flowtype/dist/rules/requireValidFileAnnotation'>; 253 | } 254 | declare module 'eslint-plugin-flowtype/dist/rules/requireVariableType.js' { 255 | declare module.exports: $Exports<'eslint-plugin-flowtype/dist/rules/requireVariableType'>; 256 | } 257 | declare module 'eslint-plugin-flowtype/dist/rules/semi.js' { 258 | declare module.exports: $Exports<'eslint-plugin-flowtype/dist/rules/semi'>; 259 | } 260 | declare module 'eslint-plugin-flowtype/dist/rules/sortKeys.js' { 261 | declare module.exports: $Exports<'eslint-plugin-flowtype/dist/rules/sortKeys'>; 262 | } 263 | declare module 'eslint-plugin-flowtype/dist/rules/spaceAfterTypeColon.js' { 264 | declare module.exports: $Exports<'eslint-plugin-flowtype/dist/rules/spaceAfterTypeColon'>; 265 | } 266 | declare module 'eslint-plugin-flowtype/dist/rules/spaceBeforeGenericBracket.js' { 267 | declare module.exports: $Exports<'eslint-plugin-flowtype/dist/rules/spaceBeforeGenericBracket'>; 268 | } 269 | declare module 'eslint-plugin-flowtype/dist/rules/spaceBeforeTypeColon.js' { 270 | declare module.exports: $Exports<'eslint-plugin-flowtype/dist/rules/spaceBeforeTypeColon'>; 271 | } 272 | declare module 'eslint-plugin-flowtype/dist/rules/typeColonSpacing/evaluateFunctions.js' { 273 | declare module.exports: $Exports<'eslint-plugin-flowtype/dist/rules/typeColonSpacing/evaluateFunctions'>; 274 | } 275 | declare module 'eslint-plugin-flowtype/dist/rules/typeColonSpacing/evaluateObjectTypeIndexer.js' { 276 | declare module.exports: $Exports<'eslint-plugin-flowtype/dist/rules/typeColonSpacing/evaluateObjectTypeIndexer'>; 277 | } 278 | declare module 'eslint-plugin-flowtype/dist/rules/typeColonSpacing/evaluateObjectTypeProperty.js' { 279 | declare module.exports: $Exports<'eslint-plugin-flowtype/dist/rules/typeColonSpacing/evaluateObjectTypeProperty'>; 280 | } 281 | declare module 'eslint-plugin-flowtype/dist/rules/typeColonSpacing/evaluateReturnType.js' { 282 | declare module.exports: $Exports<'eslint-plugin-flowtype/dist/rules/typeColonSpacing/evaluateReturnType'>; 283 | } 284 | declare module 'eslint-plugin-flowtype/dist/rules/typeColonSpacing/evaluateTypeCastExpression.js' { 285 | declare module.exports: $Exports<'eslint-plugin-flowtype/dist/rules/typeColonSpacing/evaluateTypeCastExpression'>; 286 | } 287 | declare module 'eslint-plugin-flowtype/dist/rules/typeColonSpacing/evaluateTypical.js' { 288 | declare module.exports: $Exports<'eslint-plugin-flowtype/dist/rules/typeColonSpacing/evaluateTypical'>; 289 | } 290 | declare module 'eslint-plugin-flowtype/dist/rules/typeColonSpacing/index.js' { 291 | declare module.exports: $Exports<'eslint-plugin-flowtype/dist/rules/typeColonSpacing/index'>; 292 | } 293 | declare module 'eslint-plugin-flowtype/dist/rules/typeColonSpacing/reporter.js' { 294 | declare module.exports: $Exports<'eslint-plugin-flowtype/dist/rules/typeColonSpacing/reporter'>; 295 | } 296 | declare module 'eslint-plugin-flowtype/dist/rules/typeIdMatch.js' { 297 | declare module.exports: $Exports<'eslint-plugin-flowtype/dist/rules/typeIdMatch'>; 298 | } 299 | declare module 'eslint-plugin-flowtype/dist/rules/unionIntersectionSpacing.js' { 300 | declare module.exports: $Exports<'eslint-plugin-flowtype/dist/rules/unionIntersectionSpacing'>; 301 | } 302 | declare module 'eslint-plugin-flowtype/dist/rules/useFlowType.js' { 303 | declare module.exports: $Exports<'eslint-plugin-flowtype/dist/rules/useFlowType'>; 304 | } 305 | declare module 'eslint-plugin-flowtype/dist/rules/validSyntax.js' { 306 | declare module.exports: $Exports<'eslint-plugin-flowtype/dist/rules/validSyntax'>; 307 | } 308 | declare module 'eslint-plugin-flowtype/dist/utilities/checkFlowFileAnnotation.js' { 309 | declare module.exports: $Exports<'eslint-plugin-flowtype/dist/utilities/checkFlowFileAnnotation'>; 310 | } 311 | declare module 'eslint-plugin-flowtype/dist/utilities/fuzzyStringMatch.js' { 312 | declare module.exports: $Exports<'eslint-plugin-flowtype/dist/utilities/fuzzyStringMatch'>; 313 | } 314 | declare module 'eslint-plugin-flowtype/dist/utilities/getParameterName.js' { 315 | declare module.exports: $Exports<'eslint-plugin-flowtype/dist/utilities/getParameterName'>; 316 | } 317 | declare module 'eslint-plugin-flowtype/dist/utilities/getTokenAfterParens.js' { 318 | declare module.exports: $Exports<'eslint-plugin-flowtype/dist/utilities/getTokenAfterParens'>; 319 | } 320 | declare module 'eslint-plugin-flowtype/dist/utilities/getTokenBeforeParens.js' { 321 | declare module.exports: $Exports<'eslint-plugin-flowtype/dist/utilities/getTokenBeforeParens'>; 322 | } 323 | declare module 'eslint-plugin-flowtype/dist/utilities/index.js' { 324 | declare module.exports: $Exports<'eslint-plugin-flowtype/dist/utilities/index'>; 325 | } 326 | declare module 'eslint-plugin-flowtype/dist/utilities/isFlowFile.js' { 327 | declare module.exports: $Exports<'eslint-plugin-flowtype/dist/utilities/isFlowFile'>; 328 | } 329 | declare module 'eslint-plugin-flowtype/dist/utilities/isFlowFileAnnotation.js' { 330 | declare module.exports: $Exports<'eslint-plugin-flowtype/dist/utilities/isFlowFileAnnotation'>; 331 | } 332 | declare module 'eslint-plugin-flowtype/dist/utilities/iterateFunctionNodes.js' { 333 | declare module.exports: $Exports<'eslint-plugin-flowtype/dist/utilities/iterateFunctionNodes'>; 334 | } 335 | declare module 'eslint-plugin-flowtype/dist/utilities/quoteName.js' { 336 | declare module.exports: $Exports<'eslint-plugin-flowtype/dist/utilities/quoteName'>; 337 | } 338 | declare module 'eslint-plugin-flowtype/dist/utilities/spacingFixers.js' { 339 | declare module.exports: $Exports<'eslint-plugin-flowtype/dist/utilities/spacingFixers'>; 340 | } 341 | -------------------------------------------------------------------------------- /flow-typed/npm/jest_v21.x.x.js: -------------------------------------------------------------------------------- 1 | // flow-typed signature: 65527f14a5f7e89fb28d0a29f45dc848 2 | // flow-typed version: c7c67b81c1/jest_v21.x.x/flow_>=v0.39.x 3 | 4 | type JestMockFn, TReturn> = { 5 | (...args: TArguments): TReturn, 6 | /** 7 | * An object for introspecting mock calls 8 | */ 9 | mock: { 10 | /** 11 | * An array that represents all calls that have been made into this mock 12 | * function. Each call is represented by an array of arguments that were 13 | * passed during the call. 14 | */ 15 | calls: Array, 16 | /** 17 | * An array that contains all the object instances that have been 18 | * instantiated from this mock function. 19 | */ 20 | instances: Array 21 | }, 22 | /** 23 | * Resets all information stored in the mockFn.mock.calls and 24 | * mockFn.mock.instances arrays. Often this is useful when you want to clean 25 | * up a mock's usage data between two assertions. 26 | */ 27 | mockClear(): void, 28 | /** 29 | * Resets all information stored in the mock. This is useful when you want to 30 | * completely restore a mock back to its initial state. 31 | */ 32 | mockReset(): void, 33 | /** 34 | * Removes the mock and restores the initial implementation. This is useful 35 | * when you want to mock functions in certain test cases and restore the 36 | * original implementation in others. Beware that mockFn.mockRestore only 37 | * works when mock was created with jest.spyOn. Thus you have to take care of 38 | * restoration yourself when manually assigning jest.fn(). 39 | */ 40 | mockRestore(): void, 41 | /** 42 | * Accepts a function that should be used as the implementation of the mock. 43 | * The mock itself will still record all calls that go into and instances 44 | * that come from itself -- the only difference is that the implementation 45 | * will also be executed when the mock is called. 46 | */ 47 | mockImplementation( 48 | fn: (...args: TArguments) => TReturn 49 | ): JestMockFn, 50 | /** 51 | * Accepts a function that will be used as an implementation of the mock for 52 | * one call to the mocked function. Can be chained so that multiple function 53 | * calls produce different results. 54 | */ 55 | mockImplementationOnce( 56 | fn: (...args: TArguments) => TReturn 57 | ): JestMockFn, 58 | /** 59 | * Just a simple sugar function for returning `this` 60 | */ 61 | mockReturnThis(): void, 62 | /** 63 | * Deprecated: use jest.fn(() => value) instead 64 | */ 65 | mockReturnValue(value: TReturn): JestMockFn, 66 | /** 67 | * Sugar for only returning a value once inside your mock 68 | */ 69 | mockReturnValueOnce(value: TReturn): JestMockFn 70 | }; 71 | 72 | type JestAsymmetricEqualityType = { 73 | /** 74 | * A custom Jasmine equality tester 75 | */ 76 | asymmetricMatch(value: mixed): boolean 77 | }; 78 | 79 | type JestCallsType = { 80 | allArgs(): mixed, 81 | all(): mixed, 82 | any(): boolean, 83 | count(): number, 84 | first(): mixed, 85 | mostRecent(): mixed, 86 | reset(): void 87 | }; 88 | 89 | type JestClockType = { 90 | install(): void, 91 | mockDate(date: Date): void, 92 | tick(milliseconds?: number): void, 93 | uninstall(): void 94 | }; 95 | 96 | type JestMatcherResult = { 97 | message?: string | (() => string), 98 | pass: boolean 99 | }; 100 | 101 | type JestMatcher = (actual: any, expected: any) => JestMatcherResult; 102 | 103 | type JestPromiseType = { 104 | /** 105 | * Use rejects to unwrap the reason of a rejected promise so any other 106 | * matcher can be chained. If the promise is fulfilled the assertion fails. 107 | */ 108 | rejects: JestExpectType, 109 | /** 110 | * Use resolves to unwrap the value of a fulfilled promise so any other 111 | * matcher can be chained. If the promise is rejected the assertion fails. 112 | */ 113 | resolves: JestExpectType 114 | }; 115 | 116 | /** 117 | * Plugin: jest-enzyme 118 | */ 119 | type EnzymeMatchersType = { 120 | toBeChecked(): void, 121 | toBeDisabled(): void, 122 | toBeEmpty(): void, 123 | toBePresent(): void, 124 | toContainReact(element: React$Element): void, 125 | toHaveClassName(className: string): void, 126 | toHaveHTML(html: string): void, 127 | toHaveProp(propKey: string, propValue?: any): void, 128 | toHaveRef(refName: string): void, 129 | toHaveState(stateKey: string, stateValue?: any): void, 130 | toHaveStyle(styleKey: string, styleValue?: any): void, 131 | toHaveTagName(tagName: string): void, 132 | toHaveText(text: string): void, 133 | toIncludeText(text: string): void, 134 | toHaveValue(value: any): void, 135 | toMatchElement(element: React$Element): void, 136 | toMatchSelector(selector: string): void 137 | }; 138 | 139 | type JestExpectType = { 140 | not: JestExpectType & EnzymeMatchersType, 141 | /** 142 | * If you have a mock function, you can use .lastCalledWith to test what 143 | * arguments it was last called with. 144 | */ 145 | lastCalledWith(...args: Array): void, 146 | /** 147 | * toBe just checks that a value is what you expect. It uses === to check 148 | * strict equality. 149 | */ 150 | toBe(value: any): void, 151 | /** 152 | * Use .toHaveBeenCalled to ensure that a mock function got called. 153 | */ 154 | toBeCalled(): void, 155 | /** 156 | * Use .toBeCalledWith to ensure that a mock function was called with 157 | * specific arguments. 158 | */ 159 | toBeCalledWith(...args: Array): void, 160 | /** 161 | * Using exact equality with floating point numbers is a bad idea. Rounding 162 | * means that intuitive things fail. 163 | */ 164 | toBeCloseTo(num: number, delta: any): void, 165 | /** 166 | * Use .toBeDefined to check that a variable is not undefined. 167 | */ 168 | toBeDefined(): void, 169 | /** 170 | * Use .toBeFalsy when you don't care what a value is, you just want to 171 | * ensure a value is false in a boolean context. 172 | */ 173 | toBeFalsy(): void, 174 | /** 175 | * To compare floating point numbers, you can use toBeGreaterThan. 176 | */ 177 | toBeGreaterThan(number: number): void, 178 | /** 179 | * To compare floating point numbers, you can use toBeGreaterThanOrEqual. 180 | */ 181 | toBeGreaterThanOrEqual(number: number): void, 182 | /** 183 | * To compare floating point numbers, you can use toBeLessThan. 184 | */ 185 | toBeLessThan(number: number): void, 186 | /** 187 | * To compare floating point numbers, you can use toBeLessThanOrEqual. 188 | */ 189 | toBeLessThanOrEqual(number: number): void, 190 | /** 191 | * Use .toBeInstanceOf(Class) to check that an object is an instance of a 192 | * class. 193 | */ 194 | toBeInstanceOf(cls: Class<*>): void, 195 | /** 196 | * .toBeNull() is the same as .toBe(null) but the error messages are a bit 197 | * nicer. 198 | */ 199 | toBeNull(): void, 200 | /** 201 | * Use .toBeTruthy when you don't care what a value is, you just want to 202 | * ensure a value is true in a boolean context. 203 | */ 204 | toBeTruthy(): void, 205 | /** 206 | * Use .toBeUndefined to check that a variable is undefined. 207 | */ 208 | toBeUndefined(): void, 209 | /** 210 | * Use .toContain when you want to check that an item is in a list. For 211 | * testing the items in the list, this uses ===, a strict equality check. 212 | */ 213 | toContain(item: any): void, 214 | /** 215 | * Use .toContainEqual when you want to check that an item is in a list. For 216 | * testing the items in the list, this matcher recursively checks the 217 | * equality of all fields, rather than checking for object identity. 218 | */ 219 | toContainEqual(item: any): void, 220 | /** 221 | * Use .toEqual when you want to check that two objects have the same value. 222 | * This matcher recursively checks the equality of all fields, rather than 223 | * checking for object identity. 224 | */ 225 | toEqual(value: any): void, 226 | /** 227 | * Use .toHaveBeenCalled to ensure that a mock function got called. 228 | */ 229 | toHaveBeenCalled(): void, 230 | /** 231 | * Use .toHaveBeenCalledTimes to ensure that a mock function got called exact 232 | * number of times. 233 | */ 234 | toHaveBeenCalledTimes(number: number): void, 235 | /** 236 | * Use .toHaveBeenCalledWith to ensure that a mock function was called with 237 | * specific arguments. 238 | */ 239 | toHaveBeenCalledWith(...args: Array): void, 240 | /** 241 | * Use .toHaveBeenLastCalledWith to ensure that a mock function was last called 242 | * with specific arguments. 243 | */ 244 | toHaveBeenLastCalledWith(...args: Array): void, 245 | /** 246 | * Check that an object has a .length property and it is set to a certain 247 | * numeric value. 248 | */ 249 | toHaveLength(number: number): void, 250 | /** 251 | * 252 | */ 253 | toHaveProperty(propPath: string, value?: any): void, 254 | /** 255 | * Use .toMatch to check that a string matches a regular expression or string. 256 | */ 257 | toMatch(regexpOrString: RegExp | string): void, 258 | /** 259 | * Use .toMatchObject to check that a javascript object matches a subset of the properties of an object. 260 | */ 261 | toMatchObject(object: Object): void, 262 | /** 263 | * This ensures that a React component matches the most recent snapshot. 264 | */ 265 | toMatchSnapshot(name?: string): void, 266 | /** 267 | * Use .toThrow to test that a function throws when it is called. 268 | * If you want to test that a specific error gets thrown, you can provide an 269 | * argument to toThrow. The argument can be a string for the error message, 270 | * a class for the error, or a regex that should match the error. 271 | * 272 | * Alias: .toThrowError 273 | */ 274 | toThrow(message?: string | Error | RegExp): void, 275 | toThrowError(message?: string | Error | RegExp): void, 276 | /** 277 | * Use .toThrowErrorMatchingSnapshot to test that a function throws a error 278 | * matching the most recent snapshot when it is called. 279 | */ 280 | toThrowErrorMatchingSnapshot(): void 281 | }; 282 | 283 | type JestObjectType = { 284 | /** 285 | * Disables automatic mocking in the module loader. 286 | * 287 | * After this method is called, all `require()`s will return the real 288 | * versions of each module (rather than a mocked version). 289 | */ 290 | disableAutomock(): JestObjectType, 291 | /** 292 | * An un-hoisted version of disableAutomock 293 | */ 294 | autoMockOff(): JestObjectType, 295 | /** 296 | * Enables automatic mocking in the module loader. 297 | */ 298 | enableAutomock(): JestObjectType, 299 | /** 300 | * An un-hoisted version of enableAutomock 301 | */ 302 | autoMockOn(): JestObjectType, 303 | /** 304 | * Clears the mock.calls and mock.instances properties of all mocks. 305 | * Equivalent to calling .mockClear() on every mocked function. 306 | */ 307 | clearAllMocks(): JestObjectType, 308 | /** 309 | * Resets the state of all mocks. Equivalent to calling .mockReset() on every 310 | * mocked function. 311 | */ 312 | resetAllMocks(): JestObjectType, 313 | /** 314 | * Removes any pending timers from the timer system. 315 | */ 316 | clearAllTimers(): void, 317 | /** 318 | * The same as `mock` but not moved to the top of the expectation by 319 | * babel-jest. 320 | */ 321 | doMock(moduleName: string, moduleFactory?: any): JestObjectType, 322 | /** 323 | * The same as `unmock` but not moved to the top of the expectation by 324 | * babel-jest. 325 | */ 326 | dontMock(moduleName: string): JestObjectType, 327 | /** 328 | * Returns a new, unused mock function. Optionally takes a mock 329 | * implementation. 330 | */ 331 | fn, TReturn>( 332 | implementation?: (...args: TArguments) => TReturn 333 | ): JestMockFn, 334 | /** 335 | * Determines if the given function is a mocked function. 336 | */ 337 | isMockFunction(fn: Function): boolean, 338 | /** 339 | * Given the name of a module, use the automatic mocking system to generate a 340 | * mocked version of the module for you. 341 | */ 342 | genMockFromModule(moduleName: string): any, 343 | /** 344 | * Mocks a module with an auto-mocked version when it is being required. 345 | * 346 | * The second argument can be used to specify an explicit module factory that 347 | * is being run instead of using Jest's automocking feature. 348 | * 349 | * The third argument can be used to create virtual mocks -- mocks of modules 350 | * that don't exist anywhere in the system. 351 | */ 352 | mock( 353 | moduleName: string, 354 | moduleFactory?: any, 355 | options?: Object 356 | ): JestObjectType, 357 | /** 358 | * Returns the actual module instead of a mock, bypassing all checks on 359 | * whether the module should receive a mock implementation or not. 360 | */ 361 | requireActual(moduleName: string): any, 362 | /** 363 | * Returns a mock module instead of the actual module, bypassing all checks 364 | * on whether the module should be required normally or not. 365 | */ 366 | requireMock(moduleName: string): any, 367 | /** 368 | * Resets the module registry - the cache of all required modules. This is 369 | * useful to isolate modules where local state might conflict between tests. 370 | */ 371 | resetModules(): JestObjectType, 372 | /** 373 | * Exhausts the micro-task queue (usually interfaced in node via 374 | * process.nextTick). 375 | */ 376 | runAllTicks(): void, 377 | /** 378 | * Exhausts the macro-task queue (i.e., all tasks queued by setTimeout(), 379 | * setInterval(), and setImmediate()). 380 | */ 381 | runAllTimers(): void, 382 | /** 383 | * Exhausts all tasks queued by setImmediate(). 384 | */ 385 | runAllImmediates(): void, 386 | /** 387 | * Executes only the macro task queue (i.e. all tasks queued by setTimeout() 388 | * or setInterval() and setImmediate()). 389 | */ 390 | runTimersToTime(msToRun: number): void, 391 | /** 392 | * Executes only the macro-tasks that are currently pending (i.e., only the 393 | * tasks that have been queued by setTimeout() or setInterval() up to this 394 | * point) 395 | */ 396 | runOnlyPendingTimers(): void, 397 | /** 398 | * Explicitly supplies the mock object that the module system should return 399 | * for the specified module. Note: It is recommended to use jest.mock() 400 | * instead. 401 | */ 402 | setMock(moduleName: string, moduleExports: any): JestObjectType, 403 | /** 404 | * Indicates that the module system should never return a mocked version of 405 | * the specified module from require() (e.g. that it should always return the 406 | * real module). 407 | */ 408 | unmock(moduleName: string): JestObjectType, 409 | /** 410 | * Instructs Jest to use fake versions of the standard timer functions 411 | * (setTimeout, setInterval, clearTimeout, clearInterval, nextTick, 412 | * setImmediate and clearImmediate). 413 | */ 414 | useFakeTimers(): JestObjectType, 415 | /** 416 | * Instructs Jest to use the real versions of the standard timer functions. 417 | */ 418 | useRealTimers(): JestObjectType, 419 | /** 420 | * Creates a mock function similar to jest.fn but also tracks calls to 421 | * object[methodName]. 422 | */ 423 | spyOn(object: Object, methodName: string): JestMockFn 424 | }; 425 | 426 | type JestSpyType = { 427 | calls: JestCallsType 428 | }; 429 | 430 | /** Runs this function after every test inside this context */ 431 | declare function afterEach( 432 | fn: (done: () => void) => ?Promise, 433 | timeout?: number 434 | ): void; 435 | /** Runs this function before every test inside this context */ 436 | declare function beforeEach( 437 | fn: (done: () => void) => ?Promise, 438 | timeout?: number 439 | ): void; 440 | /** Runs this function after all tests have finished inside this context */ 441 | declare function afterAll( 442 | fn: (done: () => void) => ?Promise, 443 | timeout?: number 444 | ): void; 445 | /** Runs this function before any tests have started inside this context */ 446 | declare function beforeAll( 447 | fn: (done: () => void) => ?Promise, 448 | timeout?: number 449 | ): void; 450 | 451 | /** A context for grouping tests together */ 452 | declare var describe: { 453 | /** 454 | * Creates a block that groups together several related tests in one "test suite" 455 | */ 456 | (name: string, fn: () => void): void, 457 | 458 | /** 459 | * Only run this describe block 460 | */ 461 | only(name: string, fn: () => void): void, 462 | 463 | /** 464 | * Skip running this describe block 465 | */ 466 | skip(name: string, fn: () => void): void 467 | }; 468 | 469 | /** An individual test unit */ 470 | declare var it: { 471 | /** 472 | * An individual test unit 473 | * 474 | * @param {string} Name of Test 475 | * @param {Function} Test 476 | * @param {number} Timeout for the test, in milliseconds. 477 | */ 478 | ( 479 | name: string, 480 | fn?: (done: () => void) => ?Promise, 481 | timeout?: number 482 | ): void, 483 | /** 484 | * Only run this test 485 | * 486 | * @param {string} Name of Test 487 | * @param {Function} Test 488 | * @param {number} Timeout for the test, in milliseconds. 489 | */ 490 | only( 491 | name: string, 492 | fn?: (done: () => void) => ?Promise, 493 | timeout?: number 494 | ): void, 495 | /** 496 | * Skip running this test 497 | * 498 | * @param {string} Name of Test 499 | * @param {Function} Test 500 | * @param {number} Timeout for the test, in milliseconds. 501 | */ 502 | skip( 503 | name: string, 504 | fn?: (done: () => void) => ?Promise, 505 | timeout?: number 506 | ): void, 507 | /** 508 | * Run the test concurrently 509 | * 510 | * @param {string} Name of Test 511 | * @param {Function} Test 512 | * @param {number} Timeout for the test, in milliseconds. 513 | */ 514 | concurrent( 515 | name: string, 516 | fn?: (done: () => void) => ?Promise, 517 | timeout?: number 518 | ): void 519 | }; 520 | declare function fit( 521 | name: string, 522 | fn: (done: () => void) => ?Promise, 523 | timeout?: number 524 | ): void; 525 | /** An individual test unit */ 526 | declare var test: typeof it; 527 | /** A disabled group of tests */ 528 | declare var xdescribe: typeof describe; 529 | /** A focused group of tests */ 530 | declare var fdescribe: typeof describe; 531 | /** A disabled individual test */ 532 | declare var xit: typeof it; 533 | /** A disabled individual test */ 534 | declare var xtest: typeof it; 535 | 536 | /** The expect function is used every time you want to test a value */ 537 | declare var expect: { 538 | /** The object that you want to make assertions against */ 539 | (value: any): JestExpectType & JestPromiseType & EnzymeMatchersType, 540 | /** Add additional Jasmine matchers to Jest's roster */ 541 | extend(matchers: { [name: string]: JestMatcher }): void, 542 | /** Add a module that formats application-specific data structures. */ 543 | addSnapshotSerializer(serializer: (input: Object) => string): void, 544 | assertions(expectedAssertions: number): void, 545 | hasAssertions(): void, 546 | any(value: mixed): JestAsymmetricEqualityType, 547 | anything(): void, 548 | arrayContaining(value: Array): void, 549 | objectContaining(value: Object): void, 550 | /** Matches any received string that contains the exact expected string. */ 551 | stringContaining(value: string): void, 552 | stringMatching(value: string | RegExp): void 553 | }; 554 | 555 | // TODO handle return type 556 | // http://jasmine.github.io/2.4/introduction.html#section-Spies 557 | declare function spyOn(value: mixed, method: string): Object; 558 | 559 | /** Holds all functions related to manipulating test runner */ 560 | declare var jest: JestObjectType; 561 | 562 | /** 563 | * The global Jasmine object, this is generally not exposed as the public API, 564 | * using features inside here could break in later versions of Jest. 565 | */ 566 | declare var jasmine: { 567 | DEFAULT_TIMEOUT_INTERVAL: number, 568 | any(value: mixed): JestAsymmetricEqualityType, 569 | anything(): void, 570 | arrayContaining(value: Array): void, 571 | clock(): JestClockType, 572 | createSpy(name: string): JestSpyType, 573 | createSpyObj( 574 | baseName: string, 575 | methodNames: Array 576 | ): { [methodName: string]: JestSpyType }, 577 | objectContaining(value: Object): void, 578 | stringMatching(value: string): void 579 | }; 580 | -------------------------------------------------------------------------------- /flow-typed/npm/eslint-plugin-react_vx.x.x.js: -------------------------------------------------------------------------------- 1 | // flow-typed signature: ec70abf082965b66acb065d0948786fb 2 | // flow-typed version: <>/eslint-plugin-react_v^7.4.0/flow_v0.58.0 3 | 4 | /** 5 | * This is an autogenerated libdef stub for: 6 | * 7 | * 'eslint-plugin-react' 8 | * 9 | * Fill this stub out by replacing all the `any` types. 10 | * 11 | * Once filled out, we encourage you to share your work with the 12 | * community by sending a pull request to: 13 | * https://github.com/flowtype/flow-typed 14 | */ 15 | 16 | declare module 'eslint-plugin-react' { 17 | declare module.exports: any; 18 | } 19 | 20 | /** 21 | * We include stubs for each file inside this npm package in case you need to 22 | * require those files directly. Feel free to delete any files that aren't 23 | * needed. 24 | */ 25 | declare module 'eslint-plugin-react/lib/rules/boolean-prop-naming' { 26 | declare module.exports: any; 27 | } 28 | 29 | declare module 'eslint-plugin-react/lib/rules/default-props-match-prop-types' { 30 | declare module.exports: any; 31 | } 32 | 33 | declare module 'eslint-plugin-react/lib/rules/display-name' { 34 | declare module.exports: any; 35 | } 36 | 37 | declare module 'eslint-plugin-react/lib/rules/forbid-component-props' { 38 | declare module.exports: any; 39 | } 40 | 41 | declare module 'eslint-plugin-react/lib/rules/forbid-elements' { 42 | declare module.exports: any; 43 | } 44 | 45 | declare module 'eslint-plugin-react/lib/rules/forbid-foreign-prop-types' { 46 | declare module.exports: any; 47 | } 48 | 49 | declare module 'eslint-plugin-react/lib/rules/forbid-prop-types' { 50 | declare module.exports: any; 51 | } 52 | 53 | declare module 'eslint-plugin-react/lib/rules/jsx-boolean-value' { 54 | declare module.exports: any; 55 | } 56 | 57 | declare module 'eslint-plugin-react/lib/rules/jsx-closing-bracket-location' { 58 | declare module.exports: any; 59 | } 60 | 61 | declare module 'eslint-plugin-react/lib/rules/jsx-closing-tag-location' { 62 | declare module.exports: any; 63 | } 64 | 65 | declare module 'eslint-plugin-react/lib/rules/jsx-curly-brace-presence' { 66 | declare module.exports: any; 67 | } 68 | 69 | declare module 'eslint-plugin-react/lib/rules/jsx-curly-spacing' { 70 | declare module.exports: any; 71 | } 72 | 73 | declare module 'eslint-plugin-react/lib/rules/jsx-equals-spacing' { 74 | declare module.exports: any; 75 | } 76 | 77 | declare module 'eslint-plugin-react/lib/rules/jsx-filename-extension' { 78 | declare module.exports: any; 79 | } 80 | 81 | declare module 'eslint-plugin-react/lib/rules/jsx-first-prop-new-line' { 82 | declare module.exports: any; 83 | } 84 | 85 | declare module 'eslint-plugin-react/lib/rules/jsx-handler-names' { 86 | declare module.exports: any; 87 | } 88 | 89 | declare module 'eslint-plugin-react/lib/rules/jsx-indent-props' { 90 | declare module.exports: any; 91 | } 92 | 93 | declare module 'eslint-plugin-react/lib/rules/jsx-indent' { 94 | declare module.exports: any; 95 | } 96 | 97 | declare module 'eslint-plugin-react/lib/rules/jsx-key' { 98 | declare module.exports: any; 99 | } 100 | 101 | declare module 'eslint-plugin-react/lib/rules/jsx-max-props-per-line' { 102 | declare module.exports: any; 103 | } 104 | 105 | declare module 'eslint-plugin-react/lib/rules/jsx-no-bind' { 106 | declare module.exports: any; 107 | } 108 | 109 | declare module 'eslint-plugin-react/lib/rules/jsx-no-comment-textnodes' { 110 | declare module.exports: any; 111 | } 112 | 113 | declare module 'eslint-plugin-react/lib/rules/jsx-no-duplicate-props' { 114 | declare module.exports: any; 115 | } 116 | 117 | declare module 'eslint-plugin-react/lib/rules/jsx-no-literals' { 118 | declare module.exports: any; 119 | } 120 | 121 | declare module 'eslint-plugin-react/lib/rules/jsx-no-target-blank' { 122 | declare module.exports: any; 123 | } 124 | 125 | declare module 'eslint-plugin-react/lib/rules/jsx-no-undef' { 126 | declare module.exports: any; 127 | } 128 | 129 | declare module 'eslint-plugin-react/lib/rules/jsx-pascal-case' { 130 | declare module.exports: any; 131 | } 132 | 133 | declare module 'eslint-plugin-react/lib/rules/jsx-sort-props' { 134 | declare module.exports: any; 135 | } 136 | 137 | declare module 'eslint-plugin-react/lib/rules/jsx-space-before-closing' { 138 | declare module.exports: any; 139 | } 140 | 141 | declare module 'eslint-plugin-react/lib/rules/jsx-tag-spacing' { 142 | declare module.exports: any; 143 | } 144 | 145 | declare module 'eslint-plugin-react/lib/rules/jsx-uses-react' { 146 | declare module.exports: any; 147 | } 148 | 149 | declare module 'eslint-plugin-react/lib/rules/jsx-uses-vars' { 150 | declare module.exports: any; 151 | } 152 | 153 | declare module 'eslint-plugin-react/lib/rules/jsx-wrap-multilines' { 154 | declare module.exports: any; 155 | } 156 | 157 | declare module 'eslint-plugin-react/lib/rules/no-array-index-key' { 158 | declare module.exports: any; 159 | } 160 | 161 | declare module 'eslint-plugin-react/lib/rules/no-children-prop' { 162 | declare module.exports: any; 163 | } 164 | 165 | declare module 'eslint-plugin-react/lib/rules/no-danger-with-children' { 166 | declare module.exports: any; 167 | } 168 | 169 | declare module 'eslint-plugin-react/lib/rules/no-danger' { 170 | declare module.exports: any; 171 | } 172 | 173 | declare module 'eslint-plugin-react/lib/rules/no-deprecated' { 174 | declare module.exports: any; 175 | } 176 | 177 | declare module 'eslint-plugin-react/lib/rules/no-did-mount-set-state' { 178 | declare module.exports: any; 179 | } 180 | 181 | declare module 'eslint-plugin-react/lib/rules/no-did-update-set-state' { 182 | declare module.exports: any; 183 | } 184 | 185 | declare module 'eslint-plugin-react/lib/rules/no-direct-mutation-state' { 186 | declare module.exports: any; 187 | } 188 | 189 | declare module 'eslint-plugin-react/lib/rules/no-find-dom-node' { 190 | declare module.exports: any; 191 | } 192 | 193 | declare module 'eslint-plugin-react/lib/rules/no-is-mounted' { 194 | declare module.exports: any; 195 | } 196 | 197 | declare module 'eslint-plugin-react/lib/rules/no-multi-comp' { 198 | declare module.exports: any; 199 | } 200 | 201 | declare module 'eslint-plugin-react/lib/rules/no-redundant-should-component-update' { 202 | declare module.exports: any; 203 | } 204 | 205 | declare module 'eslint-plugin-react/lib/rules/no-render-return-value' { 206 | declare module.exports: any; 207 | } 208 | 209 | declare module 'eslint-plugin-react/lib/rules/no-set-state' { 210 | declare module.exports: any; 211 | } 212 | 213 | declare module 'eslint-plugin-react/lib/rules/no-string-refs' { 214 | declare module.exports: any; 215 | } 216 | 217 | declare module 'eslint-plugin-react/lib/rules/no-typos' { 218 | declare module.exports: any; 219 | } 220 | 221 | declare module 'eslint-plugin-react/lib/rules/no-unescaped-entities' { 222 | declare module.exports: any; 223 | } 224 | 225 | declare module 'eslint-plugin-react/lib/rules/no-unknown-property' { 226 | declare module.exports: any; 227 | } 228 | 229 | declare module 'eslint-plugin-react/lib/rules/no-unused-prop-types' { 230 | declare module.exports: any; 231 | } 232 | 233 | declare module 'eslint-plugin-react/lib/rules/no-unused-state' { 234 | declare module.exports: any; 235 | } 236 | 237 | declare module 'eslint-plugin-react/lib/rules/no-will-update-set-state' { 238 | declare module.exports: any; 239 | } 240 | 241 | declare module 'eslint-plugin-react/lib/rules/prefer-es6-class' { 242 | declare module.exports: any; 243 | } 244 | 245 | declare module 'eslint-plugin-react/lib/rules/prefer-stateless-function' { 246 | declare module.exports: any; 247 | } 248 | 249 | declare module 'eslint-plugin-react/lib/rules/prop-types' { 250 | declare module.exports: any; 251 | } 252 | 253 | declare module 'eslint-plugin-react/lib/rules/react-in-jsx-scope' { 254 | declare module.exports: any; 255 | } 256 | 257 | declare module 'eslint-plugin-react/lib/rules/require-default-props' { 258 | declare module.exports: any; 259 | } 260 | 261 | declare module 'eslint-plugin-react/lib/rules/require-optimization' { 262 | declare module.exports: any; 263 | } 264 | 265 | declare module 'eslint-plugin-react/lib/rules/require-render-return' { 266 | declare module.exports: any; 267 | } 268 | 269 | declare module 'eslint-plugin-react/lib/rules/self-closing-comp' { 270 | declare module.exports: any; 271 | } 272 | 273 | declare module 'eslint-plugin-react/lib/rules/sort-comp' { 274 | declare module.exports: any; 275 | } 276 | 277 | declare module 'eslint-plugin-react/lib/rules/sort-prop-types' { 278 | declare module.exports: any; 279 | } 280 | 281 | declare module 'eslint-plugin-react/lib/rules/style-prop-object' { 282 | declare module.exports: any; 283 | } 284 | 285 | declare module 'eslint-plugin-react/lib/rules/void-dom-elements-no-children' { 286 | declare module.exports: any; 287 | } 288 | 289 | declare module 'eslint-plugin-react/lib/util/annotations' { 290 | declare module.exports: any; 291 | } 292 | 293 | declare module 'eslint-plugin-react/lib/util/Components' { 294 | declare module.exports: any; 295 | } 296 | 297 | declare module 'eslint-plugin-react/lib/util/getTokenBeforeClosingBracket' { 298 | declare module.exports: any; 299 | } 300 | 301 | declare module 'eslint-plugin-react/lib/util/makeNoMethodSetStateRule' { 302 | declare module.exports: any; 303 | } 304 | 305 | declare module 'eslint-plugin-react/lib/util/pragma' { 306 | declare module.exports: any; 307 | } 308 | 309 | declare module 'eslint-plugin-react/lib/util/variable' { 310 | declare module.exports: any; 311 | } 312 | 313 | declare module 'eslint-plugin-react/lib/util/version' { 314 | declare module.exports: any; 315 | } 316 | 317 | // Filename aliases 318 | declare module 'eslint-plugin-react/index' { 319 | declare module.exports: $Exports<'eslint-plugin-react'>; 320 | } 321 | declare module 'eslint-plugin-react/index.js' { 322 | declare module.exports: $Exports<'eslint-plugin-react'>; 323 | } 324 | declare module 'eslint-plugin-react/lib/rules/boolean-prop-naming.js' { 325 | declare module.exports: $Exports<'eslint-plugin-react/lib/rules/boolean-prop-naming'>; 326 | } 327 | declare module 'eslint-plugin-react/lib/rules/default-props-match-prop-types.js' { 328 | declare module.exports: $Exports<'eslint-plugin-react/lib/rules/default-props-match-prop-types'>; 329 | } 330 | declare module 'eslint-plugin-react/lib/rules/display-name.js' { 331 | declare module.exports: $Exports<'eslint-plugin-react/lib/rules/display-name'>; 332 | } 333 | declare module 'eslint-plugin-react/lib/rules/forbid-component-props.js' { 334 | declare module.exports: $Exports<'eslint-plugin-react/lib/rules/forbid-component-props'>; 335 | } 336 | declare module 'eslint-plugin-react/lib/rules/forbid-elements.js' { 337 | declare module.exports: $Exports<'eslint-plugin-react/lib/rules/forbid-elements'>; 338 | } 339 | declare module 'eslint-plugin-react/lib/rules/forbid-foreign-prop-types.js' { 340 | declare module.exports: $Exports<'eslint-plugin-react/lib/rules/forbid-foreign-prop-types'>; 341 | } 342 | declare module 'eslint-plugin-react/lib/rules/forbid-prop-types.js' { 343 | declare module.exports: $Exports<'eslint-plugin-react/lib/rules/forbid-prop-types'>; 344 | } 345 | declare module 'eslint-plugin-react/lib/rules/jsx-boolean-value.js' { 346 | declare module.exports: $Exports<'eslint-plugin-react/lib/rules/jsx-boolean-value'>; 347 | } 348 | declare module 'eslint-plugin-react/lib/rules/jsx-closing-bracket-location.js' { 349 | declare module.exports: $Exports<'eslint-plugin-react/lib/rules/jsx-closing-bracket-location'>; 350 | } 351 | declare module 'eslint-plugin-react/lib/rules/jsx-closing-tag-location.js' { 352 | declare module.exports: $Exports<'eslint-plugin-react/lib/rules/jsx-closing-tag-location'>; 353 | } 354 | declare module 'eslint-plugin-react/lib/rules/jsx-curly-brace-presence.js' { 355 | declare module.exports: $Exports<'eslint-plugin-react/lib/rules/jsx-curly-brace-presence'>; 356 | } 357 | declare module 'eslint-plugin-react/lib/rules/jsx-curly-spacing.js' { 358 | declare module.exports: $Exports<'eslint-plugin-react/lib/rules/jsx-curly-spacing'>; 359 | } 360 | declare module 'eslint-plugin-react/lib/rules/jsx-equals-spacing.js' { 361 | declare module.exports: $Exports<'eslint-plugin-react/lib/rules/jsx-equals-spacing'>; 362 | } 363 | declare module 'eslint-plugin-react/lib/rules/jsx-filename-extension.js' { 364 | declare module.exports: $Exports<'eslint-plugin-react/lib/rules/jsx-filename-extension'>; 365 | } 366 | declare module 'eslint-plugin-react/lib/rules/jsx-first-prop-new-line.js' { 367 | declare module.exports: $Exports<'eslint-plugin-react/lib/rules/jsx-first-prop-new-line'>; 368 | } 369 | declare module 'eslint-plugin-react/lib/rules/jsx-handler-names.js' { 370 | declare module.exports: $Exports<'eslint-plugin-react/lib/rules/jsx-handler-names'>; 371 | } 372 | declare module 'eslint-plugin-react/lib/rules/jsx-indent-props.js' { 373 | declare module.exports: $Exports<'eslint-plugin-react/lib/rules/jsx-indent-props'>; 374 | } 375 | declare module 'eslint-plugin-react/lib/rules/jsx-indent.js' { 376 | declare module.exports: $Exports<'eslint-plugin-react/lib/rules/jsx-indent'>; 377 | } 378 | declare module 'eslint-plugin-react/lib/rules/jsx-key.js' { 379 | declare module.exports: $Exports<'eslint-plugin-react/lib/rules/jsx-key'>; 380 | } 381 | declare module 'eslint-plugin-react/lib/rules/jsx-max-props-per-line.js' { 382 | declare module.exports: $Exports<'eslint-plugin-react/lib/rules/jsx-max-props-per-line'>; 383 | } 384 | declare module 'eslint-plugin-react/lib/rules/jsx-no-bind.js' { 385 | declare module.exports: $Exports<'eslint-plugin-react/lib/rules/jsx-no-bind'>; 386 | } 387 | declare module 'eslint-plugin-react/lib/rules/jsx-no-comment-textnodes.js' { 388 | declare module.exports: $Exports<'eslint-plugin-react/lib/rules/jsx-no-comment-textnodes'>; 389 | } 390 | declare module 'eslint-plugin-react/lib/rules/jsx-no-duplicate-props.js' { 391 | declare module.exports: $Exports<'eslint-plugin-react/lib/rules/jsx-no-duplicate-props'>; 392 | } 393 | declare module 'eslint-plugin-react/lib/rules/jsx-no-literals.js' { 394 | declare module.exports: $Exports<'eslint-plugin-react/lib/rules/jsx-no-literals'>; 395 | } 396 | declare module 'eslint-plugin-react/lib/rules/jsx-no-target-blank.js' { 397 | declare module.exports: $Exports<'eslint-plugin-react/lib/rules/jsx-no-target-blank'>; 398 | } 399 | declare module 'eslint-plugin-react/lib/rules/jsx-no-undef.js' { 400 | declare module.exports: $Exports<'eslint-plugin-react/lib/rules/jsx-no-undef'>; 401 | } 402 | declare module 'eslint-plugin-react/lib/rules/jsx-pascal-case.js' { 403 | declare module.exports: $Exports<'eslint-plugin-react/lib/rules/jsx-pascal-case'>; 404 | } 405 | declare module 'eslint-plugin-react/lib/rules/jsx-sort-props.js' { 406 | declare module.exports: $Exports<'eslint-plugin-react/lib/rules/jsx-sort-props'>; 407 | } 408 | declare module 'eslint-plugin-react/lib/rules/jsx-space-before-closing.js' { 409 | declare module.exports: $Exports<'eslint-plugin-react/lib/rules/jsx-space-before-closing'>; 410 | } 411 | declare module 'eslint-plugin-react/lib/rules/jsx-tag-spacing.js' { 412 | declare module.exports: $Exports<'eslint-plugin-react/lib/rules/jsx-tag-spacing'>; 413 | } 414 | declare module 'eslint-plugin-react/lib/rules/jsx-uses-react.js' { 415 | declare module.exports: $Exports<'eslint-plugin-react/lib/rules/jsx-uses-react'>; 416 | } 417 | declare module 'eslint-plugin-react/lib/rules/jsx-uses-vars.js' { 418 | declare module.exports: $Exports<'eslint-plugin-react/lib/rules/jsx-uses-vars'>; 419 | } 420 | declare module 'eslint-plugin-react/lib/rules/jsx-wrap-multilines.js' { 421 | declare module.exports: $Exports<'eslint-plugin-react/lib/rules/jsx-wrap-multilines'>; 422 | } 423 | declare module 'eslint-plugin-react/lib/rules/no-array-index-key.js' { 424 | declare module.exports: $Exports<'eslint-plugin-react/lib/rules/no-array-index-key'>; 425 | } 426 | declare module 'eslint-plugin-react/lib/rules/no-children-prop.js' { 427 | declare module.exports: $Exports<'eslint-plugin-react/lib/rules/no-children-prop'>; 428 | } 429 | declare module 'eslint-plugin-react/lib/rules/no-danger-with-children.js' { 430 | declare module.exports: $Exports<'eslint-plugin-react/lib/rules/no-danger-with-children'>; 431 | } 432 | declare module 'eslint-plugin-react/lib/rules/no-danger.js' { 433 | declare module.exports: $Exports<'eslint-plugin-react/lib/rules/no-danger'>; 434 | } 435 | declare module 'eslint-plugin-react/lib/rules/no-deprecated.js' { 436 | declare module.exports: $Exports<'eslint-plugin-react/lib/rules/no-deprecated'>; 437 | } 438 | declare module 'eslint-plugin-react/lib/rules/no-did-mount-set-state.js' { 439 | declare module.exports: $Exports<'eslint-plugin-react/lib/rules/no-did-mount-set-state'>; 440 | } 441 | declare module 'eslint-plugin-react/lib/rules/no-did-update-set-state.js' { 442 | declare module.exports: $Exports<'eslint-plugin-react/lib/rules/no-did-update-set-state'>; 443 | } 444 | declare module 'eslint-plugin-react/lib/rules/no-direct-mutation-state.js' { 445 | declare module.exports: $Exports<'eslint-plugin-react/lib/rules/no-direct-mutation-state'>; 446 | } 447 | declare module 'eslint-plugin-react/lib/rules/no-find-dom-node.js' { 448 | declare module.exports: $Exports<'eslint-plugin-react/lib/rules/no-find-dom-node'>; 449 | } 450 | declare module 'eslint-plugin-react/lib/rules/no-is-mounted.js' { 451 | declare module.exports: $Exports<'eslint-plugin-react/lib/rules/no-is-mounted'>; 452 | } 453 | declare module 'eslint-plugin-react/lib/rules/no-multi-comp.js' { 454 | declare module.exports: $Exports<'eslint-plugin-react/lib/rules/no-multi-comp'>; 455 | } 456 | declare module 'eslint-plugin-react/lib/rules/no-redundant-should-component-update.js' { 457 | declare module.exports: $Exports<'eslint-plugin-react/lib/rules/no-redundant-should-component-update'>; 458 | } 459 | declare module 'eslint-plugin-react/lib/rules/no-render-return-value.js' { 460 | declare module.exports: $Exports<'eslint-plugin-react/lib/rules/no-render-return-value'>; 461 | } 462 | declare module 'eslint-plugin-react/lib/rules/no-set-state.js' { 463 | declare module.exports: $Exports<'eslint-plugin-react/lib/rules/no-set-state'>; 464 | } 465 | declare module 'eslint-plugin-react/lib/rules/no-string-refs.js' { 466 | declare module.exports: $Exports<'eslint-plugin-react/lib/rules/no-string-refs'>; 467 | } 468 | declare module 'eslint-plugin-react/lib/rules/no-typos.js' { 469 | declare module.exports: $Exports<'eslint-plugin-react/lib/rules/no-typos'>; 470 | } 471 | declare module 'eslint-plugin-react/lib/rules/no-unescaped-entities.js' { 472 | declare module.exports: $Exports<'eslint-plugin-react/lib/rules/no-unescaped-entities'>; 473 | } 474 | declare module 'eslint-plugin-react/lib/rules/no-unknown-property.js' { 475 | declare module.exports: $Exports<'eslint-plugin-react/lib/rules/no-unknown-property'>; 476 | } 477 | declare module 'eslint-plugin-react/lib/rules/no-unused-prop-types.js' { 478 | declare module.exports: $Exports<'eslint-plugin-react/lib/rules/no-unused-prop-types'>; 479 | } 480 | declare module 'eslint-plugin-react/lib/rules/no-unused-state.js' { 481 | declare module.exports: $Exports<'eslint-plugin-react/lib/rules/no-unused-state'>; 482 | } 483 | declare module 'eslint-plugin-react/lib/rules/no-will-update-set-state.js' { 484 | declare module.exports: $Exports<'eslint-plugin-react/lib/rules/no-will-update-set-state'>; 485 | } 486 | declare module 'eslint-plugin-react/lib/rules/prefer-es6-class.js' { 487 | declare module.exports: $Exports<'eslint-plugin-react/lib/rules/prefer-es6-class'>; 488 | } 489 | declare module 'eslint-plugin-react/lib/rules/prefer-stateless-function.js' { 490 | declare module.exports: $Exports<'eslint-plugin-react/lib/rules/prefer-stateless-function'>; 491 | } 492 | declare module 'eslint-plugin-react/lib/rules/prop-types.js' { 493 | declare module.exports: $Exports<'eslint-plugin-react/lib/rules/prop-types'>; 494 | } 495 | declare module 'eslint-plugin-react/lib/rules/react-in-jsx-scope.js' { 496 | declare module.exports: $Exports<'eslint-plugin-react/lib/rules/react-in-jsx-scope'>; 497 | } 498 | declare module 'eslint-plugin-react/lib/rules/require-default-props.js' { 499 | declare module.exports: $Exports<'eslint-plugin-react/lib/rules/require-default-props'>; 500 | } 501 | declare module 'eslint-plugin-react/lib/rules/require-optimization.js' { 502 | declare module.exports: $Exports<'eslint-plugin-react/lib/rules/require-optimization'>; 503 | } 504 | declare module 'eslint-plugin-react/lib/rules/require-render-return.js' { 505 | declare module.exports: $Exports<'eslint-plugin-react/lib/rules/require-render-return'>; 506 | } 507 | declare module 'eslint-plugin-react/lib/rules/self-closing-comp.js' { 508 | declare module.exports: $Exports<'eslint-plugin-react/lib/rules/self-closing-comp'>; 509 | } 510 | declare module 'eslint-plugin-react/lib/rules/sort-comp.js' { 511 | declare module.exports: $Exports<'eslint-plugin-react/lib/rules/sort-comp'>; 512 | } 513 | declare module 'eslint-plugin-react/lib/rules/sort-prop-types.js' { 514 | declare module.exports: $Exports<'eslint-plugin-react/lib/rules/sort-prop-types'>; 515 | } 516 | declare module 'eslint-plugin-react/lib/rules/style-prop-object.js' { 517 | declare module.exports: $Exports<'eslint-plugin-react/lib/rules/style-prop-object'>; 518 | } 519 | declare module 'eslint-plugin-react/lib/rules/void-dom-elements-no-children.js' { 520 | declare module.exports: $Exports<'eslint-plugin-react/lib/rules/void-dom-elements-no-children'>; 521 | } 522 | declare module 'eslint-plugin-react/lib/util/annotations.js' { 523 | declare module.exports: $Exports<'eslint-plugin-react/lib/util/annotations'>; 524 | } 525 | declare module 'eslint-plugin-react/lib/util/Components.js' { 526 | declare module.exports: $Exports<'eslint-plugin-react/lib/util/Components'>; 527 | } 528 | declare module 'eslint-plugin-react/lib/util/getTokenBeforeClosingBracket.js' { 529 | declare module.exports: $Exports<'eslint-plugin-react/lib/util/getTokenBeforeClosingBracket'>; 530 | } 531 | declare module 'eslint-plugin-react/lib/util/makeNoMethodSetStateRule.js' { 532 | declare module.exports: $Exports<'eslint-plugin-react/lib/util/makeNoMethodSetStateRule'>; 533 | } 534 | declare module 'eslint-plugin-react/lib/util/pragma.js' { 535 | declare module.exports: $Exports<'eslint-plugin-react/lib/util/pragma'>; 536 | } 537 | declare module 'eslint-plugin-react/lib/util/variable.js' { 538 | declare module.exports: $Exports<'eslint-plugin-react/lib/util/variable'>; 539 | } 540 | declare module 'eslint-plugin-react/lib/util/version.js' { 541 | declare module.exports: $Exports<'eslint-plugin-react/lib/util/version'>; 542 | } 543 | -------------------------------------------------------------------------------- /flow-typed/npm/ramda_v0.x.x.js: -------------------------------------------------------------------------------- 1 | // flow-typed signature: 5d481558cc234f09af44ab9616b7ec13 2 | // flow-typed version: 0bdbd3d3e8/ramda_v0.x.x/flow_>=v0.39.x 3 | 4 | /* eslint-disable no-unused-vars, no-redeclare */ 5 | 6 | type Transformer = { 7 | "@@transducer/step": (r: A, a: *) => R, 8 | "@@transducer/init": () => A, 9 | "@@transducer/result": (result: *) => B 10 | }; 11 | 12 | declare type $npm$ramda$Placeholder = { "@@functional/placeholder": true }; 13 | 14 | declare module ramda { 15 | declare type UnaryFn = (a: A) => R; 16 | declare type BinaryFn = ((a: A, b: B) => R) & 17 | ((a: A) => (b: B) => R); 18 | declare type UnarySameTypeFn = UnaryFn; 19 | declare type BinarySameTypeFn = BinaryFn; 20 | declare type NestedObject = { [k: string]: T | NestedObject }; 21 | declare type UnaryPredicateFn = (x: T) => boolean; 22 | declare type BinaryPredicateFn = (x: T, y: T) => boolean; 23 | declare type BinaryPredicateFn2 = (x: T, y: S) => boolean; 24 | 25 | declare interface ObjPredicate { 26 | (value: any, key: string): boolean 27 | } 28 | 29 | declare type __CurriedFunction1 = (...r: [AA]) => R; 30 | declare type CurriedFunction1 = __CurriedFunction1; 31 | 32 | declare type __CurriedFunction2 = (( 33 | ...r: [AA] 34 | ) => CurriedFunction1) & 35 | ((...r: [AA, BB]) => R); 36 | declare type CurriedFunction2 = __CurriedFunction2; 37 | 38 | declare type __CurriedFunction3 = (( 39 | ...r: [AA] 40 | ) => CurriedFunction2) & 41 | ((...r: [AA, BB]) => CurriedFunction1) & 42 | ((...r: [AA, BB, CC]) => R); 43 | declare type CurriedFunction3 = __CurriedFunction3< 44 | A, 45 | B, 46 | C, 47 | R, 48 | *, 49 | *, 50 | * 51 | >; 52 | 53 | declare type __CurriedFunction4< 54 | A, 55 | B, 56 | C, 57 | D, 58 | R, 59 | AA: A, 60 | BB: B, 61 | CC: C, 62 | DD: D 63 | > = ((...r: [AA]) => CurriedFunction3) & 64 | ((...r: [AA, BB]) => CurriedFunction2) & 65 | ((...r: [AA, BB, CC]) => CurriedFunction1) & 66 | ((...r: [AA, BB, CC, DD]) => R); 67 | declare type CurriedFunction4 = __CurriedFunction4< 68 | A, 69 | B, 70 | C, 71 | D, 72 | R, 73 | *, 74 | *, 75 | *, 76 | * 77 | >; 78 | 79 | declare type __CurriedFunction5< 80 | A, 81 | B, 82 | C, 83 | D, 84 | E, 85 | R, 86 | AA: A, 87 | BB: B, 88 | CC: C, 89 | DD: D, 90 | EE: E 91 | > = ((...r: [AA]) => CurriedFunction4) & 92 | ((...r: [AA, BB]) => CurriedFunction3) & 93 | ((...r: [AA, BB, CC]) => CurriedFunction2) & 94 | ((...r: [AA, BB, CC, DD]) => CurriedFunction1) & 95 | ((...r: [AA, BB, CC, DD, EE]) => R); 96 | declare type CurriedFunction5 = __CurriedFunction5< 97 | A, 98 | B, 99 | C, 100 | D, 101 | E, 102 | R, 103 | *, 104 | *, 105 | *, 106 | *, 107 | * 108 | >; 109 | 110 | declare type __CurriedFunction6< 111 | A, 112 | B, 113 | C, 114 | D, 115 | E, 116 | F, 117 | R, 118 | AA: A, 119 | BB: B, 120 | CC: C, 121 | DD: D, 122 | EE: E, 123 | FF: F 124 | > = ((...r: [AA]) => CurriedFunction5) & 125 | ((...r: [AA, BB]) => CurriedFunction4) & 126 | ((...r: [AA, BB, CC]) => CurriedFunction3) & 127 | ((...r: [AA, BB, CC, DD]) => CurriedFunction2) & 128 | ((...r: [AA, BB, CC, DD, EE]) => CurriedFunction1) & 129 | ((...r: [AA, BB, CC, DD, EE, FF]) => R); 130 | declare type CurriedFunction6 = __CurriedFunction6< 131 | A, 132 | B, 133 | C, 134 | D, 135 | E, 136 | F, 137 | R, 138 | *, 139 | *, 140 | *, 141 | *, 142 | *, 143 | * 144 | >; 145 | 146 | declare type Curry = (((...r: [A]) => R) => CurriedFunction1) & 147 | (((...r: [A, B]) => R) => CurriedFunction2) & 148 | (((...r: [A, B, C]) => R) => CurriedFunction3) & 149 | (( 150 | (...r: [A, B, C, D]) => R 151 | ) => CurriedFunction4) & 152 | (( 153 | (...r: [A, B, C, D, E]) => R 154 | ) => CurriedFunction5) & 155 | (( 156 | (...r: [A, B, C, D, E, F]) => R 157 | ) => CurriedFunction6); 158 | 159 | declare type Partial = (((...r: [A]) => R, args: [A]) => () => R) & 160 | (((...r: [A, B]) => R, args: [A]) => CurriedFunction1) & 161 | (((...r: [A, B]) => R, args: [A, B]) => () => R) & 162 | (( 163 | (...r: [A, B, C]) => R, 164 | args: [A] 165 | ) => CurriedFunction2) & 166 | (( 167 | (...r: [A, B, C]) => R, 168 | args: [A, B] 169 | ) => CurriedFunction1) & 170 | (((...r: [A, B, C]) => R, args: [A, B, C]) => () => R) & 171 | (( 172 | (...r: [A, B, C, D]) => R, 173 | args: [A] 174 | ) => CurriedFunction3) & 175 | (( 176 | (...r: [A, B, C, D]) => R, 177 | args: [A, B] 178 | ) => CurriedFunction2) & 179 | (( 180 | (...r: [A, B, C, D]) => R, 181 | args: [A, B, C] 182 | ) => CurriedFunction1) & 183 | (( 184 | (...r: [A, B, C, D]) => R, 185 | args: [A, B, C, D] 186 | ) => () => R) & 187 | (( 188 | (...r: [A, B, C, D, E]) => R, 189 | args: [A] 190 | ) => CurriedFunction4) & 191 | (( 192 | (...r: [A, B, C, D, E]) => R, 193 | args: [A, B] 194 | ) => CurriedFunction3) & 195 | (( 196 | (...r: [A, B, C, D, E]) => R, 197 | args: [A, B, C] 198 | ) => CurriedFunction2) & 199 | (( 200 | (...r: [A, B, C, D, E]) => R, 201 | args: [A, B, C, D] 202 | ) => CurriedFunction1) & 203 | (( 204 | (...r: [A, B, C, D, E]) => R, 205 | args: [A, B, C, D, E] 206 | ) => () => R) & 207 | (( 208 | (...r: [A, B, C, D, E, F]) => R, 209 | args: [A] 210 | ) => CurriedFunction5) & 211 | (( 212 | (...r: [A, B, C, D, E, F]) => R, 213 | args: [A, B] 214 | ) => CurriedFunction4) & 215 | (( 216 | (...r: [A, B, C, D, E, F]) => R, 217 | args: [A, B, C] 218 | ) => CurriedFunction3) & 219 | (( 220 | (...r: [A, B, C, D, E, F]) => R, 221 | args: [A, B, C, D] 222 | ) => CurriedFunction2) & 223 | (( 224 | (...r: [A, B, C, D, E, F]) => R, 225 | args: [A, B, C, D, E] 226 | ) => CurriedFunction1) & 227 | (( 228 | (...r: [A, B, C, D, E, F]) => R, 229 | args: [A, B, C, D, E, F] 230 | ) => () => R); 231 | 232 | declare type Pipe = (( 233 | ab: UnaryFn, 234 | bc: UnaryFn, 235 | cd: UnaryFn, 236 | de: UnaryFn, 237 | ef: UnaryFn, 238 | fg: UnaryFn, 239 | ...rest: Array 240 | ) => UnaryFn) & 241 | (( 242 | ab: UnaryFn, 243 | bc: UnaryFn, 244 | cd: UnaryFn, 245 | de: UnaryFn, 246 | ef: UnaryFn, 247 | ...rest: Array 248 | ) => UnaryFn) & 249 | (( 250 | ab: UnaryFn, 251 | bc: UnaryFn, 252 | cd: UnaryFn, 253 | de: UnaryFn, 254 | ...rest: Array 255 | ) => UnaryFn) & 256 | (( 257 | ab: UnaryFn, 258 | bc: UnaryFn, 259 | cd: UnaryFn, 260 | ...rest: Array 261 | ) => UnaryFn) & 262 | (( 263 | ab: UnaryFn, 264 | bc: UnaryFn, 265 | ...rest: Array 266 | ) => UnaryFn) & 267 | ((ab: UnaryFn, ...rest: Array) => UnaryFn); 268 | 269 | declare type Compose = (( 270 | fg: UnaryFn, 271 | ef: UnaryFn, 272 | de: UnaryFn, 273 | cd: UnaryFn, 274 | bc: UnaryFn, 275 | ab: UnaryFn, 276 | ...rest: Array 277 | ) => UnaryFn) & 278 | (( 279 | ef: UnaryFn, 280 | de: UnaryFn, 281 | cd: UnaryFn, 282 | bc: UnaryFn, 283 | ab: UnaryFn, 284 | ...rest: Array 285 | ) => UnaryFn) & 286 | (( 287 | de: UnaryFn, 288 | cd: UnaryFn, 289 | bc: UnaryFn, 290 | ab: UnaryFn, 291 | ...rest: Array 292 | ) => UnaryFn) & 293 | (( 294 | cd: UnaryFn, 295 | bc: UnaryFn, 296 | ab: UnaryFn, 297 | ...rest: Array 298 | ) => UnaryFn) & 299 | (( 300 | bc: UnaryFn, 301 | ab: UnaryFn, 302 | ...rest: Array 303 | ) => UnaryFn) & 304 | ((ab: UnaryFn, ...rest: Array) => UnaryFn); 305 | 306 | declare type Filter = ( | { [key: K]: V }>( 307 | fn: UnaryPredicateFn, 308 | xs: T 309 | ) => T) & 310 | ( | { [key: K]: V }>( 311 | fn: UnaryPredicateFn 312 | ) => (xs: T) => T); 313 | 314 | declare class Monad { 315 | chain: Function 316 | } 317 | 318 | declare class Semigroup {} 319 | 320 | declare class Chain { 321 | chain | Array>(fn: (a: T) => V, x: V): V, 322 | chain | Array>(fn: (a: T) => V): (x: V) => V 323 | } 324 | 325 | declare class GenericContructor { 326 | constructor(x: T): GenericContructor 327 | } 328 | 329 | declare class GenericContructorMulti { 330 | constructor(...args: Array): GenericContructor 331 | } 332 | 333 | /** 334 | * DONE: 335 | * Function* 336 | * List* 337 | * Logic 338 | * Math 339 | * Object* 340 | * Relation 341 | * String 342 | * Type 343 | */ 344 | 345 | declare var compose: Compose; 346 | declare var pipe: Pipe; 347 | declare var curry: Curry; 348 | declare function curryN( 349 | length: number, 350 | fn: (...args: Array) => any 351 | ): Function; 352 | 353 | // *Math 354 | declare var add: CurriedFunction2; 355 | declare var inc: UnaryFn; 356 | declare var dec: UnaryFn; 357 | declare var mean: UnaryFn, number>; 358 | declare var divide: CurriedFunction2; 359 | declare var mathMod: CurriedFunction2; 360 | declare var median: UnaryFn, number>; 361 | declare var modulo: CurriedFunction2; 362 | declare var multiply: CurriedFunction2; 363 | declare var negate: UnaryFn; 364 | declare var product: UnaryFn, number>; 365 | declare var subtract: CurriedFunction2; 366 | declare var sum: UnaryFn, number>; 367 | 368 | // Filter 369 | declare var filter: Filter; 370 | declare var reject: Filter; 371 | 372 | // *String 373 | declare var match: CurriedFunction2>; 374 | declare var replace: CurriedFunction3< 375 | RegExp | string, 376 | string, 377 | string, 378 | string 379 | >; 380 | declare var split: CurriedFunction2>; 381 | declare var test: CurriedFunction2; 382 | declare function toLower(a: string): string; 383 | declare function toString(a: any): string; 384 | declare function toUpper(a: string): string; 385 | declare function trim(a: string): string; 386 | 387 | // *Type 388 | declare function is(t: T, ...rest: Array): (v: any) => boolean; 389 | declare function is(t: T, v: any): boolean; 390 | declare var propIs: CurriedFunction3; 391 | declare function type(x: ?any): string; 392 | declare function isArrayLike(x: any): boolean; 393 | 394 | declare function isNil(x: void | null): true; 395 | declare function isNil(x: mixed): false; 396 | 397 | // *List 398 | declare function adjust( 399 | fn: (a: T) => T, 400 | ...rest: Array 401 | ): (index: number, ...rest: Array) => (src: Array) => Array; 402 | declare function adjust( 403 | fn: (a: T) => T, 404 | index: number, 405 | ...rest: Array 406 | ): (src: Array) => Array; 407 | declare function adjust( 408 | fn: (a: T) => T, 409 | index: number, 410 | src: Array 411 | ): Array; 412 | 413 | declare function all(fn: UnaryPredicateFn, xs: Array): boolean; 414 | declare function all( 415 | fn: UnaryPredicateFn, 416 | ...rest: Array 417 | ): (xs: Array) => boolean; 418 | 419 | declare function any(fn: UnaryPredicateFn, xs: Array): boolean; 420 | declare function any( 421 | fn: UnaryPredicateFn, 422 | ...rest: Array 423 | ): (xs: Array) => boolean; 424 | 425 | declare function aperture(n: number, xs: Array): Array>; 426 | declare function aperture( 427 | n: number, 428 | ...rest: Array 429 | ): (xs: Array) => Array>; 430 | 431 | declare function append(x: E, xs: Array): Array; 432 | declare function append( 433 | x: E, 434 | ...rest: Array 435 | ): (xs: Array) => Array; 436 | 437 | declare function prepend(x: E, xs: Array): Array; 438 | declare function prepend( 439 | x: E, 440 | ...rest: Array 441 | ): (xs: Array) => Array; 442 | 443 | declare function concat | string>(x: T, y: T): T; 444 | declare function concat | string>(x: T): (y: T) => T; 445 | 446 | declare function contains | string>(x: E, xs: T): boolean; 447 | declare function contains | string>( 448 | x: E, 449 | ...rest: Array 450 | ): (xs: T) => boolean; 451 | 452 | declare function drop | string>( 453 | n: number, 454 | ...rest: Array 455 | ): (xs: T) => T; 456 | declare function drop | string>(n: number, xs: T): T; 457 | 458 | declare function dropLast | string>( 459 | n: number, 460 | ...rest: Array 461 | ): (xs: T) => T; 462 | declare function dropLast | string>(n: number, xs: T): T; 463 | 464 | declare function dropLastWhile>( 465 | fn: UnaryPredicateFn, 466 | ...rest: Array 467 | ): (xs: T) => T; 468 | declare function dropLastWhile>( 469 | fn: UnaryPredicateFn, 470 | xs: T 471 | ): T; 472 | 473 | declare function dropWhile>( 474 | fn: UnaryPredicateFn, 475 | ...rest: Array 476 | ): (xs: T) => T; 477 | declare function dropWhile>(fn: UnaryPredicateFn, xs: T): T; 478 | 479 | declare function dropRepeats>(xs: T): T; 480 | 481 | declare function dropRepeatsWith>( 482 | fn: BinaryPredicateFn, 483 | ...rest: Array 484 | ): (xs: T) => T; 485 | declare function dropRepeatsWith>( 486 | fn: BinaryPredicateFn, 487 | xs: T 488 | ): T; 489 | 490 | declare function groupBy( 491 | fn: (x: T) => string, 492 | xs: Array 493 | ): { [key: string]: Array }; 494 | declare function groupBy( 495 | fn: (x: T) => string, 496 | ...rest: Array 497 | ): (xs: Array) => { [key: string]: Array }; 498 | 499 | declare function groupWith | string>( 500 | fn: BinaryPredicateFn, 501 | xs: V 502 | ): Array; 503 | declare function groupWith | string>( 504 | fn: BinaryPredicateFn, 505 | ...rest: Array 506 | ): (xs: V) => Array; 507 | 508 | declare function head>(xs: V): ?T; 509 | declare function head(xs: V): V; 510 | 511 | declare function into, R: Array<*> | string | Object>( 512 | accum: R, 513 | xf: (a: A) => I, 514 | input: A 515 | ): R; 516 | declare function into, R>( 517 | accum: Transformer, 518 | xf: (a: A) => R, 519 | input: A 520 | ): R; 521 | 522 | declare function indexOf(x: E, xs: Array): number; 523 | declare function indexOf( 524 | x: E, 525 | ...rest: Array 526 | ): (xs: Array) => number; 527 | 528 | declare function indexBy( 529 | fn: (x: T) => string, 530 | ...rest: Array 531 | ): (xs: Array) => { [key: string]: T }; 532 | declare function indexBy( 533 | fn: (x: T) => string, 534 | xs: Array 535 | ): { [key: string]: T }; 536 | 537 | declare function insert( 538 | index: number, 539 | ...rest: Array 540 | ): (elem: T) => (src: Array) => Array; 541 | declare function insert( 542 | index: number, 543 | elem: T, 544 | ...rest: Array 545 | ): (src: Array) => Array; 546 | declare function insert(index: number, elem: T, src: Array): Array; 547 | 548 | declare function insertAll( 549 | index: number, 550 | ...rest: Array 551 | ): (elem: Array) => (src: Array) => Array; 552 | declare function insertAll( 553 | index: number, 554 | elems: Array, 555 | ...rest: Array 556 | ): (src: Array) => Array; 557 | declare function insertAll( 558 | index: number, 559 | elems: Array, 560 | src: Array 561 | ): Array; 562 | 563 | declare function join(x: string, xs: Array): string; 564 | declare function join( 565 | x: string, 566 | ...rest: Array 567 | ): (xs: Array) => string; 568 | 569 | declare function last>(xs: V): ?T; 570 | declare function last(xs: V): V; 571 | 572 | declare function none(fn: UnaryPredicateFn, xs: Array): boolean; 573 | declare function none( 574 | fn: UnaryPredicateFn, 575 | ...rest: Array 576 | ): (xs: Array) => boolean; 577 | 578 | declare function nth>(i: number, xs: T): ?V; 579 | declare function nth | string>( 580 | i: number, 581 | ...rest: Array 582 | ): ((xs: string) => string) & ((xs: T) => ?V); 583 | declare function nth(i: number, xs: T): T; 584 | 585 | declare function find | O>( 586 | fn: UnaryPredicateFn, 587 | ...rest: Array 588 | ): (xs: T | O) => ?V | O; 589 | declare function find | O>( 590 | fn: UnaryPredicateFn, 591 | xs: T | O 592 | ): ?V | O; 593 | declare function findLast | O>( 594 | fn: UnaryPredicateFn, 595 | ...rest: Array 596 | ): (xs: T | O) => ?V | O; 597 | declare function findLast | O>( 598 | fn: UnaryPredicateFn, 599 | xs: T | O 600 | ): ?V | O; 601 | 602 | declare function findIndex | { [key: K]: V }>( 603 | fn: UnaryPredicateFn, 604 | ...rest: Array 605 | ): (xs: T) => number; 606 | declare function findIndex | { [key: K]: V }>( 607 | fn: UnaryPredicateFn, 608 | xs: T 609 | ): number; 610 | declare function findLastIndex | { [key: K]: V }>( 611 | fn: UnaryPredicateFn, 612 | ...rest: Array 613 | ): (xs: T) => number; 614 | declare function findLastIndex | { [key: K]: V }>( 615 | fn: UnaryPredicateFn, 616 | xs: T 617 | ): number; 618 | 619 | declare function forEach(fn: (x: T) => ?V, xs: Array): Array; 620 | declare function forEach( 621 | fn: (x: T) => ?V, 622 | ...rest: Array 623 | ): (xs: Array) => Array; 624 | 625 | declare function lastIndexOf(x: E, xs: Array): number; 626 | declare function lastIndexOf( 627 | x: E, 628 | ...rest: Array 629 | ): (xs: Array) => number; 630 | 631 | declare function map(fn: (x: T) => R, xs: Array): Array; 632 | declare function map(fn: (x: T) => R, xs: S): S; 633 | declare function map( 634 | fn: (x: T) => R, 635 | ...rest: Array 636 | ): ((xs: { [key: string]: T }) => { [key: string]: R }) & 637 | ((xs: Array) => Array); 638 | declare function map( 639 | fn: (x: T) => R, 640 | ...rest: Array 641 | ): ((xs: S) => S) & ((xs: S) => S); 642 | declare function map( 643 | fn: (x: T) => R, 644 | xs: { [key: string]: T } 645 | ): { [key: string]: R }; 646 | 647 | declare type AccumIterator = (acc: R, x: A) => [R, B]; 648 | declare function mapAccum( 649 | fn: AccumIterator, 650 | acc: R, 651 | xs: Array 652 | ): [R, Array]; 653 | declare function mapAccum( 654 | fn: AccumIterator, 655 | ...rest: Array 656 | ): (acc: R, xs: Array) => [R, Array]; 657 | 658 | declare function mapAccumRight( 659 | fn: AccumIterator, 660 | acc: R, 661 | xs: Array 662 | ): [R, Array]; 663 | declare function mapAccumRight( 664 | fn: AccumIterator, 665 | ...rest: Array 666 | ): (acc: R, xs: Array) => [R, Array]; 667 | 668 | declare function intersperse(x: E, xs: Array): Array; 669 | declare function intersperse( 670 | x: E, 671 | ...rest: Array 672 | ): (xs: Array) => Array; 673 | 674 | declare function pair(a: A, b: B): [A, B]; 675 | declare function pair(a: A, ...rest: Array): (b: B) => [A, B]; 676 | 677 | declare function partition | { [key: K]: V }>( 678 | fn: UnaryPredicateFn, 679 | xs: T 680 | ): [T, T]; 681 | declare function partition | { [key: K]: V }>( 682 | fn: UnaryPredicateFn, 683 | ...rest: Array 684 | ): (xs: T) => [T, T]; 685 | 686 | declare function pluck< 687 | V, 688 | K: string | number, 689 | T: Array | { [key: string]: V }> 690 | >( 691 | k: K, 692 | xs: T 693 | ): Array; 694 | declare function pluck< 695 | V, 696 | K: string | number, 697 | T: Array | { [key: string]: V }> 698 | >( 699 | k: K, 700 | ...rest: Array 701 | ): (xs: T) => Array; 702 | 703 | declare var range: CurriedFunction2>; 704 | 705 | declare function remove( 706 | from: number, 707 | ...rest: Array 708 | ): ((to: number, ...rest: Array) => (src: Array) => Array) & 709 | ((to: number, src: Array) => Array); 710 | declare function remove( 711 | from: number, 712 | to: number, 713 | ...rest: Array 714 | ): (src: Array) => Array; 715 | declare function remove(from: number, to: number, src: Array): Array; 716 | 717 | declare function repeat(x: T, times: number): Array; 718 | declare function repeat( 719 | x: T, 720 | ...rest: Array 721 | ): (times: number) => Array; 722 | 723 | declare function slice | string>( 724 | from: number, 725 | ...rest: Array 726 | ): ((to: number, ...rest: Array) => (src: T) => T) & 727 | ((to: number, src: T) => T); 728 | declare function slice | string>( 729 | from: number, 730 | to: number, 731 | ...rest: Array 732 | ): (src: T) => T; 733 | declare function slice | string>( 734 | from: number, 735 | to: number, 736 | src: T 737 | ): T; 738 | 739 | declare function sort>(fn: (a: V, b: V) => number, xs: T): T; 740 | declare function sort>( 741 | fn: (a: V, b: V) => number, 742 | ...rest: Array 743 | ): (xs: T) => T; 744 | 745 | declare function times(fn: (i: number) => T, n: number): Array; 746 | declare function times( 747 | fn: (i: number) => T, 748 | ...rest: Array 749 | ): (n: number) => Array; 750 | 751 | declare function take | string>(n: number, xs: T): T; 752 | declare function take | string>(n: number): (xs: T) => T; 753 | 754 | declare function takeLast | string>(n: number, xs: T): T; 755 | declare function takeLast | string>(n: number): (xs: T) => T; 756 | 757 | declare function takeLastWhile>( 758 | fn: UnaryPredicateFn, 759 | xs: T 760 | ): T; 761 | declare function takeLastWhile>( 762 | fn: UnaryPredicateFn 763 | ): (xs: T) => T; 764 | 765 | declare function takeWhile>(fn: UnaryPredicateFn, xs: T): T; 766 | declare function takeWhile>( 767 | fn: UnaryPredicateFn 768 | ): (xs: T) => T; 769 | 770 | declare function unfold( 771 | fn: (seed: T) => [R, T] | boolean, 772 | ...rest: Array 773 | ): (seed: T) => Array; 774 | declare function unfold( 775 | fn: (seed: T) => [R, T] | boolean, 776 | seed: T 777 | ): Array; 778 | 779 | declare function uniqBy( 780 | fn: (x: T) => V, 781 | ...rest: Array 782 | ): (xs: Array) => Array; 783 | declare function uniqBy(fn: (x: T) => V, xs: Array): Array; 784 | 785 | declare function uniqWith( 786 | fn: BinaryPredicateFn, 787 | ...rest: Array 788 | ): (xs: Array) => Array; 789 | declare function uniqWith( 790 | fn: BinaryPredicateFn, 791 | xs: Array 792 | ): Array; 793 | 794 | declare function update( 795 | index: number, 796 | ...rest: Array 797 | ): ((elem: T, ...rest: Array) => (src: Array) => Array) & 798 | ((elem: T, src: Array) => Array); 799 | declare function update( 800 | index: number, 801 | elem: T, 802 | ...rest: Array 803 | ): (src: Array) => Array; 804 | declare function update(index: number, elem: T, src: Array): Array; 805 | 806 | // TODO `without` as a transducer 807 | declare function without(xs: Array, src: Array): Array; 808 | declare function without( 809 | xs: Array, 810 | ...rest: Array 811 | ): (src: Array) => Array; 812 | 813 | declare function xprod(xs: Array, ys: Array): Array<[T, S]>; 814 | declare function xprod( 815 | xs: Array, 816 | ...rest: Array 817 | ): (ys: Array) => Array<[T, S]>; 818 | 819 | declare function zip(xs: Array, ys: Array): Array<[T, S]>; 820 | declare function zip( 821 | xs: Array, 822 | ...rest: Array 823 | ): (ys: Array) => Array<[T, S]>; 824 | 825 | declare function zipObj( 826 | xs: Array, 827 | ys: Array 828 | ): { [key: T]: S }; 829 | declare function zipObj( 830 | xs: Array, 831 | ...rest: Array 832 | ): (ys: Array) => { [key: T]: S }; 833 | 834 | declare type NestedArray = Array>; 835 | declare function flatten(xs: NestedArray): Array; 836 | 837 | declare function fromPairs(pair: Array<[T, V]>): { [key: string]: V }; 838 | 839 | declare function init | string>(xs: V): V; 840 | 841 | declare function length(xs: Array): number; 842 | 843 | declare function mergeAll( 844 | objs: Array<{ [key: string]: any }> 845 | ): { [key: string]: any }; 846 | 847 | declare function reverse | string>(xs: V): V; 848 | 849 | declare function reduce( 850 | fn: (acc: A, elem: B) => A, 851 | ...rest: Array 852 | ): ((init: A, xs: Array) => A) & 853 | ((init: A, ...rest: Array) => (xs: Array) => A); 854 | declare function reduce( 855 | fn: (acc: A, elem: B) => A, 856 | init: A, 857 | ...rest: Array 858 | ): (xs: Array) => A; 859 | declare function reduce( 860 | fn: (acc: A, elem: B) => A, 861 | init: A, 862 | xs: Array 863 | ): A; 864 | 865 | declare function reduceBy( 866 | fn: (acc: B, elem: A) => B, 867 | ...rest: Array 868 | ): (( 869 | acc: B, 870 | ...rest: Array 871 | ) => (( 872 | keyFn: (elem: A) => string, 873 | ...rest: Array 874 | ) => (xs: Array) => { [key: string]: B }) & 875 | ((keyFn: (elem: A) => string, xs: Array) => { [key: string]: B })) & 876 | (( 877 | acc: B, 878 | keyFn: (elem: A) => string, 879 | ...rest: Array 880 | ) => (xs: Array) => { [key: string]: B }) & 881 | (( 882 | acc: B, 883 | keyFn: (elem: A) => string, 884 | xs: Array 885 | ) => { [key: string]: B }); 886 | declare function reduceBy( 887 | fn: (acc: B, elem: A) => B, 888 | acc: B, 889 | ...rest: Array 890 | ): (( 891 | keyFn: (elem: A) => string, 892 | ...rest: Array 893 | ) => (xs: Array) => { [key: string]: B }) & 894 | ((keyFn: (elem: A) => string, xs: Array) => { [key: string]: B }); 895 | declare function reduceBy( 896 | fn: (acc: B, elem: A) => B, 897 | acc: B, 898 | keyFn: (elem: A) => string 899 | ): (xs: Array) => { [key: string]: B }; 900 | declare function reduceBy( 901 | fn: (acc: B, elem: A) => B, 902 | acc: B, 903 | keyFn: (elem: A) => string, 904 | xs: Array 905 | ): { [key: string]: B }; 906 | 907 | declare function reduceRight( 908 | fn: (acc: A, elem: B) => A, 909 | ...rest: Array 910 | ): ((init: A, xs: Array) => A) & 911 | ((init: A, ...rest: Array) => (xs: Array) => A); 912 | declare function reduceRight( 913 | fn: (acc: A, elem: B) => A, 914 | init: A, 915 | ...rest: Array 916 | ): (xs: Array) => A; 917 | declare function reduceRight( 918 | fn: (acc: A, elem: B) => A, 919 | init: A, 920 | xs: Array 921 | ): A; 922 | 923 | declare function scan( 924 | fn: (acc: A, elem: B) => A, 925 | ...rest: Array 926 | ): ((init: A, xs: Array) => Array) & 927 | ((init: A, ...rest: Array) => (xs: Array) => Array); 928 | declare function scan( 929 | fn: (acc: A, elem: B) => A, 930 | init: A, 931 | ...rest: Array 932 | ): (xs: Array) => Array; 933 | declare function scan( 934 | fn: (acc: A, elem: B) => A, 935 | init: A, 936 | xs: Array 937 | ): Array; 938 | 939 | declare function splitAt | string>(i: number, xs: T): [T, T]; 940 | declare function splitAt | string>( 941 | i: number 942 | ): (xs: T) => [T, T]; 943 | declare function splitEvery | string>( 944 | i: number, 945 | xs: T 946 | ): Array; 947 | declare function splitEvery | string>( 948 | i: number 949 | ): (xs: T) => Array; 950 | declare function splitWhen>( 951 | fn: UnaryPredicateFn, 952 | xs: T 953 | ): [T, T]; 954 | declare function splitWhen>( 955 | fn: UnaryPredicateFn 956 | ): (xs: T) => [T, T]; 957 | 958 | declare function tail | string>(xs: V): V; 959 | 960 | declare function transpose(xs: Array>): Array>; 961 | 962 | declare function uniq(xs: Array): Array; 963 | 964 | declare function unnest(xs: NestedArray): NestedArray; 965 | 966 | declare function zipWith( 967 | fn: (a: T, b: S) => R, 968 | ...rest: Array 969 | ): ((xs: Array, ys: Array) => Array) & 970 | ((xs: Array, ...rest: Array) => (ys: Array) => Array); 971 | declare function zipWith( 972 | fn: (a: T, b: S) => R, 973 | xs: Array, 974 | ...rest: Array 975 | ): (ys: Array) => Array; 976 | declare function zipWith( 977 | fn: (a: T, b: S) => R, 978 | xs: Array, 979 | ys: Array 980 | ): Array; 981 | 982 | // *Relation 983 | declare function equals(x: T, ...rest: Array): (y: T) => boolean; 984 | declare function equals(x: T, y: T): boolean; 985 | 986 | declare function eqBy( 987 | fn: (x: A) => B, 988 | ...rest: Array 989 | ): ((x: A, y: A) => boolean) & 990 | ((x: A, ...rest: Array) => (y: A) => boolean); 991 | declare function eqBy( 992 | fn: (x: A) => B, 993 | x: A, 994 | ...rest: Array 995 | ): (y: A) => boolean; 996 | declare function eqBy(fn: (x: A) => B, x: A, y: A): boolean; 997 | 998 | declare function propEq( 999 | prop: string, 1000 | ...rest: Array 1001 | ): ((val: *, o: { [k: string]: * }) => boolean) & 1002 | ((val: *, ...rest: Array) => (o: { [k: string]: * }) => boolean); 1003 | declare function propEq( 1004 | prop: string, 1005 | val: *, 1006 | ...rest: Array 1007 | ): (o: { [k: string]: * }) => boolean; 1008 | declare function propEq(prop: string, val: *, o: { [k: string]: * }): boolean; 1009 | 1010 | declare function pathEq( 1011 | path: Array, 1012 | ...rest: Array 1013 | ): ((val: any, o: Object) => boolean) & 1014 | ((val: any, ...rest: Array) => (o: Object) => boolean); 1015 | declare function pathEq( 1016 | path: Array, 1017 | val: any, 1018 | ...rest: Array 1019 | ): (o: Object) => boolean; 1020 | declare function pathEq(path: Array, val: any, o: Object): boolean; 1021 | 1022 | declare function clamp( 1023 | min: T, 1024 | ...rest: Array 1025 | ): ((max: T, ...rest: Array) => (v: T) => T) & ((max: T, v: T) => T); 1026 | declare function clamp( 1027 | min: T, 1028 | max: T, 1029 | ...rest: Array 1030 | ): (v: T) => T; 1031 | declare function clamp(min: T, max: T, v: T): T; 1032 | 1033 | declare function countBy( 1034 | fn: (x: T) => string, 1035 | ...rest: Array 1036 | ): (list: Array) => { [key: string]: number }; 1037 | declare function countBy( 1038 | fn: (x: T) => string, 1039 | list: Array 1040 | ): { [key: string]: number }; 1041 | 1042 | declare function difference( 1043 | xs1: Array, 1044 | ...rest: Array 1045 | ): (xs2: Array) => Array; 1046 | declare function difference(xs1: Array, xs2: Array): Array; 1047 | 1048 | declare function differenceWith( 1049 | fn: BinaryPredicateFn, 1050 | ...rest: Array 1051 | ): ((xs1: Array) => (xs2: Array) => Array) & 1052 | ((xs1: Array, xs2: Array) => Array); 1053 | declare function differenceWith( 1054 | fn: BinaryPredicateFn, 1055 | xs1: Array, 1056 | ...rest: Array 1057 | ): (xs2: Array) => Array; 1058 | declare function differenceWith( 1059 | fn: BinaryPredicateFn, 1060 | xs1: Array, 1061 | xs2: Array 1062 | ): Array; 1063 | 1064 | declare function eqBy(fn: (x: T) => T, x: T, y: T): boolean; 1065 | declare function eqBy(fn: (x: T) => T): (x: T, y: T) => boolean; 1066 | declare function eqBy(fn: (x: T) => T, x: T): (y: T) => boolean; 1067 | declare function eqBy(fn: (x: T) => T): (x: T) => (y: T) => boolean; 1068 | 1069 | declare function gt(x: T, ...rest: Array): (y: T) => boolean; 1070 | declare function gt(x: T, y: T): boolean; 1071 | 1072 | declare function gte(x: T, ...rest: Array): (y: T) => boolean; 1073 | declare function gte(x: T, y: T): boolean; 1074 | 1075 | declare function identical(x: T, ...rest: Array): (y: T) => boolean; 1076 | declare function identical(x: T, y: T): boolean; 1077 | 1078 | declare function intersection(x: Array, y: Array): Array; 1079 | declare function intersection(x: Array): (y: Array) => Array; 1080 | 1081 | declare function intersectionWith( 1082 | fn: BinaryPredicateFn, 1083 | ...rest: Array 1084 | ): ((x: Array, y: Array) => Array) & 1085 | ((x: Array) => (y: Array) => Array); 1086 | declare function intersectionWith( 1087 | fn: BinaryPredicateFn, 1088 | x: Array, 1089 | ...rest: Array 1090 | ): (y: Array) => Array; 1091 | declare function intersectionWith( 1092 | fn: BinaryPredicateFn, 1093 | x: Array, 1094 | y: Array 1095 | ): Array; 1096 | 1097 | declare function lt(x: T, ...rest: Array): (y: T) => boolean; 1098 | declare function lt(x: T, y: T): boolean; 1099 | 1100 | declare function lte(x: T, ...rest: Array): (y: T) => boolean; 1101 | declare function lte(x: T, y: T): boolean; 1102 | 1103 | declare function max(x: T, ...rest: Array): (y: T) => T; 1104 | declare function max(x: T, y: T): T; 1105 | 1106 | declare function maxBy( 1107 | fn: (x: T) => V, 1108 | ...rest: Array 1109 | ): ((x: T, y: T) => T) & ((x: T) => (y: T) => T); 1110 | declare function maxBy( 1111 | fn: (x: T) => V, 1112 | x: T, 1113 | ...rest: Array 1114 | ): (y: T) => T; 1115 | declare function maxBy(fn: (x: T) => V, x: T, y: T): T; 1116 | 1117 | declare function min(x: T, ...rest: Array): (y: T) => T; 1118 | declare function min(x: T, y: T): T; 1119 | 1120 | declare function minBy( 1121 | fn: (x: T) => V, 1122 | ...rest: Array 1123 | ): ((x: T, y: T) => T) & ((x: T) => (y: T) => T); 1124 | declare function minBy( 1125 | fn: (x: T) => V, 1126 | x: T, 1127 | ...rest: Array 1128 | ): (y: T) => T; 1129 | declare function minBy(fn: (x: T) => V, x: T, y: T): T; 1130 | 1131 | declare function sortBy( 1132 | fn: (x: T) => V, 1133 | ...rest: Array 1134 | ): (x: Array) => Array; 1135 | declare function sortBy(fn: (x: T) => V, x: Array): Array; 1136 | 1137 | declare function symmetricDifference( 1138 | x: Array, 1139 | ...rest: Array 1140 | ): (y: Array) => Array; 1141 | declare function symmetricDifference(x: Array, y: Array): Array; 1142 | 1143 | declare function symmetricDifferenceWith( 1144 | fn: BinaryPredicateFn, 1145 | ...rest: Array 1146 | ): ((x: Array, ...rest: Array) => (y: Array) => Array) & 1147 | ((x: Array, y: Array) => Array); 1148 | declare function symmetricDifferenceWith( 1149 | fn: BinaryPredicateFn, 1150 | x: Array, 1151 | ...rest: Array 1152 | ): (y: Array) => Array; 1153 | declare function symmetricDifferenceWith( 1154 | fn: BinaryPredicateFn, 1155 | x: Array, 1156 | y: Array 1157 | ): Array; 1158 | 1159 | declare function union( 1160 | x: Array, 1161 | ...rest: Array 1162 | ): (y: Array) => Array; 1163 | declare function union(x: Array, y: Array): Array; 1164 | 1165 | declare function unionWith( 1166 | fn: BinaryPredicateFn, 1167 | ...rest: Array 1168 | ): ((x: Array, ...rest: Array) => (y: Array) => Array) & 1169 | ((x: Array, y: Array) => Array); 1170 | declare function unionWith( 1171 | fn: BinaryPredicateFn, 1172 | x: Array, 1173 | ...rest: Array 1174 | ): (y: Array) => Array; 1175 | declare function unionWith( 1176 | fn: BinaryPredicateFn, 1177 | x: Array, 1178 | y: Array 1179 | ): Array; 1180 | 1181 | // *Object 1182 | declare function assoc( 1183 | key: string, 1184 | ...args: Array 1185 | ): ((val: T, ...rest: Array) => (src: S) => { [k: string]: T }) & 1186 | ((val: T, src: S) => { [k: string]: T } & S); 1187 | declare function assoc( 1188 | key: string, 1189 | val: T, 1190 | ...args: Array 1191 | ): (src: S) => { [k: string]: T } & S; 1192 | declare function assoc( 1193 | key: string, 1194 | val: T, 1195 | src: S 1196 | ): { [k: string]: T } & S; 1197 | 1198 | declare function assocPath( 1199 | key: Array, 1200 | ...args: Array 1201 | ): ((val: T, ...rest: Array) => (src: S) => { [k: string]: T }) & 1202 | ((val: T) => (src: S) => { [k: string]: T } & S); 1203 | declare function assocPath( 1204 | key: Array, 1205 | val: T, 1206 | ...args: Array 1207 | ): (src: S) => { [k: string]: T } & S; 1208 | declare function assocPath( 1209 | key: Array, 1210 | val: T, 1211 | src: S 1212 | ): { [k: string]: T } & S; 1213 | 1214 | declare function clone(src: T): $Shape; 1215 | 1216 | declare function dissoc( 1217 | key: string, 1218 | ...args: Array 1219 | ): (src: { [k: string]: T }) => { [k: string]: T }; 1220 | declare function dissoc( 1221 | key: string, 1222 | src: { [k: string]: T } 1223 | ): { [k: string]: T }; 1224 | 1225 | declare function dissocPath( 1226 | key: Array, 1227 | ...args: Array 1228 | ): (src: { [k: string]: T }) => { [k: string]: T }; 1229 | declare function dissocPath( 1230 | key: Array, 1231 | src: { [k: string]: T } 1232 | ): { [k: string]: T }; 1233 | 1234 | // TODO: Started failing in v31... (Attempt to fix below) 1235 | // declare type __UnwrapNestedObjectR U>> = U 1236 | // declare type UnwrapNestedObjectR = UnwrapNestedObjectR<*, *, T> 1237 | // 1238 | // declare function evolve R>>(fn: T, ...rest: Array): (src: NestedObject) => UnwrapNestedObjectR; 1239 | // declare function evolve R>>(fn: T, src: NestedObject): UnwrapNestedObjectR; 1240 | 1241 | declare function eqProps( 1242 | key: string, 1243 | ...args: Array 1244 | ): ((o1: Object, ...rest: Array) => (o2: Object) => boolean) & 1245 | ((o1: Object, o2: Object) => boolean); 1246 | declare function eqProps( 1247 | key: string, 1248 | o1: Object, 1249 | ...args: Array 1250 | ): (o2: Object) => boolean; 1251 | declare function eqProps(key: string, o1: Object, o2: Object): boolean; 1252 | 1253 | declare function has(key: string, o: Object): boolean; 1254 | declare function has(key: string): (o: Object) => boolean; 1255 | 1256 | declare function hasIn(key: string, o: Object): boolean; 1257 | declare function hasIn(key: string): (o: Object) => boolean; 1258 | 1259 | declare function invert(o: Object): { [k: string]: Array }; 1260 | declare function invertObj(o: Object): { [k: string]: string }; 1261 | 1262 | declare function keys(o: Object): Array; 1263 | 1264 | /* TODO 1265 | lens 1266 | lensIndex 1267 | lensPath 1268 | lensProp 1269 | */ 1270 | 1271 | declare function mapObjIndexed( 1272 | fn: (val: A, key: string, o: Object) => B, 1273 | o: { [key: string]: A } 1274 | ): { [key: string]: B }; 1275 | declare function mapObjIndexed( 1276 | fn: (val: A, key: string, o: Object) => B, 1277 | ...args: Array 1278 | ): (o: { [key: string]: A }) => { [key: string]: B }; 1279 | 1280 | declare function merge(o1: A, ...rest: Array): (o2: B) => A & B; 1281 | declare function merge(o1: A, o2: B): A & B; 1282 | 1283 | declare function mergeAll( 1284 | os: Array<{ [k: string]: T }> 1285 | ): { [k: string]: T }; 1286 | 1287 | declare function mergeWith< 1288 | T, 1289 | S, 1290 | R, 1291 | A: { [k: string]: T }, 1292 | B: { [k: string]: S } 1293 | >( 1294 | fn: (v1: T, v2: S) => R 1295 | ): ((o1: A, ...rest: Array) => (o2: B) => A & B) & 1296 | ((o1: A, o2: B) => A & B); 1297 | declare function mergeWith< 1298 | T, 1299 | S, 1300 | R, 1301 | A: { [k: string]: T }, 1302 | B: { [k: string]: S } 1303 | >( 1304 | fn: (v1: T, v2: S) => R, 1305 | o1: A, 1306 | o2: B 1307 | ): A & B; 1308 | declare function mergeWith< 1309 | T, 1310 | S, 1311 | R, 1312 | A: { [k: string]: T }, 1313 | B: { [k: string]: S } 1314 | >( 1315 | fn: (v1: T, v2: S) => R, 1316 | o1: A, 1317 | ...rest: Array 1318 | ): (o2: B) => A & B; 1319 | 1320 | declare function mergeWithKey< 1321 | T, 1322 | S, 1323 | R, 1324 | A: { [k: string]: T }, 1325 | B: { [k: string]: S } 1326 | >( 1327 | fn: (key: $Keys, v1: T, v2: S) => R 1328 | ): ((o1: A, ...rest: Array) => (o2: B) => A & B) & 1329 | ((o1: A, o2: B) => A & B); 1330 | declare function mergeWithKey< 1331 | T, 1332 | S, 1333 | R, 1334 | A: { [k: string]: T }, 1335 | B: { [k: string]: S } 1336 | >( 1337 | fn: (key: $Keys, v1: T, v2: S) => R, 1338 | o1: A, 1339 | o2: B 1340 | ): A & B; 1341 | declare function mergeWithKey< 1342 | T, 1343 | S, 1344 | R, 1345 | A: { [k: string]: T }, 1346 | B: { [k: string]: S } 1347 | >( 1348 | fn: (key: $Keys, v1: T, v2: S) => R, 1349 | o1: A, 1350 | ...rest: Array 1351 | ): (o2: B) => A & B; 1352 | 1353 | declare function objOf( 1354 | key: string, 1355 | ...rest: Array 1356 | ): (val: T) => { [key: string]: T }; 1357 | declare function objOf(key: string, val: T): { [key: string]: T }; 1358 | 1359 | declare function omit( 1360 | keys: Array<$Keys>, 1361 | ...rest: Array 1362 | ): (val: T) => Object; 1363 | declare function omit(keys: Array<$Keys>, val: T): Object; 1364 | 1365 | // TODO over 1366 | 1367 | declare function path( 1368 | p: Array, 1369 | ...rest: Array 1370 | ): (o: NestedObject) => V; 1371 | declare function path( 1372 | p: Array, 1373 | ...rest: Array 1374 | ): (o: null | void) => void; 1375 | declare function path( 1376 | p: Array, 1377 | ...rest: Array 1378 | ): (o: mixed) => ?V; 1379 | declare function path>(p: Array, o: A): V; 1380 | declare function path(p: Array, o: A): void; 1381 | declare function path(p: Array, o: A): ?V; 1382 | 1383 | declare function path( 1384 | p: Array, 1385 | ...rest: Array 1386 | ): (o: NestedObject) => V; 1387 | declare function path( 1388 | p: Array, 1389 | ...rest: Array 1390 | ): (o: null | void) => void; 1391 | declare function path( 1392 | p: Array, 1393 | ...rest: Array 1394 | ): (o: mixed) => ?V; 1395 | declare function path>(p: Array, o: A): V; 1396 | declare function path(p: Array, o: A): void; 1397 | declare function path(p: Array, o: A): ?V; 1398 | 1399 | declare function pathOr>( 1400 | or: T, 1401 | ...rest: Array 1402 | ): ((p: Array, ...rest: Array) => (o: ?A) => V | T) & 1403 | ((p: Array, o: ?A) => V | T); 1404 | declare function pathOr>( 1405 | or: T, 1406 | p: Array, 1407 | ...rest: Array 1408 | ): (o: ?A) => V | T; 1409 | declare function pathOr>( 1410 | or: T, 1411 | p: Array, 1412 | o: ?A 1413 | ): V | T; 1414 | 1415 | declare function pick( 1416 | keys: Array, 1417 | ...rest: Array 1418 | ): (val: { [key: string]: A }) => { [key: string]: A }; 1419 | declare function pick( 1420 | keys: Array, 1421 | val: { [key: string]: A } 1422 | ): { [key: string]: A }; 1423 | 1424 | declare function pickAll( 1425 | keys: Array, 1426 | ...rest: Array 1427 | ): (val: { [key: string]: A }) => { [key: string]: ?A }; 1428 | declare function pickAll( 1429 | keys: Array, 1430 | val: { [key: string]: A } 1431 | ): { [key: string]: ?A }; 1432 | 1433 | declare function pickBy( 1434 | fn: BinaryPredicateFn2, 1435 | ...rest: Array 1436 | ): (val: { [key: string]: A }) => { [key: string]: A }; 1437 | declare function pickBy( 1438 | fn: BinaryPredicateFn2, 1439 | val: { [key: string]: A } 1440 | ): { [key: string]: A }; 1441 | 1442 | declare function project( 1443 | keys: Array, 1444 | ...rest: Array 1445 | ): (val: Array<{ [key: string]: T }>) => Array<{ [key: string]: T }>; 1446 | declare function project( 1447 | keys: Array, 1448 | val: Array<{ [key: string]: T }> 1449 | ): Array<{ [key: string]: T }>; 1450 | 1451 | declare function prop( 1452 | key: $Keys, 1453 | ...rest: Array 1454 | ): (o: O) => ?T; 1455 | declare function prop( 1456 | __: $npm$ramda$Placeholder, 1457 | o: O 1458 | ): (key: $Keys) => ?T; 1459 | declare function prop(key: $Keys, o: O): ?T; 1460 | 1461 | declare function propOr( 1462 | or: T, 1463 | ...rest: Array 1464 | ): ((p: $Keys, ...rest: Array) => (o: A) => V | T) & 1465 | ((p: $Keys, o: A) => V | T); 1466 | declare function propOr( 1467 | or: T, 1468 | p: $Keys, 1469 | ...rest: Array 1470 | ): (o: A) => V | T; 1471 | declare function propOr( 1472 | or: T, 1473 | p: $Keys, 1474 | o: A 1475 | ): V | T; 1476 | 1477 | declare function keysIn(o: Object): Array; 1478 | 1479 | declare function props( 1480 | keys: Array<$Keys>, 1481 | ...rest: Array 1482 | ): (o: O) => Array; 1483 | declare function props( 1484 | keys: Array<$Keys>, 1485 | o: O 1486 | ): Array; 1487 | 1488 | // TODO set 1489 | 1490 | declare function toPairs( 1491 | o: O 1492 | ): Array<[$Keys, T]>; 1493 | 1494 | declare function toPairsIn( 1495 | o: O 1496 | ): Array<[string, T]>; 1497 | 1498 | declare function values(o: O): Array; 1499 | 1500 | declare function valuesIn(o: O): Array; 1501 | 1502 | declare function where( 1503 | predObj: { [key: string]: UnaryPredicateFn }, 1504 | ...rest: Array 1505 | ): (o: { [k: string]: T }) => boolean; 1506 | declare function where( 1507 | predObj: { [key: string]: UnaryPredicateFn }, 1508 | o: { [k: string]: T } 1509 | ): boolean; 1510 | 1511 | declare function whereEq( 1512 | predObj: O, 1513 | ...rest: Array 1514 | ): (o: $Shape) => boolean; 1515 | declare function whereEq( 1516 | predObj: O, 1517 | o: $Shape 1518 | ): boolean; 1519 | 1520 | // TODO view 1521 | 1522 | // *Function 1523 | declare var __: $npm$ramda$Placeholder; 1524 | 1525 | declare var T: (_: any) => true; 1526 | declare var F: (_: any) => false; 1527 | 1528 | declare function addIndex( 1529 | iterFn: (fn: (x: A) => B, xs: Array) => Array 1530 | ): (fn: (x: A, idx: number, xs: Array) => B, xs: Array) => Array; 1531 | 1532 | declare function always(x: T): (x: any) => T; 1533 | 1534 | declare function ap( 1535 | fns: Array<(x: T) => V>, 1536 | ...rest: Array 1537 | ): (xs: Array) => Array; 1538 | declare function ap(fns: Array<(x: T) => V>, xs: Array): Array; 1539 | 1540 | declare function apply( 1541 | fn: (...args: Array) => V, 1542 | ...rest: Array 1543 | ): (xs: Array) => V; 1544 | declare function apply(fn: (...args: Array) => V, xs: Array): V; 1545 | 1546 | declare function applySpec< 1547 | V, 1548 | S, 1549 | A: Array, 1550 | T: NestedObject<(...args: A) => S> 1551 | >( 1552 | spec: T 1553 | ): (...args: A) => NestedObject; 1554 | 1555 | declare function binary( 1556 | fn: (...args: Array) => T 1557 | ): (x: any, y: any) => T; 1558 | 1559 | declare function bind( 1560 | fn: (...args: Array) => any, 1561 | thisObj: T 1562 | ): (...args: Array) => any; 1563 | 1564 | declare function call( 1565 | fn: (...args: Array) => T, 1566 | ...args: Array 1567 | ): T; 1568 | 1569 | declare function comparator( 1570 | fn: BinaryPredicateFn 1571 | ): (x: T, y: T) => number; 1572 | 1573 | // TODO add tests 1574 | declare function construct( 1575 | ctor: Class> 1576 | ): (x: T) => GenericContructor; 1577 | 1578 | // TODO add tests 1579 | declare function constructN( 1580 | n: number, 1581 | ctor: Class> 1582 | ): (...args: any) => GenericContructorMulti; 1583 | 1584 | // TODO make less generic 1585 | declare function converge(after: Function, fns: Array): Function; 1586 | 1587 | declare function empty(x: T): T; 1588 | 1589 | declare function flip( 1590 | fn: (arg0: A, arg1: B) => TResult 1591 | ): CurriedFunction2; 1592 | declare function flip( 1593 | fn: (arg0: A, arg1: B, arg2: C) => TResult 1594 | ): ((arg0: B, arg1: A, ...rest: Array) => (arg2: C) => TResult) & 1595 | ((arg0: B, arg1: A, arg2: C) => TResult); 1596 | declare function flip( 1597 | fn: (arg0: A, arg1: B, arg2: C, arg3: D) => TResult 1598 | ): (( 1599 | arg1: B, 1600 | arg0: A, 1601 | ...rest: Array 1602 | ) => (arg2: C, arg3: D) => TResult) & 1603 | ((arg1: B, arg0: A, arg2: C, arg3: D) => TResult); 1604 | declare function flip( 1605 | fn: (arg0: A, arg1: B, arg2: C, arg3: D, arg4: E) => TResult 1606 | ): (( 1607 | arg1: B, 1608 | arg0: A, 1609 | ...rest: Array 1610 | ) => (arg2: C, arg3: D, arg4: E) => TResult) & 1611 | ((arg1: B, arg0: A, arg2: C, arg3: D, arg4: E) => TResult); 1612 | 1613 | declare function identity(x: T): T; 1614 | 1615 | declare function invoker( 1616 | arity: number, 1617 | name: $Enum 1618 | ): CurriedFunction2 & 1619 | CurriedFunction3 & 1620 | CurriedFunction4; 1621 | 1622 | declare function juxt( 1623 | fns: Array<(...args: Array) => T> 1624 | ): (...args: Array) => Array; 1625 | 1626 | // TODO lift 1627 | 1628 | // TODO liftN 1629 | 1630 | declare function memoize) => B>(fn: T): T; 1631 | 1632 | declare function nAry( 1633 | arity: number, 1634 | fn: (...args: Array) => T 1635 | ): (...args: Array) => T; 1636 | 1637 | declare function nthArg(n: number): (...args: Array) => T; 1638 | 1639 | declare function of(x: T): Array; 1640 | 1641 | declare function once) => B>(fn: T): T; 1642 | 1643 | declare var partial: Partial; 1644 | // TODO partialRight 1645 | // TODO pipeK 1646 | // TODO pipeP 1647 | 1648 | declare function tap(fn: (x: T) => any, ...rest: Array): (x: T) => T; 1649 | declare function tap(fn: (x: T) => any, x: T): T; 1650 | 1651 | // TODO tryCatch 1652 | 1653 | declare function unapply( 1654 | fn: (xs: Array) => V 1655 | ): (...args: Array) => V; 1656 | 1657 | declare function unary(fn: (...args: Array) => T): (x: any) => T; 1658 | 1659 | declare var uncurryN: ((2, (A) => B => C) => (A, B) => C) & 1660 | ((3, (A) => B => C => D) => (A, B, C) => D) & 1661 | ((4, (A) => B => C => D => E) => (A, B, C, D) => E) & 1662 | (( 1663 | 5, 1664 | (A) => B => C => D => E => F 1665 | ) => (A, B, C, D, E) => F) & 1666 | (( 1667 | 6, 1668 | (A) => B => C => D => E => F => G 1669 | ) => (A, B, C, D, E, F) => G) & 1670 | (( 1671 | 7, 1672 | (A) => B => C => D => E => F => G => H 1673 | ) => (A, B, C, D, E, F, G) => H) & 1674 | (( 1675 | 8, 1676 | (A) => B => C => D => E => F => G => H => I 1677 | ) => (A, B, C, D, E, F, G, H) => I); 1678 | 1679 | //TODO useWith 1680 | 1681 | declare function wrap) => B>( 1682 | fn: F, 1683 | fn2: (fn: F, ...args: Array) => D 1684 | ): (...args: Array) => D; 1685 | 1686 | // *Logic 1687 | 1688 | declare function allPass( 1689 | fns: Array<(...args: Array) => boolean> 1690 | ): (...args: Array) => boolean; 1691 | 1692 | declare function and( 1693 | x: boolean, 1694 | ...rest: Array 1695 | ): (y: boolean) => boolean; 1696 | declare function and(x: boolean, y: boolean): boolean; 1697 | 1698 | declare function anyPass( 1699 | fns: Array<(...args: Array) => boolean> 1700 | ): (...args: Array) => boolean; 1701 | 1702 | declare function both( 1703 | x: (...args: Array) => boolean, 1704 | ...rest: Array 1705 | ): (y: (...args: Array) => boolean) => (...args: Array) => boolean; 1706 | declare function both( 1707 | x: (...args: Array) => boolean, 1708 | y: (...args: Array) => boolean 1709 | ): (...args: Array) => boolean; 1710 | 1711 | declare function complement( 1712 | x: (...args: Array) => boolean 1713 | ): (...args: Array) => boolean; 1714 | 1715 | declare function cond( 1716 | fns: Array<[(...args: Array) => boolean, (...args: Array) => B]> 1717 | ): (...args: Array) => B; 1718 | 1719 | declare function defaultTo( 1720 | d: T, 1721 | ...rest: Array 1722 | ): (x: ?V) => V | T; 1723 | declare function defaultTo(d: T, x: ?V): V | T; 1724 | 1725 | declare function either( 1726 | x: (...args: Array) => *, 1727 | ...rest: Array 1728 | ): (y: (...args: Array) => *) => (...args: Array) => *; 1729 | declare function either( 1730 | x: (...args: Array) => *, 1731 | y: (...args: Array) => * 1732 | ): (...args: Array) => *; 1733 | 1734 | declare function ifElse( 1735 | cond: (...args: Array) => boolean, 1736 | ...rest: Array 1737 | ): (( 1738 | f1: (...args: Array) => B, 1739 | ...rest: Array 1740 | ) => (f2: (...args: Array) => C) => (...args: Array) => B | C) & 1741 | (( 1742 | f1: (...args: Array) => B, 1743 | f2: (...args: Array) => C 1744 | ) => (...args: Array) => B | C); 1745 | declare function ifElse( 1746 | cond: (...args: Array) => boolean, 1747 | f1: (...args: Array) => B, 1748 | f2: (...args: Array) => C 1749 | ): (...args: Array) => B | C; 1750 | 1751 | declare function isEmpty(x: ?Array | Object | string): boolean; 1752 | 1753 | declare function not(x: boolean): boolean; 1754 | 1755 | declare function or(x: boolean, y: boolean): boolean; 1756 | declare function or(x: boolean): (y: boolean) => boolean; 1757 | 1758 | // TODO: pathSatisfies: Started failing in v39... 1759 | // declare function pathSatisfies(cond: (x: T) => boolean, path: Array, o: NestedObject): boolean; 1760 | // declare function pathSatisfies(cond: (x: T) => boolean, path: Array, ...rest: Array): (o: NestedObject) => boolean; 1761 | // declare function pathSatisfies(cond: (x: T) => boolean, ...rest: Array): 1762 | // ((path: Array, ...rest: Array) => (o: NestedObject) => boolean) 1763 | // & ((path: Array, o: NestedObject) => boolean) 1764 | 1765 | declare function propSatisfies( 1766 | cond: (x: T) => boolean, 1767 | prop: string, 1768 | o: NestedObject 1769 | ): boolean; 1770 | declare function propSatisfies( 1771 | cond: (x: T) => boolean, 1772 | prop: string, 1773 | ...rest: Array 1774 | ): (o: NestedObject) => boolean; 1775 | declare function propSatisfies( 1776 | cond: (x: T) => boolean, 1777 | ...rest: Array 1778 | ): ((prop: string, ...rest: Array) => (o: NestedObject) => boolean) & 1779 | ((prop: string, o: NestedObject) => boolean); 1780 | 1781 | declare function unless( 1782 | pred: UnaryPredicateFn, 1783 | ...rest: Array 1784 | ): ((fn: (x: S) => V, ...rest: Array) => (x: T | S) => T | V) & 1785 | ((fn: (x: S) => V, x: T | S) => T | V); 1786 | declare function unless( 1787 | pred: UnaryPredicateFn, 1788 | fn: (x: S) => V, 1789 | ...rest: Array 1790 | ): (x: T | S) => V | T; 1791 | declare function unless( 1792 | pred: UnaryPredicateFn, 1793 | fn: (x: S) => V, 1794 | x: T | S 1795 | ): T | V; 1796 | 1797 | declare function until( 1798 | pred: UnaryPredicateFn, 1799 | ...rest: Array 1800 | ): ((fn: (x: T) => T, ...rest: Array) => (x: T) => T) & 1801 | ((fn: (x: T) => T, x: T) => T); 1802 | declare function until( 1803 | pred: UnaryPredicateFn, 1804 | fn: (x: T) => T, 1805 | ...rest: Array 1806 | ): (x: T) => T; 1807 | declare function until( 1808 | pred: UnaryPredicateFn, 1809 | fn: (x: T) => T, 1810 | x: T 1811 | ): T; 1812 | 1813 | declare function when( 1814 | pred: UnaryPredicateFn, 1815 | ...rest: Array 1816 | ): ((fn: (x: S) => V, ...rest: Array) => (x: T | S) => T | V) & 1817 | ((fn: (x: S) => V, x: T | S) => T | V); 1818 | declare function when( 1819 | pred: UnaryPredicateFn, 1820 | fn: (x: S) => V, 1821 | ...rest: Array 1822 | ): (x: T | S) => V | T; 1823 | declare function when( 1824 | pred: UnaryPredicateFn, 1825 | fn: (x: S) => V, 1826 | x: T | S 1827 | ): T | V; 1828 | } 1829 | --------------------------------------------------------------------------------