From 77e64764a4c4aadd74e43e9e94f2fffd129737e5 Mon Sep 17 00:00:00 2001 From: Technote Date: Sun, 15 Sep 2019 00:36:31 +0900 Subject: [PATCH 01/11] Update ci.yml --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index f33b9734..4b2ccec8 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -15,7 +15,7 @@ jobs: steps: - uses: actions/checkout@v1 with: - fetch-depth: 1 + fetch-depth: 3 - name: Install Package dependencies run: yarn install - name: Run tests From 2ac8a36654271a8106158f340e922b9b95e3079c Mon Sep 17 00:00:00 2001 From: Technote Date: Sun, 15 Sep 2019 00:37:52 +0900 Subject: [PATCH 02/11] feat: matrix build (#28) --- .github/workflows/ci.yml | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 4b2ccec8..611c3b00 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -12,10 +12,17 @@ jobs: jest: name: Jest runs-on: ubuntu-latest + strategy: + matrix: + node_version: [10, 11, 12] steps: - uses: actions/checkout@v1 with: fetch-depth: 3 + - name: Use Node.js ${{ matrix.node_version }} + uses: actions/setup-node@v1 + with: + version: ${{ matrix.node_version }} - name: Install Package dependencies run: yarn install - name: Run tests From a34b319f2828a98e982bbb4e7d72e372142f3b84 Mon Sep 17 00:00:00 2001 From: Technote Date: Sun, 15 Sep 2019 00:51:54 +0900 Subject: [PATCH 03/11] Update ci.yml --- .github/workflows/ci.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 611c3b00..f31611c8 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -14,15 +14,15 @@ jobs: runs-on: ubuntu-latest strategy: matrix: - node_version: [10, 11, 12] + node: ['8', '10', '11', '12'] steps: - uses: actions/checkout@v1 with: fetch-depth: 3 - - name: Use Node.js ${{ matrix.node_version }} + - name: Setup node uses: actions/setup-node@v1 with: - version: ${{ matrix.node_version }} + node-version: ${{ matrix.node }} - name: Install Package dependencies run: yarn install - name: Run tests From e8900a74bee3452d9bcb71780c03e84138c49ced Mon Sep 17 00:00:00 2001 From: Technote Date: Sun, 15 Sep 2019 01:09:05 +0900 Subject: [PATCH 04/11] Update ci.yml --- .github/workflows/ci.yml | 31 ++++++++++++++++++++++--------- 1 file changed, 22 insertions(+), 9 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index f31611c8..f1ec5e9d 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -27,14 +27,11 @@ jobs: run: yarn install - name: Run tests run: yarn cover - - name: Send covarage - run: yarn add coveralls && cat ./coverage/lcov.info | ./node_modules/coveralls/bin/coveralls.js - env: - COVERALLS_REPO_TOKEN: ${{ secrets.COVERALLS_REPO_TOKEN }} - COVERALLS_SERVICE_NAME: "GitHub Action" - COVERALLS_SERVICE_JOB_ID: ${{ github.sha }} - COVERALLS_GIT_COMMIT: ${{ github.sha }} - COVERALLS_GIT_BRANCH: ${{ github.ref }} + - name: Coveralls + uses: coverallsapp/github-action@master + with: + github-token: ${{ secrets.github_token }} + parallel: true - uses: 8398a7/action-slack@v1 with: type: failure @@ -42,10 +39,26 @@ jobs: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }} if: failure() + + coverallsFinished: + name: Coveralls Finished + needs: jest + runs-on: ubuntu-latest + steps: + - name: Coveralls Finished + uses: coverallsapp/github-action@master + with: + github-token: ${{ secrets.github_token }} + parallel-finished: true + + slack: + name: Slack + needs: coverallsFinished + runs-on: ubuntu-latest + steps: - uses: 8398a7/action-slack@v1 with: type: success env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }} - if: success() From 35949cf72bf6d012a7104a5d8f0f2b6800e76cf3 Mon Sep 17 00:00:00 2001 From: Technote Date: Mon, 16 Sep 2019 00:50:03 +0900 Subject: [PATCH 05/11] feat: add packages --- package.json | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/package.json b/package.json index 59212653..1ff2f526 100644 --- a/package.json +++ b/package.json @@ -25,6 +25,9 @@ "devDependencies": { "@types/jest": "^24.0.18", "@types/node": "^12.7.5", + "@typescript-eslint/eslint-plugin": "^2.2.0", + "@typescript-eslint/parser": "^2.2.0", + "eslint": "^6.4.0", "jest": "^24.9.0", "jest-circus": "^24.9.0", "nock": "^11.3.4", @@ -36,7 +39,8 @@ }, "scripts": { "build": "tsc", - "test": "jest", + "test": "yarn lint && yarn cover", + "lint": "eslint src/**/**/*.ts && eslint __tests__/**/**/*.ts", "cover": "jest --coverage" } } From 9e6e62cd55d613fabeae32b720d3a0f83c74709b Mon Sep 17 00:00:00 2001 From: Technote Date: Mon, 16 Sep 2019 00:50:14 +0900 Subject: [PATCH 06/11] feat: add settings --- .editorconfig | 13 +++++ .eslintrc | 149 ++++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 162 insertions(+) create mode 100644 .editorconfig create mode 100644 .eslintrc diff --git a/.editorconfig b/.editorconfig new file mode 100644 index 00000000..24deeb41 --- /dev/null +++ b/.editorconfig @@ -0,0 +1,13 @@ +root = true + +[*] +charset = utf-8 +end_of_line = lf +insert_final_newline = true +trim_trailing_whitespace = true +indent_style = tab +indent_size = 4 + +[{*.json,*.yml}] +indent_style = space +indent_size = 2 diff --git a/.eslintrc b/.eslintrc new file mode 100644 index 00000000..d3328255 --- /dev/null +++ b/.eslintrc @@ -0,0 +1,149 @@ +{ + "extends": [ + "eslint:recommended", + "plugin:@typescript-eslint/recommended", + "plugin:@typescript-eslint/eslint-recommended" + ], + "plugins": [ + "@typescript-eslint" + ], + "parser": "@typescript-eslint/parser", + "parserOptions": { + "sourceType": "module", + "ecmaVersion": 2018 + }, + "env": { + "node": true, + "jest": true, + "es6": true, + "browser": true + }, + "settings": { + "react": { + "version": "latest" + } + }, + "rules": { + "camelcase": [ + "error", + { + "properties": "always" + } + ], + "require-jsdoc": [ + "error", + { + "require": { + "FunctionDeclaration": true, + "MethodDefinition": true, + "ClassDeclaration": true + } + } + ], + "valid-jsdoc": [ + "error", + { + "requireReturn": false, + "preferType": { + "String": "string", + "Object": "object", + "Number": "number", + "Function": "function", + "Void": "void" + } + } + ], + "quotes": [ + "error", + "single", + "avoid-escape" + ], + "key-spacing": [ + "error", + { + "singleLine": { + "beforeColon": false, + "afterColon": true + }, + "multiLine": { + "beforeColon": false, + "afterColon": true + } + } + ], + "no-magic-numbers": [ + "error", + { + "ignoreArrayIndexes": true + } + ], + "eqeqeq": "error", + "block-scoped-var": "error", + "complexity": [ + "error", + { + "maximum": 20 + } + ], + "curly": "error", + "default-case": "error", + "dot-location": [ + "error", + "property" + ], + "guard-for-in": "error", + "no-eval": "error", + "block-spacing": "error", + "brace-style": "error", + "comma-spacing": [ + "error", + { + "before": false, + "after": true + } + ], + "id-length": [ + "error", + { + "min": 2, + "properties": "never", + "exceptions": [ + "$" + ] + } + ], + "indent": [ + "error", + "tab", + { + "MemberExpression": "off" + } + ], + "space-before-function-paren": [ + "error", + "never" + ], + "space-before-blocks": "error", + "prefer-const": "error", + "no-var": "error", + "arrow-body-style": "off", + "arrow-spacing": "error", + "strict": [ + "error" + ], + "no-warning-comments": [ + "warn", + { + "terms": [ + "todo", + "fixme", + "hack" + ], + "location": "anywhere" + } + ], + "semi": [ + "error" + ] + } +} From 6ef2a6f4810901cc52eb21b92818ac5bc2941382 Mon Sep 17 00:00:00 2001 From: Technote Date: Mon, 16 Sep 2019 00:50:42 +0900 Subject: [PATCH 07/11] feat: update packages --- yarn.lock | 459 ++++++++++++++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 444 insertions(+), 15 deletions(-) diff --git a/yarn.lock b/yarn.lock index f248138b..5b515559 100644 --- a/yarn.lock +++ b/yarn.lock @@ -391,6 +391,11 @@ dependencies: "@babel/types" "^7.3.0" +"@types/eslint-visitor-keys@^1.0.0": + version "1.0.0" + resolved "https://registry.yarnpkg.com/@types/eslint-visitor-keys/-/eslint-visitor-keys-1.0.0.tgz#1ee30d79544ca84d68d4b3cdb0af4f205663dd2d" + integrity sha512-OCutwjDZ4aFS6PB1UZ988C4YgwlBHJd6wCeQqaLdmadZ/7e+w79+hbMUFC1QXDNCmdyoRfAFdm0RypzwR+Qpag== + "@types/istanbul-lib-coverage@*", "@types/istanbul-lib-coverage@^2.0.0": version "2.0.1" resolved "https://registry.yarnpkg.com/@types/istanbul-lib-coverage/-/istanbul-lib-coverage-2.0.1.tgz#42995b446db9a48a11a07ec083499a860e9138ff" @@ -423,6 +428,11 @@ dependencies: "@types/jest-diff" "*" +"@types/json-schema@^7.0.3": + version "7.0.3" + resolved "https://registry.yarnpkg.com/@types/json-schema/-/json-schema-7.0.3.tgz#bdfd69d61e464dcc81b25159c270d75a73c1a636" + integrity sha512-Il2DtDVRGDcqjDtE+rF8iqg1CArehSK84HZJCT7AMITlyXRBpuPhqGLDQMowraqqu1coEaimg4ZOqggt6L6L+A== + "@types/node@^12.7.5": version "12.7.5" resolved "https://registry.yarnpkg.com/@types/node/-/node-12.7.5.tgz#e19436e7f8e9b4601005d73673b6dc4784ffcc2f" @@ -445,6 +455,46 @@ dependencies: "@types/yargs-parser" "*" +"@typescript-eslint/eslint-plugin@^2.2.0": + version "2.2.0" + resolved "https://registry.yarnpkg.com/@typescript-eslint/eslint-plugin/-/eslint-plugin-2.2.0.tgz#cba8caa6ad8df544c46bca674125a31af8c9ac2f" + integrity sha512-rOodtI+IvaO8USa6ValYOrdWm9eQBgqwsY+B0PPiB+aSiK6p6Z4l9jLn/jI3z3WM4mkABAhKIqvGIBl0AFRaLQ== + dependencies: + "@typescript-eslint/experimental-utils" "2.2.0" + eslint-utils "^1.4.2" + functional-red-black-tree "^1.0.1" + regexpp "^2.0.1" + tsutils "^3.17.1" + +"@typescript-eslint/experimental-utils@2.2.0": + version "2.2.0" + resolved "https://registry.yarnpkg.com/@typescript-eslint/experimental-utils/-/experimental-utils-2.2.0.tgz#31d855fbc425168ecf56960c777aacfcca391cff" + integrity sha512-IMhbewFs27Frd/ICHBRfIcsUCK213B8MsEUqvKFK14SDPjPR5JF6jgOGPlroybFTrGWpMvN5tMZdXAf+xcmxsA== + dependencies: + "@types/json-schema" "^7.0.3" + "@typescript-eslint/typescript-estree" "2.2.0" + eslint-scope "^5.0.0" + +"@typescript-eslint/parser@^2.2.0": + version "2.2.0" + resolved "https://registry.yarnpkg.com/@typescript-eslint/parser/-/parser-2.2.0.tgz#3cd758ed85ae9be06667beb61bbdf8060f274fb7" + integrity sha512-0mf893kj9L65O5sA7wP6EoYvTybefuRFavUNhT7w9kjhkdZodoViwVS+k3D+ZxKhvtL7xGtP/y/cNMJX9S8W4A== + dependencies: + "@types/eslint-visitor-keys" "^1.0.0" + "@typescript-eslint/experimental-utils" "2.2.0" + "@typescript-eslint/typescript-estree" "2.2.0" + eslint-visitor-keys "^1.1.0" + +"@typescript-eslint/typescript-estree@2.2.0": + version "2.2.0" + resolved "https://registry.yarnpkg.com/@typescript-eslint/typescript-estree/-/typescript-estree-2.2.0.tgz#1e2aad5ed573f9f7a8e3261eb79404264c4fc57f" + integrity sha512-9/6x23A3HwWWRjEQbuR24on5XIfVmV96cDpGR9671eJv1ebFKHj2sGVVAwkAVXR2UNuhY1NeKS2QMv5P8kQb2Q== + dependencies: + glob "^7.1.4" + is-glob "^4.0.1" + lodash.unescape "4.0.1" + semver "^6.3.0" + abab@^2.0.0: version "2.0.1" resolved "https://registry.yarnpkg.com/abab/-/abab-2.0.1.tgz#3fa17797032b71410ec372e11668f4b4ffc86a82" @@ -463,6 +513,11 @@ acorn-globals@^4.1.0: acorn "^6.0.1" acorn-walk "^6.0.1" +acorn-jsx@^5.0.2: + version "5.0.2" + resolved "https://registry.yarnpkg.com/acorn-jsx/-/acorn-jsx-5.0.2.tgz#84b68ea44b373c4f8686023a551f61a21b7c4a4f" + integrity sha512-tiNTrP1MP0QrChmD2DdupCr6HWSFeKVw5d/dHTu4Y7rkAkRhU/Dt7dphAfIUyxtHpl/eBVip5uTNSpQJHylpAw== + acorn-walk@^6.0.1: version "6.2.0" resolved "https://registry.yarnpkg.com/acorn-walk/-/acorn-walk-6.2.0.tgz#123cb8f3b84c2171f1f7fb252615b1c78a6b1a8c" @@ -478,7 +533,12 @@ acorn@^6.0.1: resolved "https://registry.yarnpkg.com/acorn/-/acorn-6.3.0.tgz#0087509119ffa4fc0a0041d1e93a417e68cb856e" integrity sha512-/czfa8BwS88b9gWQVhc8eknunSA2DoJpJyTQkhheIf5E48u1N0R4q/YxxsAeqRrmK9TQ/uYfgLDfZo91UlANIA== -ajv@^6.5.5: +acorn@^7.0.0: + version "7.0.0" + resolved "https://registry.yarnpkg.com/acorn/-/acorn-7.0.0.tgz#26b8d1cd9a9b700350b71c0905546f64d1284e7a" + integrity sha512-PaF/MduxijYYt7unVGRuds1vBC9bFxbNf+VWqhOClfdgy7RlVkQqt610ig1/yxTgsDIfW1cWDel5EBbOy3jdtQ== + +ajv@^6.10.0, ajv@^6.10.2, ajv@^6.5.5: version "6.10.2" resolved "https://registry.yarnpkg.com/ajv/-/ajv-6.10.2.tgz#d3cea04d6b017b2894ad69040fec8b623eb4bd52" integrity sha512-TXtUUEYHuaTEbLZWIKUr5pmBuhDLy+8KYtPYdcV8qC+pOZL+NKqYwvWSRrVXHn+ZmRRAu8vJTAznH7Oag6RVRw== @@ -488,7 +548,7 @@ ajv@^6.5.5: json-schema-traverse "^0.4.1" uri-js "^4.2.2" -ansi-escapes@^3.0.0: +ansi-escapes@^3.0.0, ansi-escapes@^3.2.0: version "3.2.0" resolved "https://registry.yarnpkg.com/ansi-escapes/-/ansi-escapes-3.2.0.tgz#8780b98ff9dbf5638152d1f1fe5c1d7b4442976b" integrity sha512-cBhpre4ma+U0T1oM5fXg7Dy1Jw7zzwv7lt/GoCpr+hDQJoYnKVPLL4dCvSEFMmQurOQvSrwT7SL/DAlhBI97RQ== @@ -536,6 +596,13 @@ are-we-there-yet@~1.1.2: delegates "^1.0.0" readable-stream "^2.0.6" +argparse@^1.0.7: + version "1.0.10" + resolved "https://registry.yarnpkg.com/argparse/-/argparse-1.0.10.tgz#bcd6791ea5ae09725e17e5ad988134cd40b3d911" + integrity sha512-o5Roy6tNG4SL/FOkCAN6RzjiakZS25RLYFrcMttJqbdd8BWrnA+fGz57iN5Pb06pvBGvl5gQ0B48dJlslXvoTg== + dependencies: + sprintf-js "~1.0.2" + arr-diff@^4.0.0: version "4.0.0" resolved "https://registry.yarnpkg.com/arr-diff/-/arr-diff-4.0.0.tgz#d6461074febfec71e7e15235761a329a5dc7c520" @@ -800,7 +867,7 @@ chai@^4.1.2: pathval "^1.1.0" type-detect "^4.0.5" -chalk@^2.0.0, chalk@^2.0.1, chalk@^2.3.2, chalk@^2.4.2: +chalk@^2.0.0, chalk@^2.0.1, chalk@^2.1.0, chalk@^2.3.2, chalk@^2.4.2: version "2.4.2" resolved "https://registry.yarnpkg.com/chalk/-/chalk-2.4.2.tgz#cd42541677a54333cf541a49108c1432b44c9424" integrity sha512-Mti+f9lpJNcwF4tWV8/OrTTtF1gZi+f8FqlyAdouralcFWFQWF2+NgCHShjkCb+IFBLq9buZwE1xckQU4peSuQ== @@ -809,6 +876,11 @@ chalk@^2.0.0, chalk@^2.0.1, chalk@^2.3.2, chalk@^2.4.2: escape-string-regexp "^1.0.5" supports-color "^5.3.0" +chardet@^0.7.0: + version "0.7.0" + resolved "https://registry.yarnpkg.com/chardet/-/chardet-0.7.0.tgz#90094849f0937f2eedc2425d0d28a9e5f0cbad9e" + integrity sha512-mT8iDcrh03qDGRRmoA2hmBJnxpllMR+0/0qlzjqZES6NdiWDcZkCNAk4rPFZ9Q85r27unkiNNg8ZOiwZXBHwcA== + check-error@^1.0.2: version "1.0.2" resolved "https://registry.yarnpkg.com/check-error/-/check-error-1.0.2.tgz#574d312edd88bb5dd8912e9286dd6c0aed4aac82" @@ -834,6 +906,18 @@ class-utils@^0.3.5: isobject "^3.0.0" static-extend "^0.1.1" +cli-cursor@^2.1.0: + version "2.1.0" + resolved "https://registry.yarnpkg.com/cli-cursor/-/cli-cursor-2.1.0.tgz#b35dac376479facc3e94747d41d0d0f5238ffcb5" + integrity sha1-s12sN2R5+sw+lHR9QdDQ9SOP/LU= + dependencies: + restore-cursor "^2.0.0" + +cli-width@^2.0.0: + version "2.2.0" + resolved "https://registry.yarnpkg.com/cli-width/-/cli-width-2.2.0.tgz#ff19ede8a9a5e579324147b0c11f0fbcbabed639" + integrity sha1-/xnt6Kml5XkyQUewwR8PvLq+1jk= + cliui@^5.0.0: version "5.0.0" resolved "https://registry.yarnpkg.com/cliui/-/cliui-5.0.0.tgz#deefcfdb2e800784aa34f46fa08e06851c7bbbc5" @@ -917,7 +1001,7 @@ core-util-is@1.0.2, core-util-is@~1.0.0: resolved "https://registry.yarnpkg.com/core-util-is/-/core-util-is-1.0.2.tgz#b5fd54220aa2bc5ab57aab7140c940754503c1a7" integrity sha1-tf1UIgqivFq1eqtxQMlAdUUDwac= -cross-spawn@^6.0.0: +cross-spawn@^6.0.0, cross-spawn@^6.0.5: version "6.0.5" resolved "https://registry.yarnpkg.com/cross-spawn/-/cross-spawn-6.0.5.tgz#4a5ec7c64dfae22c3a14124dbacdee846d80cbc4" integrity sha512-eTVLrBSt7fjbDygz805pMnstIs2VTBNkRm0qxZd+M7A5XDdxVRWO5MxGBXZhjY4cqLYLdtrGqRf8mBPmzwSpWQ== @@ -970,7 +1054,7 @@ debug@^3.2.6: dependencies: ms "^2.1.1" -debug@^4.1.0, debug@^4.1.1: +debug@^4.0.1, debug@^4.1.0, debug@^4.1.1: version "4.1.1" resolved "https://registry.yarnpkg.com/debug/-/debug-4.1.1.tgz#3b72260255109c6b589cee050f1d516139664791" integrity sha512-pYAIzeRo8J6KPEaJ0VWOh5Pzkbw/RetuzehGM7QRRX5he4fPHx2rdKMB256ehJCkX+XRQm16eZLqLNS8RSZXZw== @@ -1068,6 +1152,13 @@ diff-sequences@^24.9.0: resolved "https://registry.yarnpkg.com/diff-sequences/-/diff-sequences-24.9.0.tgz#5715d6244e2aa65f48bba0bc972db0b0b11e95b5" integrity sha512-Dj6Wk3tWyTE+Fo1rW8v0Xhwk80um6yFYKbuAxc9c3EZxIHFDYwbi34Uk42u1CdnIiVorvt4RmlSDjIPyzGC2ew== +doctrine@^3.0.0: + version "3.0.0" + resolved "https://registry.yarnpkg.com/doctrine/-/doctrine-3.0.0.tgz#addebead72a6574db783639dc87a121773973961" + integrity sha512-yS+Q5i3hBf7GBkd4KG8a7eBNNWNGLTaEwwYWUijIYM7zrlYDM0BFXHjjPWlWZ1Rg7UaddZeIDmi9jF3HmqiQ2w== + dependencies: + esutils "^2.0.2" + domexception@^1.0.1: version "1.0.1" resolved "https://registry.yarnpkg.com/domexception/-/domexception-1.0.1.tgz#937442644ca6a31261ef36e3ec677fe805582c90" @@ -1140,12 +1231,103 @@ escodegen@^1.9.1: optionalDependencies: source-map "~0.6.1" +eslint-scope@^5.0.0: + version "5.0.0" + resolved "https://registry.yarnpkg.com/eslint-scope/-/eslint-scope-5.0.0.tgz#e87c8887c73e8d1ec84f1ca591645c358bfc8fb9" + integrity sha512-oYrhJW7S0bxAFDvWqzvMPRm6pcgcnWc4QnofCAqRTRfQC0JcwenzGglTtsLyIuuWFfkqDG9vz67cnttSd53djw== + dependencies: + esrecurse "^4.1.0" + estraverse "^4.1.1" + +eslint-utils@^1.4.2: + version "1.4.2" + resolved "https://registry.yarnpkg.com/eslint-utils/-/eslint-utils-1.4.2.tgz#166a5180ef6ab7eb462f162fd0e6f2463d7309ab" + integrity sha512-eAZS2sEUMlIeCjBeubdj45dmBHQwPHWyBcT1VSYB7o9x9WRRqKxyUoiXlRjyAwzN7YEzHJlYg0NmzDRWx6GP4Q== + dependencies: + eslint-visitor-keys "^1.0.0" + +eslint-visitor-keys@^1.0.0, eslint-visitor-keys@^1.1.0: + version "1.1.0" + resolved "https://registry.yarnpkg.com/eslint-visitor-keys/-/eslint-visitor-keys-1.1.0.tgz#e2a82cea84ff246ad6fb57f9bde5b46621459ec2" + integrity sha512-8y9YjtM1JBJU/A9Kc+SbaOV4y29sSWckBwMHa+FGtVj5gN/sbnKDf6xJUl+8g7FAij9LVaP8C24DUiH/f/2Z9A== + +eslint@^6.4.0: + version "6.4.0" + resolved "https://registry.yarnpkg.com/eslint/-/eslint-6.4.0.tgz#5aa9227c3fbe921982b2eda94ba0d7fae858611a" + integrity sha512-WTVEzK3lSFoXUovDHEbkJqCVPEPwbhCq4trDktNI6ygs7aO41d4cDT0JFAT5MivzZeVLWlg7vHL+bgrQv/t3vA== + dependencies: + "@babel/code-frame" "^7.0.0" + ajv "^6.10.0" + chalk "^2.1.0" + cross-spawn "^6.0.5" + debug "^4.0.1" + doctrine "^3.0.0" + eslint-scope "^5.0.0" + eslint-utils "^1.4.2" + eslint-visitor-keys "^1.1.0" + espree "^6.1.1" + esquery "^1.0.1" + esutils "^2.0.2" + file-entry-cache "^5.0.1" + functional-red-black-tree "^1.0.1" + glob-parent "^5.0.0" + globals "^11.7.0" + ignore "^4.0.6" + import-fresh "^3.0.0" + imurmurhash "^0.1.4" + inquirer "^6.4.1" + is-glob "^4.0.0" + js-yaml "^3.13.1" + json-stable-stringify-without-jsonify "^1.0.1" + levn "^0.3.0" + lodash "^4.17.14" + minimatch "^3.0.4" + mkdirp "^0.5.1" + natural-compare "^1.4.0" + optionator "^0.8.2" + progress "^2.0.0" + regexpp "^2.0.1" + semver "^6.1.2" + strip-ansi "^5.2.0" + strip-json-comments "^3.0.1" + table "^5.2.3" + text-table "^0.2.0" + v8-compile-cache "^2.0.3" + +espree@^6.1.1: + version "6.1.1" + resolved "https://registry.yarnpkg.com/espree/-/espree-6.1.1.tgz#7f80e5f7257fc47db450022d723e356daeb1e5de" + integrity sha512-EYbr8XZUhWbYCqQRW0duU5LxzL5bETN6AjKBGy1302qqzPaCH10QbRg3Wvco79Z8x9WbiE8HYB4e75xl6qUYvQ== + dependencies: + acorn "^7.0.0" + acorn-jsx "^5.0.2" + eslint-visitor-keys "^1.1.0" + esprima@^3.1.3: version "3.1.3" resolved "https://registry.yarnpkg.com/esprima/-/esprima-3.1.3.tgz#fdca51cee6133895e3c88d535ce49dbff62a4633" integrity sha1-/cpRzuYTOJXjyI1TXOSdv/YqRjM= -estraverse@^4.2.0: +esprima@^4.0.0: + version "4.0.1" + resolved "https://registry.yarnpkg.com/esprima/-/esprima-4.0.1.tgz#13b04cdb3e6c5d19df91ab6987a8695619b0aa71" + integrity sha512-eGuFFw7Upda+g4p+QHvnW0RyTX/SVeJBDM/gCtMARO0cLuT2HcEKnTPvhjV6aGeqrCB/sbNop0Kszm0jsaWU4A== + +esquery@^1.0.1: + version "1.0.1" + resolved "https://registry.yarnpkg.com/esquery/-/esquery-1.0.1.tgz#406c51658b1f5991a5f9b62b1dc25b00e3e5c708" + integrity sha512-SmiyZ5zIWH9VM+SRUReLS5Q8a7GxtRdxEBVZpm98rJM7Sb+A9DVCndXfkeFUd3byderg+EbDkfnevfCwynWaNA== + dependencies: + estraverse "^4.0.0" + +esrecurse@^4.1.0: + version "4.2.1" + resolved "https://registry.yarnpkg.com/esrecurse/-/esrecurse-4.2.1.tgz#007a3b9fdbc2b3bb87e4879ea19c92fdbd3942cf" + integrity sha512-64RBB++fIOAXPw3P9cy89qfMlvZEXZkqqJkjqqXIvzP5ezRZjW+lPWjw35UX/3EhUPFYbg5ER4JYgDw4007/DQ== + dependencies: + estraverse "^4.1.0" + +estraverse@^4.0.0, estraverse@^4.1.0, estraverse@^4.1.1, estraverse@^4.2.0: version "4.3.0" resolved "https://registry.yarnpkg.com/estraverse/-/estraverse-4.3.0.tgz#398ad3f3c5a24948be7725e83d11a7de28cdbd1d" integrity sha512-39nnKffWz8xN1BU/2c79n9nB9HDzo0niYUqx6xyqUnyoAnQyyWpOTdZEeiCch8BBu515t4wp9ZmgVfVhn9EBpw== @@ -1223,6 +1405,15 @@ extend@~3.0.2: resolved "https://registry.yarnpkg.com/extend/-/extend-3.0.2.tgz#f8b1136b4071fbd8eb140aff858b1019ec2915fa" integrity sha512-fjquC59cD7CyW6urNXK0FBufkZcoiGG80wTuPujX590cB5Ttln20E2UB4S/WARVqhXffZl2LNgS+gQdPIIim/g== +external-editor@^3.0.3: + version "3.1.0" + resolved "https://registry.yarnpkg.com/external-editor/-/external-editor-3.1.0.tgz#cb03f740befae03ea4d283caed2741a83f335495" + integrity sha512-hMQ4CX1p1izmuLYyZqLMO/qGNw10wSv9QDCPfzXfyFrOaCSSoRfqE1Kf1s5an66J5JZC62NewG+mK49jOCtQew== + dependencies: + chardet "^0.7.0" + iconv-lite "^0.4.24" + tmp "^0.0.33" + extglob@^2.0.4: version "2.0.4" resolved "https://registry.yarnpkg.com/extglob/-/extglob-2.0.4.tgz#ad00fe4dc612a9232e8718711dc5cb5ab0285543" @@ -1276,6 +1467,13 @@ figures@^2.0.0: dependencies: escape-string-regexp "^1.0.5" +file-entry-cache@^5.0.1: + version "5.0.1" + resolved "https://registry.yarnpkg.com/file-entry-cache/-/file-entry-cache-5.0.1.tgz#ca0f6efa6dd3d561333fb14515065c2fafdf439c" + integrity sha512-bCg29ictuBaKUwwArK4ouCaqDgLZcysCFLmM/Yn/FDoqndh/9vNuQfXRDvTuXKLxfD/JtZQGKFT8MGcJBK644g== + dependencies: + flat-cache "^2.0.1" + fill-range@^4.0.0: version "4.0.0" resolved "https://registry.yarnpkg.com/fill-range/-/fill-range-4.0.0.tgz#d544811d428f98eb06a63dc402d2403c328c38f7" @@ -1300,6 +1498,20 @@ find-up@^3.0.0: dependencies: locate-path "^3.0.0" +flat-cache@^2.0.1: + version "2.0.1" + resolved "https://registry.yarnpkg.com/flat-cache/-/flat-cache-2.0.1.tgz#5d296d6f04bda44a4630a301413bdbc2ec085ec0" + integrity sha512-LoQe6yDuUMDzQAEH8sgmh4Md6oZnc/7PjtwjNFSzveXqSHt6ka9fPBuso7IGf9Rz4uqnSnWiFH2B/zj24a5ReA== + dependencies: + flatted "^2.0.0" + rimraf "2.6.3" + write "1.0.3" + +flatted@^2.0.0: + version "2.0.1" + resolved "https://registry.yarnpkg.com/flatted/-/flatted-2.0.1.tgz#69e57caa8f0eacbc281d2e2cb458d46fdb449e08" + integrity sha512-a1hQMktqW9Nmqr5aktAux3JMNqaucxGcjtjWnZLHX7yyPCmlSV3M54nGYbqT8K+0GhF3NBgmJCc3ma+WOgX8Jg== + for-in@^1.0.2: version "1.0.2" resolved "https://registry.yarnpkg.com/for-in/-/for-in-1.0.2.tgz#81068d295a8142ec0ac726c6e2200c30fb6d5e80" @@ -1351,6 +1563,11 @@ function-bind@^1.1.1: resolved "https://registry.yarnpkg.com/function-bind/-/function-bind-1.1.1.tgz#a56899d3ea3c9bab874bb9773b7c5ede92f4895d" integrity sha512-yIovAzMX49sF8Yl58fSCWJ5svSLuaibPxXQJFLmBObTuCr0Mf1KiPopGM9NiFjiYBCbfaa2Fh6breQ6ANVTI0A== +functional-red-black-tree@^1.0.1: + version "1.0.1" + resolved "https://registry.yarnpkg.com/functional-red-black-tree/-/functional-red-black-tree-1.0.1.tgz#1b0ab3bd553b2a0d6399d29c0e3ea0b252078327" + integrity sha1-GwqzvVU7Kg1jmdKcDj6gslIHgyc= + gauge@~2.7.3: version "2.7.4" resolved "https://registry.yarnpkg.com/gauge/-/gauge-2.7.4.tgz#2c03405c7538c39d7eb37b317022e325fb018bf7" @@ -1394,7 +1611,14 @@ getpass@^0.1.1: dependencies: assert-plus "^1.0.0" -glob@^7.1.1, glob@^7.1.2, glob@^7.1.3: +glob-parent@^5.0.0: + version "5.0.0" + resolved "https://registry.yarnpkg.com/glob-parent/-/glob-parent-5.0.0.tgz#1dc99f0f39b006d3e92c2c284068382f0c20e954" + integrity sha512-Z2RwiujPRGluePM6j699ktJYxmPpJKCfpGA13jz2hmFZC7gKetzrWvg5KN3+OsIFmydGyZ1AVwERCq1w/ZZwRg== + dependencies: + is-glob "^4.0.1" + +glob@^7.1.1, glob@^7.1.2, glob@^7.1.3, glob@^7.1.4: version "7.1.4" resolved "https://registry.yarnpkg.com/glob/-/glob-7.1.4.tgz#aa608a2f6c577ad357e1ae5a5c26d9a8d1969255" integrity sha512-hkLPepehmnKk41pUGm3sYxoFs/umurYfYJCerbXEyFIWcAzvpipAgVkBqqT9RBKMGjnq6kMuyYwha6csxbiM1A== @@ -1406,7 +1630,7 @@ glob@^7.1.1, glob@^7.1.2, glob@^7.1.3: once "^1.3.0" path-is-absolute "^1.0.0" -globals@^11.1.0: +globals@^11.1.0, globals@^11.7.0: version "11.12.0" resolved "https://registry.yarnpkg.com/globals/-/globals-11.12.0.tgz#ab8795338868a0babd8525758018c2a7eb95c42e" integrity sha512-WOBp/EEGUiIsJSp7wcv/y6MO+lV9UoncWqxuFfm8eBwzWNgyfBd6Gz+IeKQ9jCmyhoH99g15M3T+QaVHFjizVA== @@ -1519,7 +1743,7 @@ http-signature@~1.2.0: jsprim "^1.2.2" sshpk "^1.7.0" -iconv-lite@0.4.24, iconv-lite@^0.4.4: +iconv-lite@0.4.24, iconv-lite@^0.4.24, iconv-lite@^0.4.4: version "0.4.24" resolved "https://registry.yarnpkg.com/iconv-lite/-/iconv-lite-0.4.24.tgz#2022b4b25fbddc21d2f524974a474aafe733908b" integrity sha512-v3MXnZAcvnywkTUEZomIActle7RXXeedOR31wwl7VlyoXO4Qi9arvSenNQWne1TcRwhCL1HwLI21bEqdpj8/rA== @@ -1533,6 +1757,19 @@ ignore-walk@^3.0.1: dependencies: minimatch "^3.0.4" +ignore@^4.0.6: + version "4.0.6" + resolved "https://registry.yarnpkg.com/ignore/-/ignore-4.0.6.tgz#750e3db5862087b4737ebac8207ffd1ef27b25fc" + integrity sha512-cyFDKrqc/YdcWFniJhzI42+AzS+gNwmUzOSFcRCQYwySuBBBy/KjuxWLZ/FHEH6Moq1NizMOBWyTcv8O4OZIMg== + +import-fresh@^3.0.0: + version "3.1.0" + resolved "https://registry.yarnpkg.com/import-fresh/-/import-fresh-3.1.0.tgz#6d33fa1dcef6df930fae003446f33415af905118" + integrity sha512-PpuksHKGt8rXfWEr9m9EHIpgyyaltBy8+eF6GJM0QCAxMgxCfucMF3mjecK2QsJr0amJW7gTqh5/wht0z2UhEQ== + dependencies: + parent-module "^1.0.0" + resolve-from "^4.0.0" + import-local@^2.0.0: version "2.0.0" resolved "https://registry.yarnpkg.com/import-local/-/import-local-2.0.0.tgz#55070be38a5993cf18ef6db7e961f5bee5c5a09d" @@ -1564,6 +1801,25 @@ ini@~1.3.0: resolved "https://registry.yarnpkg.com/ini/-/ini-1.3.5.tgz#eee25f56db1c9ec6085e0c22778083f596abf927" integrity sha512-RZY5huIKCMRWDUqZlEi72f/lmXKMvuszcMBduliQ3nnWbx9X/ZBQO7DijMEYS9EhHBb2qacRUMtC7svLwe0lcw== +inquirer@^6.4.1: + version "6.5.2" + resolved "https://registry.yarnpkg.com/inquirer/-/inquirer-6.5.2.tgz#ad50942375d036d327ff528c08bd5fab089928ca" + integrity sha512-cntlB5ghuB0iuO65Ovoi8ogLHiWGs/5yNrtUcKjFhSSiVeAIVpD7koaSU9RM8mpXw5YDi9RdYXGQMaOURB7ycQ== + dependencies: + ansi-escapes "^3.2.0" + chalk "^2.4.2" + cli-cursor "^2.1.0" + cli-width "^2.0.0" + external-editor "^3.0.3" + figures "^2.0.0" + lodash "^4.17.12" + mute-stream "0.0.7" + run-async "^2.2.0" + rxjs "^6.4.0" + string-width "^2.1.0" + strip-ansi "^5.1.0" + through "^2.3.6" + invariant@^2.2.4: version "2.2.4" resolved "https://registry.yarnpkg.com/invariant/-/invariant-2.2.4.tgz#610f3c92c9359ce1db616e538008d23ff35158e6" @@ -1656,6 +1912,11 @@ is-extendable@^1.0.1: dependencies: is-plain-object "^2.0.4" +is-extglob@^2.1.1: + version "2.1.1" + resolved "https://registry.yarnpkg.com/is-extglob/-/is-extglob-2.1.1.tgz#a88c02535791f02ed37c76a1b9ea9773c833f8c2" + integrity sha1-qIwCU1eR8C7TfHahueqXc8gz+MI= + is-fullwidth-code-point@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/is-fullwidth-code-point/-/is-fullwidth-code-point-1.0.0.tgz#ef9e31386f031a7f0d643af82fde50c457ef00cb" @@ -1673,6 +1934,13 @@ is-generator-fn@^2.0.0: resolved "https://registry.yarnpkg.com/is-generator-fn/-/is-generator-fn-2.1.0.tgz#7d140adc389aaf3011a8f2a2a4cfa6faadffb118" integrity sha512-cTIB4yPYL/Grw0EaSzASzg6bBy9gqCofvWN8okThAYIxKJZC+udlRAmGbM0XLeniEJSs8uEgHPGuHSe1XsOLSQ== +is-glob@^4.0.0, is-glob@^4.0.1: + version "4.0.1" + resolved "https://registry.yarnpkg.com/is-glob/-/is-glob-4.0.1.tgz#7567dbe9f2f5e2467bc77ab83c4a29482407a5dc" + integrity sha512-5G0tKtBTFImOqDnLB2hG6Bp2qcKEFduo4tZu9MT/H6NQv/ghhy30o55ufafxJ/LdH79LLs2Kfrn85TLKyA7BUg== + dependencies: + is-extglob "^2.1.1" + is-number@^3.0.0: version "3.0.0" resolved "https://registry.yarnpkg.com/is-number/-/is-number-3.0.0.tgz#24fd6201a4782cf50561c810276afc7d12d71195" @@ -1694,6 +1962,11 @@ is-plain-object@^3.0.0: dependencies: isobject "^4.0.0" +is-promise@^2.1.0: + version "2.1.0" + resolved "https://registry.yarnpkg.com/is-promise/-/is-promise-2.1.0.tgz#79a2a9ece7f096e80f36d2b2f3bc16c1ff4bf3fa" + integrity sha1-eaKp7OfwlugPNtKy87wWwf9L8/o= + is-regex@^1.0.4: version "1.0.4" resolved "https://registry.yarnpkg.com/is-regex/-/is-regex-1.0.4.tgz#5517489b547091b0930e095654ced25ee97e9491" @@ -2186,6 +2459,14 @@ jest@^24.9.0: resolved "https://registry.yarnpkg.com/js-tokens/-/js-tokens-4.0.0.tgz#19203fb59991df98e3a287050d4647cdeaf32499" integrity sha512-RdJUflcE3cUzKiMqQgsCu06FPu9UdIJO0beYbPhHN4k6apgJtifcoCtT9bcxOpYBtpD2kCM6Sbzg4CausW/PKQ== +js-yaml@^3.13.1: + version "3.13.1" + resolved "https://registry.yarnpkg.com/js-yaml/-/js-yaml-3.13.1.tgz#aff151b30bfdfa8e49e05da22e7415e9dfa37847" + integrity sha512-YfbcO7jXDdyj0DGxYVSlSeQNHbD7XPWvrVWeVUujrQEoZzWJIRrCPoyk6kL6IAjAG2IolMK4T0hNUe0HOUs5Jw== + dependencies: + argparse "^1.0.7" + esprima "^4.0.0" + jsbn@~0.1.0: version "0.1.1" resolved "https://registry.yarnpkg.com/jsbn/-/jsbn-0.1.1.tgz#a5e654c2e5a2deb5f201d96cefbca80c0ef2f513" @@ -2243,6 +2524,11 @@ json-schema@0.2.3: resolved "https://registry.yarnpkg.com/json-schema/-/json-schema-0.2.3.tgz#b480c892e59a2f05954ce727bd3f2a4e882f9e13" integrity sha1-tIDIkuWaLwWVTOcnvT8qTogvnhM= +json-stable-stringify-without-jsonify@^1.0.1: + version "1.0.1" + resolved "https://registry.yarnpkg.com/json-stable-stringify-without-jsonify/-/json-stable-stringify-without-jsonify-1.0.1.tgz#9db7b59496ad3f3cfef30a75142d2d930ad72651" + integrity sha1-nbe1lJatPzz+8wp1FC0tkwrXJlE= + json-stringify-safe@^5.0.1, json-stringify-safe@~5.0.1: version "5.0.1" resolved "https://registry.yarnpkg.com/json-stringify-safe/-/json-stringify-safe-5.0.1.tgz#1296a2d58fd45f19a0f6ce01d65701e2c735b6eb" @@ -2304,7 +2590,7 @@ leven@^3.1.0: resolved "https://registry.yarnpkg.com/leven/-/leven-3.1.0.tgz#77891de834064cccba82ae7842bb6b14a13ed7f2" integrity sha512-qsda+H8jTaUaN/x5vzW2rzc+8Rw4TAQ/4KjB46IwK5VH+IlVeeeje/EoZRpiXvIqjFgK84QffqPztGI3VBLG1A== -levn@~0.3.0: +levn@^0.3.0, levn@~0.3.0: version "0.3.0" resolved "https://registry.yarnpkg.com/levn/-/levn-0.3.0.tgz#3b09924edf9f083c0490fdd4c0bc4421e04764ee" integrity sha1-OwmSTt+fCDwEkP3UwLxEIeBHZO4= @@ -2358,12 +2644,17 @@ lodash.sortby@^4.7.0: resolved "https://registry.yarnpkg.com/lodash.sortby/-/lodash.sortby-4.7.0.tgz#edd14c824e2cc9c1e0b0a1b42bb5210516a42438" integrity sha1-7dFMgk4sycHgsKG0K7UhBRakJDg= +lodash.unescape@4.0.1: + version "4.0.1" + resolved "https://registry.yarnpkg.com/lodash.unescape/-/lodash.unescape-4.0.1.tgz#bf2249886ce514cda112fae9218cdc065211fc9c" + integrity sha1-vyJJiGzlFM2hEvrpIYzcBlIR/Jw= + lodash.uniq@^4.5.0: version "4.5.0" resolved "https://registry.yarnpkg.com/lodash.uniq/-/lodash.uniq-4.5.0.tgz#d0225373aeb652adc1bc82e4945339a842754773" integrity sha1-0CJTc662Uq3BvILklFM5qEJ1R3M= -lodash@^4.17.11, lodash@^4.17.13: +lodash@^4.17.11, lodash@^4.17.12, lodash@^4.17.13, lodash@^4.17.14: version "4.17.15" resolved "https://registry.yarnpkg.com/lodash/-/lodash-4.17.15.tgz#b447f6670a0455bbfeedd11392eff330ea097548" integrity sha512-8xOcRHvCjnocdS5cpwXQXVzmmh5e5+saE2QGoeQmbKmRS6J3VQppPOIt0MnmE+4xlZoumy0GPG0D0MVIQbNA1A== @@ -2448,6 +2739,11 @@ mime-types@^2.1.12, mime-types@~2.1.19: dependencies: mime-db "1.40.0" +mimic-fn@^1.0.0: + version "1.2.0" + resolved "https://registry.yarnpkg.com/mimic-fn/-/mimic-fn-1.2.0.tgz#820c86a39334640e99516928bd03fca88057d022" + integrity sha512-jf84uxzwiuiIVKiOLpfYk7N46TSy8ubTonmneY9vrpHNAnp0QBt2BxWV9dO3/j+BoVAb+a5G6YDPW3M5HOdMWQ== + minimatch@^3.0.4: version "3.0.4" resolved "https://registry.yarnpkg.com/minimatch/-/minimatch-3.0.4.tgz#5166e286457f03306064be5497e8dbb0c3d32083" @@ -2510,6 +2806,11 @@ ms@^2.1.1: resolved "https://registry.yarnpkg.com/ms/-/ms-2.1.2.tgz#d09d1f357b443f493382a8eb3ccd183872ae6009" integrity sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w== +mute-stream@0.0.7: + version "0.0.7" + resolved "https://registry.yarnpkg.com/mute-stream/-/mute-stream-0.0.7.tgz#3075ce93bc21b8fab43e1bc4da7e8115ed1e7bab" + integrity sha1-MHXOk7whuPq0PhvE2n6BFe0ee6s= + nan@^2.12.1: version "2.14.0" resolved "https://registry.yarnpkg.com/nan/-/nan-2.14.0.tgz#7818f722027b2459a86f0295d434d1fc2336c52c" @@ -2733,6 +3034,13 @@ once@^1.3.0, once@^1.3.1, once@^1.4.0: dependencies: wrappy "1" +onetime@^2.0.0: + version "2.0.1" + resolved "https://registry.yarnpkg.com/onetime/-/onetime-2.0.1.tgz#067428230fd67443b2794b22bba528b6867962d4" + integrity sha1-BnQoIw/WdEOyeUsiu6UotoZ5YtQ= + dependencies: + mimic-fn "^1.0.0" + optimist@^0.6.1: version "0.6.1" resolved "https://registry.yarnpkg.com/optimist/-/optimist-0.6.1.tgz#da3ea74686fa21a19a111c326e90eb15a0196686" @@ -2741,7 +3049,7 @@ optimist@^0.6.1: minimist "~0.0.1" wordwrap "~0.0.2" -optionator@^0.8.1: +optionator@^0.8.1, optionator@^0.8.2: version "0.8.2" resolved "https://registry.yarnpkg.com/optionator/-/optionator-0.8.2.tgz#364c5e409d3f4d6301d6c0b4c05bba50180aeb64" integrity sha1-NkxeQJ0/TWMB1sC0wFu6UBgK62Q= @@ -2766,7 +3074,7 @@ os-name@^3.0.0: macos-release "^2.2.0" windows-release "^3.1.0" -os-tmpdir@^1.0.0: +os-tmpdir@^1.0.0, os-tmpdir@~1.0.2: version "1.0.2" resolved "https://registry.yarnpkg.com/os-tmpdir/-/os-tmpdir-1.0.2.tgz#bbe67406c79aa85c5cfec766fe5734555dfa1274" integrity sha1-u+Z0BseaqFxc/sdm/lc0VV36EnQ= @@ -2834,6 +3142,13 @@ p-try@^2.0.0: resolved "https://registry.yarnpkg.com/p-try/-/p-try-2.2.0.tgz#cb2868540e313d61de58fafbe35ce9004d5540e6" integrity sha512-R4nPAVTAU0B9D35/Gk3uJf/7XYbQcyohSKdvAxIRSNghFl4e71hVoGnBNQz9cWaXxO2I10KTC+3jMdvvoKw6dQ== +parent-module@^1.0.0: + version "1.0.1" + resolved "https://registry.yarnpkg.com/parent-module/-/parent-module-1.0.1.tgz#691d2709e78c79fae3a156622452d00762caaaa2" + integrity sha512-GQ2EWRpQV8/o+Aw8YqtfZZPfNRWZYkbidE9k5rpl/hC3vtHHBfGm2Ifi6qWV+coDGkrUKZAxE3Lot5kcsRlh+g== + dependencies: + callsites "^3.0.0" + parse-json@^4.0.0: version "4.0.0" resolved "https://registry.yarnpkg.com/parse-json/-/parse-json-4.0.0.tgz#be35f5425be1f7f6c747184f98a788cb99477ee0" @@ -2951,6 +3266,11 @@ process-nextick-args@~2.0.0: resolved "https://registry.yarnpkg.com/process-nextick-args/-/process-nextick-args-2.0.1.tgz#7820d9b16120cc55ca9ae7792680ae7dba6d7fe2" integrity sha512-3ouUOpQhtgrbOa17J7+uxOTpITYWaGP7/AhoR3+A+/1e9skrzelGi/dXzEYyvbxubEF6Wn2ypscTKiKJFFn1ag== +progress@^2.0.0: + version "2.0.3" + resolved "https://registry.yarnpkg.com/progress/-/progress-2.0.3.tgz#7e8cf8d8f5b8f239c1bc68beb4eb78567d572ef8" + integrity sha512-7PiHtLll5LdnKIMw100I+8xJXR5gW2QwWYkT6iJva0bXitZKa/XMrSbdmg3r2Xnaidz9Qumd0VPaMrZlF9V9sA== + prompts@^2.0.1: version "2.2.1" resolved "https://registry.yarnpkg.com/prompts/-/prompts-2.2.1.tgz#f901dd2a2dfee080359c0e20059b24188d75ad35" @@ -3052,6 +3372,11 @@ regex-not@^1.0.0, regex-not@^1.0.2: extend-shallow "^3.0.2" safe-regex "^1.1.0" +regexpp@^2.0.1: + version "2.0.1" + resolved "https://registry.yarnpkg.com/regexpp/-/regexpp-2.0.1.tgz#8d19d31cf632482b589049f8281f93dbcba4d07f" + integrity sha512-lv0M6+TkDVniA3aD1Eg0DVpfU/booSu7Eev3TDO/mZKHBfVjgCGTV4t4buppESEYDtkArYFOxTJWv6S5C+iaNw== + remove-trailing-separator@^1.0.1: version "1.1.0" resolved "https://registry.yarnpkg.com/remove-trailing-separator/-/remove-trailing-separator-1.1.0.tgz#c24bce2a283adad5bc3f58e0d48249b92379d8ef" @@ -3131,6 +3456,11 @@ resolve-from@^3.0.0: resolved "https://registry.yarnpkg.com/resolve-from/-/resolve-from-3.0.0.tgz#b22c7af7d9d6881bc8b6e653335eebcb0a188748" integrity sha1-six699nWiBvItuZTM17rywoYh0g= +resolve-from@^4.0.0: + version "4.0.0" + resolved "https://registry.yarnpkg.com/resolve-from/-/resolve-from-4.0.0.tgz#4abcd852ad32dd7baabfe9b40e00a36db5f392e6" + integrity sha512-pb/MYmXstAkysRFx8piNI1tGFNQIFA3vkE3Gq4EuA1dF6gHp/+vgZqsCGJapvy8N3Q+4o7FwvquPJcnZ7RYy4g== + resolve-url@^0.2.1: version "0.2.1" resolved "https://registry.yarnpkg.com/resolve-url/-/resolve-url-0.2.1.tgz#2c637fe77c893afd2a663fe21aa9080068e2052a" @@ -3148,11 +3478,26 @@ resolve@1.x, resolve@^1.10.0, resolve@^1.3.2: dependencies: path-parse "^1.0.6" +restore-cursor@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/restore-cursor/-/restore-cursor-2.0.0.tgz#9f7ee287f82fd326d4fd162923d62129eee0dfaf" + integrity sha1-n37ih/gv0ybU/RYpI9YhKe7g368= + dependencies: + onetime "^2.0.0" + signal-exit "^3.0.2" + ret@~0.1.10: version "0.1.15" resolved "https://registry.yarnpkg.com/ret/-/ret-0.1.15.tgz#b8a4825d5bdb1fc3f6f53c2bc33f81388681c7bc" integrity sha512-TTlYpa+OL+vMMNG24xSlQGEJ3B/RzEfUlLct7b5G/ytav+wPrplCpVMFuwzXbkecJrb6IYo1iFb0S9v37754mg== +rimraf@2.6.3: + version "2.6.3" + resolved "https://registry.yarnpkg.com/rimraf/-/rimraf-2.6.3.tgz#b2d104fe0d8fb27cf9e0a1cda8262dd3833c6cab" + integrity sha512-mwqeW5XsA2qAejG46gYdENaxXjx9onRNCfn7L0duuP4hCuTIi/QO7PDK07KJfp1d+izWPrzEJDcSqBa0OZQriA== + dependencies: + glob "^7.1.3" + rimraf@^2.5.4, rimraf@^2.6.1, rimraf@^2.6.3: version "2.7.1" resolved "https://registry.yarnpkg.com/rimraf/-/rimraf-2.7.1.tgz#35797f13a7fdadc566142c29d4f07ccad483e3ec" @@ -3165,6 +3510,20 @@ rsvp@^4.8.4: resolved "https://registry.yarnpkg.com/rsvp/-/rsvp-4.8.5.tgz#c8f155311d167f68f21e168df71ec5b083113734" integrity sha512-nfMOlASu9OnRJo1mbEk2cz0D56a1MBNrJ7orjRZQG10XDyuvwksKbuXNp6qa+kbn839HwjwhBzhFmdsaEAfauA== +run-async@^2.2.0: + version "2.3.0" + resolved "https://registry.yarnpkg.com/run-async/-/run-async-2.3.0.tgz#0371ab4ae0bdd720d4166d7dfda64ff7a445a6c0" + integrity sha1-A3GrSuC91yDUFm19/aZP96RFpsA= + dependencies: + is-promise "^2.1.0" + +rxjs@^6.4.0: + version "6.5.3" + resolved "https://registry.yarnpkg.com/rxjs/-/rxjs-6.5.3.tgz#510e26317f4db91a7eb1de77d9dd9ba0a4899a3a" + integrity sha512-wuYsAYYFdWTAnAaPoKGNhfpWwKZbJW+HgAJ+mImp+Epl7BG8oNWBCTyRM8gba9k4lk8BgWdoYm21Mo/RYhhbgA== + dependencies: + tslib "^1.9.0" + safe-buffer@^5.0.1, safe-buffer@^5.1.2: version "5.2.0" resolved "https://registry.yarnpkg.com/safe-buffer/-/safe-buffer-5.2.0.tgz#b74daec49b1148f88c64b68d49b1e815c1f2f519" @@ -3212,7 +3571,7 @@ sax@^1.2.4: resolved "https://registry.yarnpkg.com/semver/-/semver-5.7.1.tgz#a954f931aeba508d307bbf069eff0c01c96116f7" integrity sha512-sauaDf/PZdVgrLTNYHRtpXa1iRiKcaebiKQ1BJdpQlWH2lCvexQdX55snPFyK7QzpudqbCI0qXFfOasHdyNDGQ== -semver@^6.0.0, semver@^6.2.0: +semver@^6.0.0, semver@^6.1.2, semver@^6.2.0, semver@^6.3.0: version "6.3.0" resolved "https://registry.yarnpkg.com/semver/-/semver-6.3.0.tgz#ee0a64c8af5e8ceea67687b133761e1becbd1d3d" integrity sha512-b39TBaTSfV6yBrapU89p5fKekE2m/NwnDocOVruQFS1/veMgdzuPcnOM34M6CwxW8jH/lxEa5rBoDeUwu5HHTw== @@ -3273,6 +3632,15 @@ slash@^2.0.0: resolved "https://registry.yarnpkg.com/slash/-/slash-2.0.0.tgz#de552851a1759df3a8f206535442f5ec4ddeab44" integrity sha512-ZYKh3Wh2z1PpEXWr0MpSBZ0V6mZHAQfYevttO11c51CaWjGTaadiKZ+wVt1PbMlDV5qhMFslpZCemhwOK7C89A== +slice-ansi@^2.1.0: + version "2.1.0" + resolved "https://registry.yarnpkg.com/slice-ansi/-/slice-ansi-2.1.0.tgz#cacd7693461a637a5788d92a7dd4fba068e81636" + integrity sha512-Qu+VC3EwYLldKa1fCxuuvULvSJOKEgk9pi8dZeCVK7TqBfUNTH4sFkk4joj8afVSfAYgJoSOetjx9QWOJ5mYoQ== + dependencies: + ansi-styles "^3.2.0" + astral-regex "^1.0.0" + is-fullwidth-code-point "^2.0.0" + snapdragon-node@^2.0.1: version "2.1.1" resolved "https://registry.yarnpkg.com/snapdragon-node/-/snapdragon-node-2.1.1.tgz#6c175f86ff14bdb0724563e8f3c1b021a286853b" @@ -3370,6 +3738,11 @@ split-string@^3.0.1, split-string@^3.0.2: dependencies: extend-shallow "^3.0.0" +sprintf-js@~1.0.2: + version "1.0.3" + resolved "https://registry.yarnpkg.com/sprintf-js/-/sprintf-js-1.0.3.tgz#04e6926f662895354f3dd015203633b857297e2c" + integrity sha1-BOaSb2YolTVPPdAVIDYzuFcpfiw= + sshpk@^1.7.0: version "1.16.1" resolved "https://registry.yarnpkg.com/sshpk/-/sshpk-1.16.1.tgz#fb661c0bef29b39db40769ee39fa70093d6f6877" @@ -3420,7 +3793,7 @@ string-width@^1.0.1: is-fullwidth-code-point "^1.0.0" strip-ansi "^3.0.0" -"string-width@^1.0.2 || 2": +"string-width@^1.0.2 || 2", string-width@^2.1.0: version "2.1.1" resolved "https://registry.yarnpkg.com/string-width/-/string-width-2.1.1.tgz#ab93f27a8dc13d28cac815c462143a6d9012ae9e" integrity sha512-nOqH59deCq9SRHlxq1Aw85Jnt4w6KvLKqWVik6oA9ZklXLNIOlqg4F2yrT1MVaTjAqvVwdfeZ7w7aCvJD7ugkw== @@ -3475,6 +3848,11 @@ strip-eof@^1.0.0: resolved "https://registry.yarnpkg.com/strip-eof/-/strip-eof-1.0.0.tgz#bb43ff5598a6eb05d89b59fcd129c983313606bf" integrity sha1-u0P/VZim6wXYm1n80SnJgzE2Br8= +strip-json-comments@^3.0.1: + version "3.0.1" + resolved "https://registry.yarnpkg.com/strip-json-comments/-/strip-json-comments-3.0.1.tgz#85713975a91fb87bf1b305cca77395e40d2a64a7" + integrity sha512-VTyMAUfdm047mwKl+u79WIdrZxtFtn+nBxHeb844XBQ9uMNTuTHdx2hc5RiAJYqwTj3wc/xe5HLSdJSkJ+WfZw== + strip-json-comments@~2.0.1: version "2.0.1" resolved "https://registry.yarnpkg.com/strip-json-comments/-/strip-json-comments-2.0.1.tgz#3c531942e908c2697c0ec344858c286c7ca0a60a" @@ -3499,6 +3877,16 @@ symbol-tree@^3.2.2: resolved "https://registry.yarnpkg.com/symbol-tree/-/symbol-tree-3.2.4.tgz#430637d248ba77e078883951fb9aa0eed7c63fa2" integrity sha512-9QNk5KwDF+Bvz+PyObkmSYjI5ksVUYtjW7AU22r2NKcfLJcXp96hkDWU3+XndOsUb+AQ9QhfzfCT2O+CNWT5Tw== +table@^5.2.3: + version "5.4.6" + resolved "https://registry.yarnpkg.com/table/-/table-5.4.6.tgz#1292d19500ce3f86053b05f0e8e7e4a3bb21079e" + integrity sha512-wmEc8m4fjnob4gt5riFRtTu/6+4rSe12TpAELNSqHMfF3IqnA+CH37USM6/YR3qRZv7e56kAEAtd6nKZaxe0Ug== + dependencies: + ajv "^6.10.2" + lodash "^4.17.14" + slice-ansi "^2.1.0" + string-width "^3.0.0" + tar@^4: version "4.4.10" resolved "https://registry.yarnpkg.com/tar/-/tar-4.4.10.tgz#946b2810b9a5e0b26140cf78bea6b0b0d689eba1" @@ -3522,11 +3910,28 @@ test-exclude@^5.2.3: read-pkg-up "^4.0.0" require-main-filename "^2.0.0" +text-table@^0.2.0: + version "0.2.0" + resolved "https://registry.yarnpkg.com/text-table/-/text-table-0.2.0.tgz#7f5ee823ae805207c00af2df4a84ec3fcfa570b4" + integrity sha1-f17oI66AUgfACvLfSoTsP8+lcLQ= + throat@^4.0.0: version "4.1.0" resolved "https://registry.yarnpkg.com/throat/-/throat-4.1.0.tgz#89037cbc92c56ab18926e6ba4cbb200e15672a6a" integrity sha1-iQN8vJLFarGJJua6TLsgDhVnKmo= +through@^2.3.6: + version "2.3.8" + resolved "https://registry.yarnpkg.com/through/-/through-2.3.8.tgz#0dd4c9ffaabc357960b1b724115d7e0e86a2e1f5" + integrity sha1-DdTJ/6q8NXlgsbckEV1+Doai4fU= + +tmp@^0.0.33: + version "0.0.33" + resolved "https://registry.yarnpkg.com/tmp/-/tmp-0.0.33.tgz#6d34335889768d21b2bcda0aa277ced3b1bfadf9" + integrity sha512-jRCJlojKnZ3addtTOjdIqoRuPEKBvNXcGYqzO6zWZX8KfKEpnGY5jfggJQ3EjKuu8D4bJRr0y+cYJFmYbImXGw== + dependencies: + os-tmpdir "~1.0.2" + tmpl@1.0.x: version "1.0.4" resolved "https://registry.yarnpkg.com/tmpl/-/tmpl-1.0.4.tgz#23640dd7b42d00433911140820e5cf440e521dd1" @@ -3606,6 +4011,18 @@ ts-jest@^24.1.0: semver "^5.5" yargs-parser "10.x" +tslib@^1.8.1, tslib@^1.9.0: + version "1.10.0" + resolved "https://registry.yarnpkg.com/tslib/-/tslib-1.10.0.tgz#c3c19f95973fb0a62973fb09d90d961ee43e5c8a" + integrity sha512-qOebF53frne81cf0S9B41ByenJ3/IuH8yJKngAX35CmiZySA0khhkovshKK+jGCaMnVomla7gVlIcc3EvKPbTQ== + +tsutils@^3.17.1: + version "3.17.1" + resolved "https://registry.yarnpkg.com/tsutils/-/tsutils-3.17.1.tgz#ed719917f11ca0dee586272b2ac49e015a2dd759" + integrity sha512-kzeQ5B8H3w60nFY2g8cJIuH7JDpsALXySGtwGJ0p2LSjLgay3NdIpqq5SoOBe46bKDW2iq25irHCr8wjomUS2g== + dependencies: + tslib "^1.8.1" + tunnel-agent@^0.6.0: version "0.6.0" resolved "https://registry.yarnpkg.com/tunnel-agent/-/tunnel-agent-0.6.0.tgz#27a5dea06b36b04a0a9966774b290868f0fc40fd" @@ -3715,6 +4132,11 @@ uuid@^3.3.2: resolved "https://registry.yarnpkg.com/uuid/-/uuid-3.3.3.tgz#4568f0216e78760ee1dbf3a4d2cf53e224112866" integrity sha512-pW0No1RGHgzlpHJO1nsVrHKpOEIxkGg1xB+v0ZmdNH5OAeAwzAVrCnI2/6Mtx+Uys6iaylxa+D3g4j63IKKjSQ== +v8-compile-cache@^2.0.3: + version "2.1.0" + resolved "https://registry.yarnpkg.com/v8-compile-cache/-/v8-compile-cache-2.1.0.tgz#e14de37b31a6d194f5690d67efc4e7f6fc6ab30e" + integrity sha512-usZBT3PW+LOjM25wbqIlZwPeJV+3OSz3M1k1Ws8snlW39dZyYL9lOGC5FgPVHfk0jKmjiDV8Z0mIbVQPiwFs7g== + validate-npm-package-license@^3.0.1: version "3.0.4" resolved "https://registry.yarnpkg.com/validate-npm-package-license/-/validate-npm-package-license-3.0.4.tgz#fc91f6b9c7ba15c857f4cb2c5defeec39d4f410a" @@ -3840,6 +4262,13 @@ write-file-atomic@2.4.1: imurmurhash "^0.1.4" signal-exit "^3.0.2" +write@1.0.3: + version "1.0.3" + resolved "https://registry.yarnpkg.com/write/-/write-1.0.3.tgz#0800e14523b923a387e415123c865616aae0f5c3" + integrity sha512-/lg70HAjtkUgWPVZhZcm+T4hkL8Zbtp1nFNOn3lRrxnlv50SRBv7cR7RqR+GMsd3hUXy9hWBo4CHTbFTcOYwig== + dependencies: + mkdirp "^0.5.1" + ws@^5.2.0: version "5.2.2" resolved "https://registry.yarnpkg.com/ws/-/ws-5.2.2.tgz#dffef14866b8e8dc9133582514d1befaf96e980f" From 460797e9d4493a810a64ae929e85a4fd6583b47c Mon Sep 17 00:00:00 2001 From: Technote Date: Mon, 16 Sep 2019 00:52:15 +0900 Subject: [PATCH 08/11] feat: supress error (#26) fix: eslint (#31) --- .../fixtures/repos.issues.assignees.403.json | 4 + __tests__/util.ts | 73 +++--- __tests__/utils/context.test.ts | 245 +++++++++--------- __tests__/utils/github.test.ts | 206 +++++++++------ __tests__/utils/misc.test.ts | 115 ++++---- jest.config.js | 13 +- jest.setup.ts | 18 ++ src/constant.ts | 8 +- src/main.ts | 59 +++-- src/utils/context.ts | 56 ++-- src/utils/github.ts | 56 ++-- src/utils/misc.ts | 36 +-- 12 files changed, 496 insertions(+), 393 deletions(-) create mode 100644 __tests__/fixtures/repos.issues.assignees.403.json create mode 100644 jest.setup.ts diff --git a/__tests__/fixtures/repos.issues.assignees.403.json b/__tests__/fixtures/repos.issues.assignees.403.json new file mode 100644 index 00000000..933be1d8 --- /dev/null +++ b/__tests__/fixtures/repos.issues.assignees.403.json @@ -0,0 +1,4 @@ +{ + "message": "Resource not accessible by integration", + "documentation_url": "https://developer.github.com/v3" +} \ No newline at end of file diff --git a/__tests__/util.ts b/__tests__/util.ts index 69a428e1..83cb2aef 100644 --- a/__tests__/util.ts +++ b/__tests__/util.ts @@ -1,36 +1,37 @@ -const fs = require('fs'); -const path = require('path'); - -export const getContext = (override: object) => Object.assign({ - payload: { - action: '', - }, - eventName: '', - sha: '', - ref: '', - workflow: '', - action: '', - actor: '', - issue: { - owner: '', - repo: '', - number: 1, - }, - repo: { - owner: '', - repo: '', - }, -}, override); - -export const getApiFixture = (name: string) => JSON.parse(fs.readFileSync(path.resolve(__dirname, `./fixtures/${name}.json`))); - -export const disableNetConnect = nock => { - beforeEach(() => { - nock.disableNetConnect(); - }); - - afterEach(() => { - nock.cleanAll(); - nock.enableNetConnect(); - }); -}; +import { Context } from '@actions/github/lib/context'; +import * as fs from 'fs'; +import * as path from 'path'; + +export const getContext = (override: object): Context => Object.assign({ + payload: { + action: '', + }, + eventName: '', + sha: '', + ref: '', + workflow: '', + action: '', + actor: '', + issue: { + owner: '', + repo: '', + number: 1, + }, + repo: { + owner: '', + repo: '', + }, +}, override); + +export const getApiFixture = (name: string): object => JSON.parse(fs.readFileSync(path.resolve(__dirname, `./fixtures/${name}.json`)).toString()); + +export const disableNetConnect = (nock): void => { + beforeEach(() => { + nock.disableNetConnect(); + }); + + afterEach(() => { + nock.cleanAll(); + nock.enableNetConnect(); + }); +}; diff --git a/__tests__/utils/context.test.ts b/__tests__/utils/context.test.ts index ad4a2eb1..77185644 100644 --- a/__tests__/utils/context.test.ts +++ b/__tests__/utils/context.test.ts @@ -1,122 +1,123 @@ -import {getAssignees} from '../../src/utils/context'; -import {getContext} from '../util'; - -describe('getAssignees', () => { - it('should get issue assignees', () => { - expect(getAssignees(getContext({ - eventName: 'issues', - payload: { - sender: { - type: 'User', - login: 'test', - }, - issue: { - assignees: [], - }, - }, - }))).toEqual(['test']); - }); - - it('should get PR assignees', () => { - expect(getAssignees(getContext({ - eventName: 'pull_request', - payload: { - sender: { - type: 'User', - login: 'test', - }, - pull_request: { - assignees: [], - }, - }, - }))).toEqual(['test']); - }); - - it('should empty 1', () => { - expect(getAssignees(getContext({ - eventName: 'issues', - payload: { - sender: { - type: 'User', - login: 'test', - }, - issue: { - assignees: [ - {login: 'test'}, - {login: 'test2'}, - ], - }, - }, - }))).toEqual([]); - }); - - it('should empty 2', () => { - expect(getAssignees(getContext({ - eventName: 'pull_request', - payload: { - sender: { - type: 'User', - login: 'test', - }, - pull_request: { - assignees: [ - {login: 'test'}, - {login: 'test2'}, - ], - }, - }, - }))).toEqual([]); - }); - - it('should return false 1', () => { - expect(getAssignees(getContext({ - eventName: 'issues', - payload: { - issue: { - assignees: [], - }, - }, - }))).toBeFalsy(); - }); - - it('should return false 2', () => { - expect(getAssignees(getContext({ - eventName: 'issues', - payload: { - sender: { - type: 'User', - login: 'test', - }, - issue: {}, - }, - }))).toBeFalsy(); - }); - - it('should return false 3', () => { - expect(getAssignees(getContext({ - eventName: 'pull_request', - payload: { - sender: { - type: 'User', - login: 'test', - }, - pull_request: {}, - }, - }))).toBeFalsy(); - }); - - it('should return false 4', () => { - expect(getAssignees(getContext({ - eventName: 'push', - payload: { - sender: { - type: 'User', - login: 'test', - }, - issue: { - assignees: [], - }, - }, - }))).toBeFalsy(); - }); -}); +/* eslint-disable no-magic-numbers */ +import { getAssignees } from '../../src/utils/context'; +import { getContext } from '../util'; + +describe('getAssignees', () => { + it('should get issue assignees', () => { + expect(getAssignees(getContext({ + eventName: 'issues', + payload: { + sender: { + type: 'User', + login: 'test', + }, + issue: { + assignees: [], + }, + }, + }))).toEqual(['test']); + }); + + it('should get PR assignees', () => { + expect(getAssignees(getContext({ + eventName: 'pull_request', + payload: { + sender: { + type: 'User', + login: 'test', + }, + 'pull_request': { + assignees: [], + }, + }, + }))).toEqual(['test']); + }); + + it('should empty 1', () => { + expect(getAssignees(getContext({ + eventName: 'issues', + payload: { + sender: { + type: 'User', + login: 'test', + }, + issue: { + assignees: [ + {login: 'test'}, + {login: 'test2'}, + ], + }, + }, + }))).toEqual([]); + }); + + it('should empty 2', () => { + expect(getAssignees(getContext({ + eventName: 'pull_request', + payload: { + sender: { + type: 'User', + login: 'test', + }, + 'pull_request': { + assignees: [ + {login: 'test'}, + {login: 'test2'}, + ], + }, + }, + }))).toEqual([]); + }); + + it('should return false 1', () => { + expect(getAssignees(getContext({ + eventName: 'issues', + payload: { + issue: { + assignees: [], + }, + }, + }))).toBeFalsy(); + }); + + it('should return false 2', () => { + expect(getAssignees(getContext({ + eventName: 'issues', + payload: { + sender: { + type: 'User', + login: 'test', + }, + issue: {}, + }, + }))).toBeFalsy(); + }); + + it('should return false 3', () => { + expect(getAssignees(getContext({ + eventName: 'pull_request', + payload: { + sender: { + type: 'User', + login: 'test', + }, + 'pull_request': {}, + }, + }))).toBeFalsy(); + }); + + it('should return false 4', () => { + expect(getAssignees(getContext({ + eventName: 'push', + payload: { + sender: { + type: 'User', + login: 'test', + }, + issue: { + assignees: [], + }, + }, + }))).toBeFalsy(); + }); +}); diff --git a/__tests__/utils/github.test.ts b/__tests__/utils/github.test.ts index 7d2f0c28..6a63fb09 100644 --- a/__tests__/utils/github.test.ts +++ b/__tests__/utils/github.test.ts @@ -1,74 +1,132 @@ -import nock from 'nock'; -import {GitHub} from '@actions/github' ; -import {addAssignees} from '../../src/utils/github'; -import {disableNetConnect, getApiFixture, getContext} from '../util'; - -describe('addAssignees', () => { - disableNetConnect(nock); - - it('should do nothing 1', async () => { - const fn = jest.fn(); - nock('https://api.github.com') - .post('/repos/hello/world/issues/1/assignees') - .reply(200, (uri, body) => { - fn(); - return body; - }); - - await addAssignees(false, new GitHub(''), getContext({ - repo: { - owner: 'hello', - repo: 'world', - }, - })); - - expect(fn).not.toBeCalled(); - }); - - it('should do nothing 2', async () => { - const fn = jest.fn(); - nock('https://api.github.com') - .post('/repos/hello/world/issues/1/assignees') - .reply(200, (uri, body) => { - fn(); - return body; - }); - - await addAssignees([], new GitHub(''), getContext({ - repo: { - owner: 'hello', - repo: 'world', - }, - })); - - expect(fn).not.toBeCalled(); - }); - - it('should add assignees', async () => { - const fn1 = jest.fn(); - const fn2 = jest.fn(); - nock('https://api.github.com') - .post('/repos/hello/world/issues/1/assignees', body => { - fn1(); - expect(body).toHaveProperty('assignees'); - expect(body.assignees).toEqual(['test']); - return body; - }) - .reply(201, () => { - fn2(); - return getApiFixture('repos.issues.assignees'); - }); - - await addAssignees([ - 'test', - ], new GitHub(''), getContext({ - repo: { - owner: 'hello', - repo: 'world', - }, - })); - - expect(fn1).toBeCalledTimes(1); - expect(fn2).toBeCalledTimes(1); - }); -}); +/* eslint-disable no-magic-numbers */ +import nock from 'nock'; +import { GitHub } from '@actions/github' ; +import { addAssignees } from '../../src/utils/github'; +import { disableNetConnect, getApiFixture, getContext } from '../util'; + +describe('addAssignees', () => { + disableNetConnect(nock); + + it('should do nothing 1', async() => { + const fn = jest.fn(); + nock('https://api.github.com') + .post('/repos/hello/world/issues/1/assignees') + .reply(200, (uri, body) => { + fn(); + return body; + }); + + await addAssignees(false, new GitHub(''), getContext({ + repo: { + owner: 'hello', + repo: 'world', + }, + })); + + expect(fn).not.toBeCalled(); + }); + + it('should do nothing 2', async() => { + const fn = jest.fn(); + nock('https://api.github.com') + .post('/repos/hello/world/issues/1/assignees') + .reply(200, (uri, body) => { + fn(); + return body; + }); + + await addAssignees([], new GitHub(''), getContext({ + repo: { + owner: 'hello', + repo: 'world', + }, + })); + + expect(fn).not.toBeCalled(); + }); + + it('should do nothing 3', async() => { + const fn1 = jest.fn(); + const fn2 = jest.fn(); + nock('https://api.github.com') + .post('/repos/hello/world/issues/1/assignees', body => { + fn1(); + expect(body).toHaveProperty('assignees'); + expect(body.assignees).toEqual(['test']); + return body; + }) + .reply(403, () => { + fn2(); + return getApiFixture('repos.issues.assignees.403'); + }); + const warnCount = global.mockSignale.warn.mock.calls.length; + + await addAssignees([ + 'test', + ], new GitHub(''), getContext({ + repo: { + owner: 'hello', + repo: 'world', + }, + })); + + expect(fn1).toBeCalledTimes(1); + expect(fn2).toBeCalledTimes(1); + expect(global.mockSignale.warn.mock.calls.length).toBe(warnCount + 1); + }); + + it('should do nothing 4', async() => { + const fn = jest.fn(); + nock('https://api.github.com') + .post('/repos/hello/world/issues/1/assignees', body => { + fn(); + expect(body).toHaveProperty('assignees'); + expect(body.assignees).toEqual(['test']); + return body; + }) + .reply(500, () => { + throw new Error('test'); + }); + const warnCount = global.mockSignale.warn.mock.calls.length; + + await expect(addAssignees([ + 'test', + ], new GitHub(''), getContext({ + repo: { + owner: 'hello', + repo: 'world', + }, + }))).rejects.toThrow(new Error('test')); + + expect(fn).toBeCalledTimes(1); + expect(global.mockSignale.warn.mock.calls.length).toBe(warnCount); + }); + + it('should add assignees', async() => { + const fn1 = jest.fn(); + const fn2 = jest.fn(); + nock('https://api.github.com') + .post('/repos/hello/world/issues/1/assignees', body => { + fn1(); + expect(body).toHaveProperty('assignees'); + expect(body.assignees).toEqual(['test']); + return body; + }) + .reply(201, () => { + fn2(); + return getApiFixture('repos.issues.assignees'); + }); + + await addAssignees([ + 'test', + ], new GitHub(''), getContext({ + repo: { + owner: 'hello', + repo: 'world', + }, + })); + + expect(fn1).toBeCalledTimes(1); + expect(fn2).toBeCalledTimes(1); + }); +}); diff --git a/__tests__/utils/misc.test.ts b/__tests__/utils/misc.test.ts index 92f5c7d0..2a475f5f 100644 --- a/__tests__/utils/misc.test.ts +++ b/__tests__/utils/misc.test.ts @@ -1,57 +1,58 @@ -import path from 'path'; -import {getContext} from '../util'; -import { - isTargetEvent, - getBuildVersion, -} from '../../src/utils/misc'; - -describe('isTargetEvent', () => { - it('should return true 1', () => { - expect(isTargetEvent(getContext({ - payload: { - action: 'opened', - }, - eventName: 'issues', - }))).toBeTruthy(); - }); - it('should return true 2', () => { - expect(isTargetEvent(getContext({ - payload: { - action: 'opened', - }, - eventName: 'pull_request', - }))).toBeTruthy(); - }); - - it('should return false 1', () => { - expect(isTargetEvent(getContext({ - payload: { - action: 'opened', - }, - eventName: 'push', - }))).toBeFalsy(); - }); - - it('should return false 2', () => { - expect(isTargetEvent(getContext({ - payload: { - action: 'closed', - }, - eventName: 'issues', - }))).toBeFalsy(); - }); -}); - -describe('getBuildVersion', () => { - it('should get build version', () => { - expect(getBuildVersion(path.resolve(__dirname, '..', 'fixtures', 'build1.json'))).toBe('v1.2.3'); - }); - - it('should return false 1', () => { - expect(getBuildVersion(path.resolve(__dirname, '..', 'fixtures', 'build2.json'))).toBeFalsy(); - }); - - it('should return false 2', () => { - expect(getBuildVersion(path.resolve(__dirname, '..', 'fixtures', 'build.test.json'))).toBeFalsy(); - }); -}); +/* eslint-disable no-magic-numbers */ +import path from 'path'; +import { getContext } from '../util'; +import { + isTargetEvent, + getBuildVersion, +} from '../../src/utils/misc'; + +describe('isTargetEvent', () => { + it('should return true 1', () => { + expect(isTargetEvent(getContext({ + payload: { + action: 'opened', + }, + eventName: 'issues', + }))).toBeTruthy(); + }); + it('should return true 2', () => { + expect(isTargetEvent(getContext({ + payload: { + action: 'opened', + }, + eventName: 'pull_request', + }))).toBeTruthy(); + }); + + it('should return false 1', () => { + expect(isTargetEvent(getContext({ + payload: { + action: 'opened', + }, + eventName: 'push', + }))).toBeFalsy(); + }); + + it('should return false 2', () => { + expect(isTargetEvent(getContext({ + payload: { + action: 'closed', + }, + eventName: 'issues', + }))).toBeFalsy(); + }); +}); + +describe('getBuildVersion', () => { + it('should get build version', () => { + expect(getBuildVersion(path.resolve(__dirname, '..', 'fixtures', 'build1.json'))).toBe('v1.2.3'); + }); + + it('should return false 1', () => { + expect(getBuildVersion(path.resolve(__dirname, '..', 'fixtures', 'build2.json'))).toBeFalsy(); + }); + + it('should return false 2', () => { + expect(getBuildVersion(path.resolve(__dirname, '..', 'fixtures', 'build.test.json'))).toBeFalsy(); + }); +}); diff --git a/jest.config.js b/jest.config.js index 008b93ab..ea4b821b 100644 --- a/jest.config.js +++ b/jest.config.js @@ -1,12 +1,13 @@ module.exports = { clearMocks: true, - moduleFileExtensions: [ 'js', 'ts' ], - testEnvironment: 'node', - testMatch: [ '**/*.test.ts' ], - testRunner: 'jest-circus/runner', + moduleFileExtensions: [ "js", "ts" ], + setupFiles: [ "/jest.setup.ts" ], + testEnvironment: "node", + testMatch: [ "**/*.test.ts" ], + testRunner: "jest-circus/runner", transform: { - '^.+\\.ts$': 'ts-jest', + "^.+\\.ts$": "ts-jest", }, verbose: false, - coverageDirectory: '/coverage', + coverageDirectory: "/coverage", }; diff --git a/jest.setup.ts b/jest.setup.ts new file mode 100644 index 00000000..7f52ae68 --- /dev/null +++ b/jest.setup.ts @@ -0,0 +1,18 @@ +declare module NodeJS { + interface Global { + mockSignale: { + info: jest.Mock, + warn: jest.Mock + } + } +} + +global.mockSignale = { + info: jest.fn(), + warn: jest.fn(), +}; +jest.mock('signale', () => ({ + ...jest.requireActual('signale'), + info: global.mockSignale.info, + warn: global.mockSignale.warn, +})); diff --git a/src/constant.ts b/src/constant.ts index 8e213ab8..e43d49b7 100644 --- a/src/constant.ts +++ b/src/constant.ts @@ -1,4 +1,4 @@ -export const TARGET_EVENTS = { - 'issues': 'opened', - 'pull_request': 'opened', -}; \ No newline at end of file +export const TARGET_EVENTS = { + 'issues': 'opened', + 'pull_request': 'opened', +}; diff --git a/src/main.ts b/src/main.ts index 323b0e8a..c74a056c 100644 --- a/src/main.ts +++ b/src/main.ts @@ -1,28 +1,31 @@ -import path from 'path'; -import {setFailed, getInput} from '@actions/core'; -import {context, GitHub} from '@actions/github'; -import signale from 'signale'; -import {getBuildVersion, isTargetEvent} from './utils/misc'; -import {getAssignees} from './utils/context'; -import {addAssignees} from './utils/github'; - -async function run() { - try { - const version = getBuildVersion(path.resolve(__dirname, '..', 'build.json')); - if ('string' === typeof version) { - signale.info('Version: %s', version); - } - signale.info('Event: %s', context.eventName); - signale.info('Action: %s', context.payload.action); - if (!isTargetEvent(context)) { - signale.info('This is not target event.'); - return; - } - - await addAssignees(getAssignees(context), new GitHub(getInput('GITHUB_TOKEN', {required: true})), context); - } catch (error) { - setFailed(error.message); - } -} - -run(); +import path from 'path'; +import { setFailed, getInput } from '@actions/core'; +import { context, GitHub } from '@actions/github'; +import signale from 'signale'; +import { getBuildVersion, isTargetEvent } from './utils/misc'; +import { getAssignees } from './utils/context'; +import { addAssignees } from './utils/github'; + +/** + * run + */ +async function run(): Promise { + try { + const version = getBuildVersion(path.resolve(__dirname, '..', 'build.json')); + if ('string' === typeof version) { + signale.info('Version: %s', version); + } + signale.info('Event: %s', context.eventName); + signale.info('Action: %s', context.payload.action); + if (!isTargetEvent(context)) { + signale.info('This is not target event.'); + return; + } + + await addAssignees(getAssignees(context), new GitHub(getInput('GITHUB_TOKEN', {required: true})), context); + } catch (error) { + setFailed(error.message); + } +} + +run(); diff --git a/src/utils/context.ts b/src/utils/context.ts index bbd08535..eb230b17 100644 --- a/src/utils/context.ts +++ b/src/utils/context.ts @@ -1,25 +1,31 @@ -import {Context} from '@actions/github/lib/context'; - -export const getAssignees = (context: Context): string[] | false => { - const sender = getSender(context); - if (false === sender) return false; - - const assignees = getCurrentAssignees(context); - if (false === assignees) return false; - - if (assignees.includes(sender)) return []; - - return [sender]; -}; - -const getSender = (context: Context): string | false => context.payload.sender && context.payload.sender.type === 'User' ? context.payload.sender.login : false; - -const getCurrentAssignees = (context: Context): string[] | false => { - if ('issues' === context.eventName) { - return context.payload.issue && 'assignees' in context.payload.issue ? context.payload.issue.assignees.map(assignee => assignee.login) : false; - } - if ('pull_request' === context.eventName) { - return context.payload.pull_request && 'assignees' in context.payload.pull_request ? context.payload.pull_request.assignees.map(assignee => assignee.login) : false; - } - return false; -}; +import { Context } from '@actions/github/lib/context'; + +const getSender = (context: Context): string | false => context.payload.sender && context.payload.sender.type === 'User' ? context.payload.sender.login : false; + +const getCurrentAssignees = (context: Context): string[] | false => { + if ('issues' === context.eventName) { + return context.payload.issue && 'assignees' in context.payload.issue ? context.payload.issue.assignees.map(assignee => assignee.login) : false; + } + if ('pull_request' === context.eventName) { + return context.payload.pull_request && 'assignees' in context.payload.pull_request ? context.payload.pull_request.assignees.map(assignee => assignee.login) : false; + } + return false; +}; + +export const getAssignees = (context: Context): string[] | false => { + const sender = getSender(context); + if (false === sender) { + return false; + } + + const assignees = getCurrentAssignees(context); + if (false === assignees) { + return false; + } + + if (assignees.includes(sender)) { + return []; + } + + return [sender]; +}; diff --git a/src/utils/github.ts b/src/utils/github.ts index 87b98c9c..12f5f6d9 100644 --- a/src/utils/github.ts +++ b/src/utils/github.ts @@ -1,23 +1,33 @@ -import signale from 'signale'; -import {GitHub} from '@actions/github/lib/github'; -import {Context} from '@actions/github/lib/context'; - -export const addAssignees = async (assignees: string[] | false, octokit: GitHub, context: Context) => { - if (false === assignees) { - signale.warn('Invalid target.'); - signale.info(context.issue); - return; - } - - signale.info('Adding assignees'); - signale.info(assignees); - - if (!assignees.length) return; - - await octokit.issues.addAssignees({ - owner: context.repo.owner, - repo: context.repo.repo, - issue_number: context.issue.number, - assignees: assignees, - }); -}; +import signale from 'signale'; +import { GitHub } from '@actions/github/lib/github'; +import { Context } from '@actions/github/lib/context'; + +export const addAssignees = async(assignees: string[] | false, octokit: GitHub, context: Context): Promise => { + if (false === assignees) { + signale.warn('Invalid target.'); + signale.info(context.issue); + return; + } + + signale.info('Adding assignees'); + signale.info(assignees); + + if (!assignees.length) { + return; + } + + try { + await octokit.issues.addAssignees({ + owner: context.repo.owner, + repo: context.repo.repo, + 'issue_number': context.issue.number, + assignees: assignees, + }); + } catch (error) { + if ('Resource not accessible by integration' === error.message) { + signale.warn(error.message); + } else { + throw error; + } + } +}; diff --git a/src/utils/misc.ts b/src/utils/misc.ts index 0c9b6595..32cdbc70 100644 --- a/src/utils/misc.ts +++ b/src/utils/misc.ts @@ -1,18 +1,18 @@ -import fs from 'fs'; -import {Context} from '@actions/github/lib/context'; -import {TARGET_EVENTS} from '../constant'; - -export const isTargetEvent = (context: Context): boolean => 'string' === typeof context.payload.action && context.eventName in TARGET_EVENTS && TARGET_EVENTS[context.eventName] === context.payload.action; - -export const getBuildVersion = (filepath: string): string | boolean => { - if (!fs.existsSync(filepath)) { - return false; - } - - const json = JSON.parse(fs.readFileSync(filepath, 'utf8')); - if (json && 'tagName' in json) { - return json['tagName']; - } - - return false; -}; +import fs from 'fs'; +import { Context } from '@actions/github/lib/context'; +import { TARGET_EVENTS } from '../constant'; + +export const isTargetEvent = (context: Context): boolean => 'string' === typeof context.payload.action && context.eventName in TARGET_EVENTS && TARGET_EVENTS[context.eventName] === context.payload.action; + +export const getBuildVersion = (filepath: string): string | boolean => { + if (!fs.existsSync(filepath)) { + return false; + } + + const json = JSON.parse(fs.readFileSync(filepath, 'utf8')); + if (json && 'tagName' in json) { + return json['tagName']; + } + + return false; +}; From 36d43e382963cba8d551859d4bf4e1598da39688 Mon Sep 17 00:00:00 2001 From: Technote Date: Mon, 16 Sep 2019 00:53:16 +0900 Subject: [PATCH 09/11] docs: update CONTRIBUTING.md --- .github/CONTRIBUTING.md | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.github/CONTRIBUTING.md b/.github/CONTRIBUTING.md index 12933eae..020cbe56 100644 --- a/.github/CONTRIBUTING.md +++ b/.github/CONTRIBUTING.md @@ -2,6 +2,7 @@ [issues]: https://github.com/technote-space/assign-author/issues [fork]: https://github.com/technote-space/assign-author/fork [pr]: https://github.com/technote-space/assign-author/compare +[eslint]: https://eslint.org/ [jest]: https://jestjs.io/ [code-of-conduct]: CODE_OF_CONDUCT.md @@ -12,7 +13,8 @@ Please note we have a [Contributor Code of Conduct][code-of-conduct], please fol ## Submitting a pull request 1. [Fork][fork] and clone the repository -1. Make sure the tests pass on your machine: `composer test`, which contains +1. Make sure the tests pass on your machine: `yarn test`, which contains + - [`ESLint`][eslint] - [`Jest`][jest] 1. Create a new branch: `git checkout -b my-branch-name` 1. Make your change, add tests, and make sure the tests still pass. From fdcec0080ca6537e7a7d438295cab5259de59f64 Mon Sep 17 00:00:00 2001 From: Technote Date: Mon, 16 Sep 2019 01:07:45 +0900 Subject: [PATCH 10/11] feat: ESLint --- .github/workflows/ci.yml | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index f1ec5e9d..182fe7e9 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -9,6 +9,25 @@ on: name: Build jobs: + eslint: + name: ESLint + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v1 + with: + fetch-depth: 1 + - name: Install Package dependencies + run: yarn install + - name: Check code style + run: yarn lint + - uses: 8398a7/action-slack@v1 + with: + type: failure + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }} + if: failure() + jest: name: Jest runs-on: ubuntu-latest From f572c9a8990bbfe5c82236453f47d50e58c09900 Mon Sep 17 00:00:00 2001 From: Technote Date: Mon, 16 Sep 2019 01:08:19 +0900 Subject: [PATCH 11/11] chore: change fetch depth --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 182fe7e9..2cb8e15a 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -15,7 +15,7 @@ jobs: steps: - uses: actions/checkout@v1 with: - fetch-depth: 1 + fetch-depth: 3 - name: Install Package dependencies run: yarn install - name: Check code style