From 7fa0680a5d8ca634a17f4fc2bbb989095cce26d7 Mon Sep 17 00:00:00 2001 From: Simen Bekkhus Date: Sun, 23 Dec 2018 20:31:50 +0100 Subject: [PATCH 1/6] add `@types/` versions of all dependencies --- packages/babel-jest/package.json | 4 +- packages/expect/package.json | 3 + packages/jest-changed-files/package.json | 3 + packages/jest-circus/package.json | 2 + packages/jest-cli/package.json | 17 ++ packages/jest-config/package.json | 5 + packages/jest-docblock/package.json | 3 + packages/jest-environment-jsdom/package.json | 3 + packages/jest-haste-map/package.json | 7 + packages/jest-jasmine2/package.json | 1 + packages/jest-leak-detector/package.json | 1 + packages/jest-message-util/package.json | 5 + packages/jest-repl/package.json | 3 + packages/jest-resolve/package.json | 1 + packages/jest-runner/package.json | 5 + packages/jest-runtime/package.json | 9 + packages/jest-snapshot/package.json | 2 + packages/jest-util/package.json | 4 + packages/jest-validate/package.json | 4 + packages/jest-watcher/package.json | 4 + packages/jest-worker/package.json | 2 + packages/pretty-format/package.json | 2 + yarn.lock | 298 ++++++++++++++++++- 23 files changed, 385 insertions(+), 3 deletions(-) diff --git a/packages/babel-jest/package.json b/packages/babel-jest/package.json index 979ee04fb46c..48c4552b1380 100644 --- a/packages/babel-jest/package.json +++ b/packages/babel-jest/package.json @@ -16,7 +16,9 @@ "slash": "^2.0.0" }, "devDependencies": { - "@babel/core": "^7.1.0" + "@babel/core": "^7.1.0", + "@types/babel__core": "^7.0.4", + "@types/slash": "^2.0.0" }, "peerDependencies": { "@babel/core": "^7.0.0" diff --git a/packages/expect/package.json b/packages/expect/package.json index 5e5a75e3fbe8..3f74a119c97e 100644 --- a/packages/expect/package.json +++ b/packages/expect/package.json @@ -16,6 +16,9 @@ "jest-message-util": "^24.0.0", "jest-regex-util": "^24.0.0" }, + "devDependencies": { + "@types/ansi-styles": "^3.2.1" + }, "engines": { "node": ">= 6" }, diff --git a/packages/jest-changed-files/package.json b/packages/jest-changed-files/package.json index 1ae9580994f3..de3d1e78442a 100644 --- a/packages/jest-changed-files/package.json +++ b/packages/jest-changed-files/package.json @@ -12,6 +12,9 @@ "execa": "^1.0.0", "throat": "^4.0.0" }, + "devDependencies": { + "@types/execa": "^0.9.0" + }, "engines": { "node": ">= 6" }, diff --git a/packages/jest-circus/package.json b/packages/jest-circus/package.json index 8298a3252222..7ce23e74d4a0 100644 --- a/packages/jest-circus/package.json +++ b/packages/jest-circus/package.json @@ -24,6 +24,8 @@ "throat": "^4.0.0" }, "devDependencies": { + "@types/babel__traverse": "^7.0.4", + "@types/stack-utils": "^1.0.1", "execa": "^1.0.0", "jest-diff": "^24.0.0", "jest-runtime": "^24.1.0" diff --git a/packages/jest-cli/package.json b/packages/jest-cli/package.json index bc5b2aa3f5a4..90c8e788397b 100644 --- a/packages/jest-cli/package.json +++ b/packages/jest-cli/package.json @@ -43,6 +43,23 @@ "which": "^1.2.12", "yargs": "^12.0.2" }, + "devDependencies": { + "@types/ansi-escapes": "^3.0.0", + "@types/exit": "^0.1.30", + "@types/glob": "^7.1.1", + "@types/graceful-fs": "^4.1.2", + "@types/is-ci": "^1.1.0", + "@types/istanbul-lib-coverage": "^1.1.0", + "@types/istanbul-lib-instrument": "^1.7.2", + "@types/istanbul-lib-source-maps": "^1.2.1", + "@types/micromatch": "^3.1.0", + "@types/node-notifier": "^0.0.28", + "@types/prompts": "^1.2.0", + "@types/rimraf": "^2.0.2", + "@types/string-length": "^2.0.0", + "@types/which": "^1.3.1", + "@types/yargs": "^12.0.2" + }, "bin": { "jest": "./bin/jest.js" }, diff --git a/packages/jest-config/package.json b/packages/jest-config/package.json index 83e5407b2f6b..c1dc8cde0f46 100644 --- a/packages/jest-config/package.json +++ b/packages/jest-config/package.json @@ -25,6 +25,11 @@ "pretty-format": "^24.0.0", "realpath-native": "^1.0.2" }, + "devDependencies": { + "@types/babel__core": "^7.0.4", + "@types/glob": "^7.1.1", + "@types/micromatch": "^3.1.0" + }, "engines": { "node": ">= 6" }, diff --git a/packages/jest-docblock/package.json b/packages/jest-docblock/package.json index 7c3c5eb93966..464789183d14 100644 --- a/packages/jest-docblock/package.json +++ b/packages/jest-docblock/package.json @@ -11,6 +11,9 @@ "dependencies": { "detect-newline": "^2.1.0" }, + "devDependencies": { + "@types/detect-newline": "^2.1.0" + }, "engines": { "node": ">= 6" }, diff --git a/packages/jest-environment-jsdom/package.json b/packages/jest-environment-jsdom/package.json index 92012d65b2ae..0fb34d1b04f9 100644 --- a/packages/jest-environment-jsdom/package.json +++ b/packages/jest-environment-jsdom/package.json @@ -13,6 +13,9 @@ "jest-util": "^24.0.0", "jsdom": "^11.5.1" }, + "devDependencies": { + "@types/jsdom": "^11.12.0" + }, "engines": { "node": ">= 6" }, diff --git a/packages/jest-haste-map/package.json b/packages/jest-haste-map/package.json index 346c9b395442..1daf9e83bee0 100644 --- a/packages/jest-haste-map/package.json +++ b/packages/jest-haste-map/package.json @@ -18,6 +18,13 @@ "micromatch": "^3.1.10", "sane": "^3.0.0" }, + "devDependencies": { + "@types/fb-watchman": "^2.0.0", + "@types/graceful-fs": "^4.1.2", + "@types/invariant": "^2.2.29", + "@types/micromatch": "^3.1.0", + "@types/sane": "^2.0.0" + }, "engines": { "node": ">= 6" }, diff --git a/packages/jest-jasmine2/package.json b/packages/jest-jasmine2/package.json index 1ed3e1eb7cfe..562d0d5397e5 100644 --- a/packages/jest-jasmine2/package.json +++ b/packages/jest-jasmine2/package.json @@ -23,6 +23,7 @@ "throat": "^4.0.0" }, "devDependencies": { + "@types/babel__traverse": "^7.0.4", "jest-diff": "^24.0.0", "jest-runtime": "^24.1.0" }, diff --git a/packages/jest-leak-detector/package.json b/packages/jest-leak-detector/package.json index 9db8dd393ce4..434f904dcf62 100644 --- a/packages/jest-leak-detector/package.json +++ b/packages/jest-leak-detector/package.json @@ -12,6 +12,7 @@ "pretty-format": "^24.0.0" }, "devDependencies": { + "@types/weak": "^1.0.0", "weak": "^1.0.1" }, "engines": { diff --git a/packages/jest-message-util/package.json b/packages/jest-message-util/package.json index 45e32e2e6f64..e61c38de40c1 100644 --- a/packages/jest-message-util/package.json +++ b/packages/jest-message-util/package.json @@ -18,5 +18,10 @@ "slash": "^2.0.0", "stack-utils": "^1.0.1" }, + "devDependencies": { + "@types/babel__code-frame": "^7.0.0", + "@types/micromatch": "^3.1.0", + "@types/stack-utils": "^1.0.1" + }, "gitHead": "634e5a54f46b2a62d1dc81a170562e6f4e55ad60" } diff --git a/packages/jest-repl/package.json b/packages/jest-repl/package.json index 4b96382132ab..8c9abb3ec472 100644 --- a/packages/jest-repl/package.json +++ b/packages/jest-repl/package.json @@ -15,6 +15,9 @@ "repl": "^0.1.3", "yargs": "^12.0.2" }, + "devDependencies": { + "@types/yargs": "^12.0.2" + }, "bin": { "jest-repl": "./bin/jest-repl.js" }, diff --git a/packages/jest-resolve/package.json b/packages/jest-resolve/package.json index 696170cd90ec..d44ad9c6b183 100644 --- a/packages/jest-resolve/package.json +++ b/packages/jest-resolve/package.json @@ -14,6 +14,7 @@ "realpath-native": "^1.0.0" }, "devDependencies": { + "@types/browser-resolve": "^0.0.5", "jest-haste-map": "^24.0.0" }, "engines": { diff --git a/packages/jest-runner/package.json b/packages/jest-runner/package.json index a8583affb503..98ecf80ca1e7 100644 --- a/packages/jest-runner/package.json +++ b/packages/jest-runner/package.json @@ -24,6 +24,11 @@ "source-map-support": "^0.5.6", "throat": "^4.0.0" }, + "devDependencies": { + "@types/exit": "^0.1.30", + "@types/graceful-fs": "^4.1.2", + "@types/source-map-support": "^0.4.1" + }, "engines": { "node": ">= 6" }, diff --git a/packages/jest-runtime/package.json b/packages/jest-runtime/package.json index 15913207fe44..2bfa2989ad6d 100644 --- a/packages/jest-runtime/package.json +++ b/packages/jest-runtime/package.json @@ -33,6 +33,15 @@ "yargs": "^12.0.2" }, "devDependencies": { + "@types/babel__core": "^7.0.4", + "@types/convert-source-map": "^1.5.1", + "@types/exit": "^0.1.30", + "@types/glob": "^7.1.1", + "@types/graceful-fs": "^4.1.2", + "@types/micromatch": "^3.1.0", + "@types/strip-bom": "3.0.0", + "@types/write-file-atomic": "^2.1.1", + "@types/yargs": "^12.0.2", "jest-environment-jsdom": "^24.0.0", "jest-environment-node": "^24.0.0" }, diff --git a/packages/jest-snapshot/package.json b/packages/jest-snapshot/package.json index 7740aa3fde00..43c27d8bbab0 100644 --- a/packages/jest-snapshot/package.json +++ b/packages/jest-snapshot/package.json @@ -21,6 +21,8 @@ "semver": "^5.5.0" }, "devDependencies": { + "@types/mkdirp": "^0.5.2", + "@types/semver": "^5.5.0", "prettier": "^1.13.4" }, "engines": { diff --git a/packages/jest-util/package.json b/packages/jest-util/package.json index db4a4a311ba5..85f3410824a8 100644 --- a/packages/jest-util/package.json +++ b/packages/jest-util/package.json @@ -19,6 +19,10 @@ "source-map": "^0.6.0" }, "devDependencies": { + "@types/callsites": "^2.0.0", + "@types/graceful-fs": "^4.1.2", + "@types/is-ci": "^1.0.10", + "@types/mkdirp": "^0.5.2", "jest-mock": "^24.0.0" }, "engines": { diff --git a/packages/jest-validate/package.json b/packages/jest-validate/package.json index f3c9508eeaf8..2186f1af66c3 100644 --- a/packages/jest-validate/package.json +++ b/packages/jest-validate/package.json @@ -15,6 +15,10 @@ "leven": "^2.1.0", "pretty-format": "^24.0.0" }, + "devDependencies": { + "@types/camelcase": "^4.1.0", + "@types/leven": "^2.1.1" + }, "engines": { "node": ">= 6" }, diff --git a/packages/jest-watcher/package.json b/packages/jest-watcher/package.json index 3abb4ba0bcda..351a6c7ec3da 100644 --- a/packages/jest-watcher/package.json +++ b/packages/jest-watcher/package.json @@ -9,6 +9,10 @@ "jest-util": "^24.0.0", "string-length": "^2.0.0" }, + "devDependencies": { + "@types/ansi-escapes": "^3.0.0", + "@types/string-length": "^2.0.0" + }, "repository": { "type": "git", "url": "https://github.com/facebook/jest", diff --git a/packages/jest-worker/package.json b/packages/jest-worker/package.json index 7b02f58e07ff..b993e76c65da 100644 --- a/packages/jest-worker/package.json +++ b/packages/jest-worker/package.json @@ -13,6 +13,8 @@ "supports-color": "^6.1.0" }, "devDependencies": { + "@types/merge-stream": "^1.1.2", + "@types/supports-color": "^5.3.0", "worker-farm": "^1.6.0" }, "engines": { diff --git a/packages/pretty-format/package.json b/packages/pretty-format/package.json index 30914be8fa59..c9d7fedc45b7 100644 --- a/packages/pretty-format/package.json +++ b/packages/pretty-format/package.json @@ -16,6 +16,8 @@ "ansi-styles": "^3.2.0" }, "devDependencies": { + "@types/ansi-regex": "^4.0.0", + "@types/ansi-styles": "^3.2.1", "immutable": "4.0.0-rc.9", "react": "*", "react-dom": "*", diff --git a/yarn.lock b/yarn.lock index 9dfdd03de271..86c72f3c0ded 100644 --- a/yarn.lock +++ b/yarn.lock @@ -232,7 +232,7 @@ esutils "^2.0.2" js-tokens "^4.0.0" -"@babel/parser@^7.0.0", "@babel/parser@^7.2.2", "@babel/parser@^7.2.3": +"@babel/parser@^7.0.0", "@babel/parser@^7.1.0", "@babel/parser@^7.2.2", "@babel/parser@^7.2.3": version "7.2.3" resolved "https://registry.yarnpkg.com/@babel/parser/-/parser-7.2.3.tgz#32f5df65744b70888d17872ec106b02434ba1489" integrity sha512-0LyEcVlfCoFmci8mXx8A5oIkpkOgyo8dRHtxBnK9RRBwxO2+JZPNsqtVEZQ7mJFPxnXF9lfmU24mHOPI0qnlkA== @@ -1462,26 +1462,320 @@ resolved "https://registry.yarnpkg.com/@sindresorhus/is/-/is-0.7.0.tgz#9a06f4f137ee84d7df0460c1fdb1135ffa6c50fd" integrity sha512-ONhaKPIufzzrlNbqtWFFd+jlnemX6lJAgq9ZeiZtS7I1PIf/la7CW4m83rTXRnVnsMbW2k56pGYu7AUFJD9Pow== +"@types/ansi-escapes@^3.0.0": + version "3.0.0" + resolved "https://registry.yarnpkg.com/@types/ansi-escapes/-/ansi-escapes-3.0.0.tgz#619bbc6d46fc75da6d784e53b5a25d2efff07108" + integrity sha512-aamJrX6PdmIO8E9qhZaYmXiMGXwnkF2lcga/VbqLf8g90aaKGZ4cSFP5AabqxAbmp0h69C9yE3a4fUBtVpqtmg== + dependencies: + "@types/node" "*" + +"@types/ansi-regex@^4.0.0": + version "4.0.0" + resolved "https://registry.yarnpkg.com/@types/ansi-regex/-/ansi-regex-4.0.0.tgz#cb20bb66da7700ea9b26f16971f03f0e092eddad" + integrity sha512-r1W316vjsZXn1/csLC4HcCJs6jIHIzksHJd7xx+Dl+PAb0S2Dh9cR8ZsIMEfGmbBtP7JNWlf2KKahSkDP6rg3g== + +"@types/ansi-styles@^3.2.1": + version "3.2.1" + resolved "https://registry.yarnpkg.com/@types/ansi-styles/-/ansi-styles-3.2.1.tgz#49e996bb6e0b7957ca831205df31eb9a0702492c" + integrity sha512-UFa7mfKgSutXdT+elzJo8Ulr7FHgLNAyglVIOZYXFNJVQERm8DPrcwPret5BYk66LBE7fwm1XoVGi76MJkQ6ow== + dependencies: + "@types/color-name" "*" + +"@types/babel-types@*": + version "7.0.4" + resolved "https://registry.yarnpkg.com/@types/babel-types/-/babel-types-7.0.4.tgz#bfd5b0d0d1ba13e351dff65b6e52783b816826c8" + integrity sha512-WiZhq3SVJHFRgRYLXvpf65XnV6ipVHhnNaNvE8yCimejrGglkg38kEj0JcizqwSHxmPSjcTlig/6JouxLGEhGw== + +"@types/babel__code-frame@^7.0.0": + version "7.0.0" + resolved "https://registry.yarnpkg.com/@types/babel__code-frame/-/babel__code-frame-7.0.0.tgz#d5658827984c1e386c1b4ef30699b344d3f732a2" + integrity sha512-Rt0KuqopAdtpyvxO0JbKbwgtw7B+y0NQpTXns+tiz1lqGXywOESSKIiiQt0wnCreqEKvmrArH7KZ6bQg+w8BoA== + +"@types/babel__core@^7.0.4": + version "7.0.4" + resolved "https://registry.yarnpkg.com/@types/babel__core/-/babel__core-7.0.4.tgz#14b30c11113bad353cabfaea73e327b48edb0f0e" + integrity sha512-2Y2RK1BN5BRFfhneGfQA8mmFmTANbzGgS5uQPluoRqGNWb6uAcefqxzNbqgxPpmPkLqKapQfmYcyyl5iAQV+fA== + dependencies: + "@babel/parser" "^7.1.0" + "@babel/types" "^7.0.0" + +"@types/babel__traverse@^7.0.4": + version "7.0.4" + resolved "https://registry.yarnpkg.com/@types/babel__traverse/-/babel__traverse-7.0.4.tgz#de652399bd8493ab712e4d6b68031b7a2f72ad5f" + integrity sha512-2vARZYqR4Flf59WtqMfa9GgbOjK04xLZaN9+CMf7Cs+4cAhxZBP3K9LYRzsWxOQe402VvqX9+7DdXxB72ujEOg== + dependencies: + "@babel/types" "^7.0.0" + +"@types/braces@*": + version "2.3.0" + resolved "https://registry.yarnpkg.com/@types/braces/-/braces-2.3.0.tgz#d00ec0a76562b2acb6f29330be33a093e33ed25c" + integrity sha512-A3MV5EsLHgShHoJ/XES/fQAnwNISKLrFuH9eNBZY5OkTQB7JPIwbRoExvRpDsNABvkMojnKqKWS8x0m2rLYi+A== + +"@types/browser-resolve@^0.0.5": + version "0.0.5" + resolved "https://registry.yarnpkg.com/@types/browser-resolve/-/browser-resolve-0.0.5.tgz#4d7ea4babcbfa45752a5cdc016c0a0fc4dc4de7d" + integrity sha512-3XKWKoP/RsU2Ewg9v2rkE1qmAbKIFR6nxFOsDhY2/J1u3zyDP+2vovKI/7tX1b9RqshAwQiiCsLyQr3dIGw9/w== + dependencies: + "@types/resolve" "*" + +"@types/callsites@^2.0.0": + version "2.0.0" + resolved "https://registry.yarnpkg.com/@types/callsites/-/callsites-2.0.0.tgz#df0db68ea34053651caee9975294be902fd04751" + integrity sha512-kUvhIE1ZlV4dYEyFnZ2lJLXMEOc7eLN6ejolVBQm0boUCX2t6p0M2nx+20UkEtDMJYtRQffuhcwO1h/U029QAw== + +"@types/camelcase@^4.1.0": + version "4.1.0" + resolved "https://registry.yarnpkg.com/@types/camelcase/-/camelcase-4.1.0.tgz#e054f7986f31658d49936261b5cd4588ef29d1ee" + integrity sha512-nsaprOtNLvUrLyFX5+mRpE9h2Q0d5YzQRr+Lav3fxdYtc1/E/U7G+Ld861NWBDDtWY3MnwKoUOhCrE1nrVxUQA== + "@types/cheerio@^0.22.8": version "0.22.10" resolved "https://registry.yarnpkg.com/@types/cheerio/-/cheerio-0.22.10.tgz#780d552467824be4a241b29510a7873a7432c4a6" integrity sha512-fOM/Jhv51iyugY7KOBZz2ThfT1gwvsGCfWxpLpZDgkGjpEO4Le9cld07OdskikLjDUQJ43dzDaVRSFwQlpdqVg== +"@types/color-name@*": + version "1.1.0" + resolved "https://registry.yarnpkg.com/@types/color-name/-/color-name-1.1.0.tgz#926f76f7e66f49cc59ad880bb15b030abbf0b66d" + integrity sha512-gZ/Rb+MFXF0pXSEQxdRoPMm5jeO3TycjOdvbpbcpHX/B+n9AqaHFe5q6Ga9CsZ7ir/UgIWPfrBzUzn3F19VH/w== + +"@types/convert-source-map@^1.5.1": + version "1.5.1" + resolved "https://registry.yarnpkg.com/@types/convert-source-map/-/convert-source-map-1.5.1.tgz#d4d180dd6adc5cb68ad99bd56e03d637881f4616" + integrity sha512-laiDIXqqthjJlyAMYAXOtN3N8+UlbM+KvZi4BaY5ZOekmVkBs/UxfK5O0HWeJVG2eW8F+Mu2ww13fTX+kY1FlQ== + +"@types/detect-newline@^2.1.0": + version "2.1.0" + resolved "https://registry.yarnpkg.com/@types/detect-newline/-/detect-newline-2.1.0.tgz#1896b5651b473792b6aba2500270fda626bc38d0" + integrity sha512-vcHS4yQkTfy+8QISuAFS+2SCjNcGs37+CWzxrrIOMv7yvPnYd6f1AeUErVEHVCu8dZreAHUqzV8RrjzeBorvtQ== + +"@types/events@*": + version "1.2.0" + resolved "https://registry.yarnpkg.com/@types/events/-/events-1.2.0.tgz#81a6731ce4df43619e5c8c945383b3e62a89ea86" + integrity sha512-KEIlhXnIutzKwRbQkGWb/I4HFqBuUykAdHgDED6xqwXJfONCjF5VoE0cXEiurh3XauygxzeDzgtXUqvLkxFzzA== + +"@types/execa@^0.9.0": + version "0.9.0" + resolved "https://registry.yarnpkg.com/@types/execa/-/execa-0.9.0.tgz#9b025d2755f17e80beaf9368c3f4f319d8b0fb93" + integrity sha512-mgfd93RhzjYBUHHV532turHC2j4l/qxsF/PbfDmprHDEUHmNZGlDn1CEsulGK3AfsPdhkWzZQT/S/k0UGhLGsA== + dependencies: + "@types/node" "*" + +"@types/exit@^0.1.30": + version "0.1.30" + resolved "https://registry.yarnpkg.com/@types/exit/-/exit-0.1.30.tgz#7078b736a7d166c80b6394dc0d9de1577ca76daf" + integrity sha1-cHi3NqfRZsgLY5TcDZ3hV3ynba8= + +"@types/fb-watchman@^2.0.0": + version "2.0.0" + resolved "https://registry.yarnpkg.com/@types/fb-watchman/-/fb-watchman-2.0.0.tgz#ca60ded406baa8c81c65ac1f86763a5d00aa7c55" + integrity sha512-Ao2jlksPEUGCEXBvJz5e2MuDpYUtxXgtUk45cg0g5Mmy4f0j7bQuDlOlqBMgKGRl9dZAK4ZTzFtukuzj2mURlQ== + dependencies: + "@types/events" "*" + +"@types/glob@*", "@types/glob@^7.1.1": + version "7.1.1" + resolved "https://registry.yarnpkg.com/@types/glob/-/glob-7.1.1.tgz#aa59a1c6e3fbc421e07ccd31a944c30eba521575" + integrity sha512-1Bh06cbWJUHMC97acuD6UMG29nMt0Aqz1vF3guLfG+kHHJhy3AyohZFFxYk2f7Q1SQIrNwvncxAE0N/9s70F2w== + dependencies: + "@types/events" "*" + "@types/minimatch" "*" + "@types/node" "*" + +"@types/graceful-fs@^4.1.2": + version "4.1.2" + resolved "https://registry.yarnpkg.com/@types/graceful-fs/-/graceful-fs-4.1.2.tgz#fbc9575dbcc6d1d91dd768d30c5fc0c19f6c50bd" + integrity sha512-epDhsJAVxJsWfeqpzEDFhLnhHMbHie/VMFY+2Hvt5p7FemeW5ELM+6gcVYL/ZsUwdu3zrWpDE3VUTddXW+EMYg== + dependencies: + "@types/node" "*" + +"@types/invariant@^2.2.29": + version "2.2.29" + resolved "https://registry.yarnpkg.com/@types/invariant/-/invariant-2.2.29.tgz#aa845204cd0a289f65d47e0de63a6a815e30cc66" + integrity sha512-lRVw09gOvgviOfeUrKc/pmTiRZ7g7oDOU6OAutyuSHpm1/o2RaBQvRhgK8QEdu+FFuw/wnWb29A/iuxv9i8OpQ== + +"@types/is-ci@^1.0.10", "@types/is-ci@^1.1.0": + version "1.1.0" + resolved "https://registry.yarnpkg.com/@types/is-ci/-/is-ci-1.1.0.tgz#583c5fbfcc461be9971106b9558930d67df49227" + integrity sha512-NbyqP5D4hwl5UWnnW4Cz0gIRjhecgx/9OApcCIpp4+tjqjROGf/NBcKKDfbI3YFBTTkD3JBshiNSv5V7VoVJJg== + +"@types/istanbul-lib-coverage@*", "@types/istanbul-lib-coverage@^1.1.0": + version "1.1.0" + resolved "https://registry.yarnpkg.com/@types/istanbul-lib-coverage/-/istanbul-lib-coverage-1.1.0.tgz#2cc2ca41051498382b43157c8227fea60363f94a" + integrity sha512-ohkhb9LehJy+PA40rDtGAji61NCgdtKLAlFoYp4cnuuQEswwdK3vz9SOIkkyc3wrk8dzjphQApNs56yyXLStaQ== + +"@types/istanbul-lib-instrument@^1.7.2": + version "1.7.2" + resolved "https://registry.yarnpkg.com/@types/istanbul-lib-instrument/-/istanbul-lib-instrument-1.7.2.tgz#44e61372876597e361148a84537be402f4c9e972" + integrity sha512-SWIpdKneXqThfrKIokt9dXSPeslS2NWcxhtr+/a2+N81aLyOMAsVTMmwaKuCoEahcI0FfhY3/79AR6Vilk9i8A== + dependencies: + "@types/babel-types" "*" + "@types/istanbul-lib-coverage" "*" + source-map "^0.6.1" + +"@types/istanbul-lib-source-maps@^1.2.1": + version "1.2.1" + resolved "https://registry.yarnpkg.com/@types/istanbul-lib-source-maps/-/istanbul-lib-source-maps-1.2.1.tgz#c6db98b8b9f0b5aea000f7a8922cc075a85eda9f" + integrity sha512-K0IvmTFbI2GjLG0O4AOLPV2hFItE5Bg/TY41IBZIThhLhYthJc3VjpZpM8/sIaIVtnQcX8b2k3muPDvsvhk+Fg== + dependencies: + "@types/istanbul-lib-coverage" "*" + source-map "^0.6.1" + "@types/jest@^23.1.1": version "23.3.12" resolved "https://registry.yarnpkg.com/@types/jest/-/jest-23.3.12.tgz#7e0ced251fa94c3bc2d1023d4b84b2992fa06376" integrity sha512-/kQvbVzdEpOq4tEWT79yAHSM4nH4xMlhJv2GrLVQt4Qmo8yYsPdioBM1QpN/2GX1wkfMnyXvdoftvLUr0LBj7Q== +"@types/jsdom@^11.12.0": + version "11.12.0" + resolved "https://registry.yarnpkg.com/@types/jsdom/-/jsdom-11.12.0.tgz#00ddc6f0a1b04c2f5ff6fb23eb59360ca65f12ae" + integrity sha512-XHMNZFQ0Ih3A4/NTWAO15+OsQafPKnQCanN0FYGbsTM/EoI5EoEAvvkF51/DQC2BT5low4tomp7k2RLMlriA5Q== + dependencies: + "@types/events" "*" + "@types/node" "*" + "@types/tough-cookie" "*" + parse5 "^4.0.0" + +"@types/leven@^2.1.1": + version "2.1.1" + resolved "https://registry.yarnpkg.com/@types/leven/-/leven-2.1.1.tgz#7cdc02ec636f80dc0bb0a53d8ee7eff2d8e8e1d8" + integrity sha512-f74SsCQnQzm244o5LHZgSLijrwG5e9BgkMHGbDlQThfh42q5RG4c+RNzUvZ347wAlQYD9kwu64qSNylxZdKs6w== + +"@types/merge-stream@^1.1.2": + version "1.1.2" + resolved "https://registry.yarnpkg.com/@types/merge-stream/-/merge-stream-1.1.2.tgz#a880ff66b1fbbb5eef4958d015c5947a9334dbb1" + integrity sha512-7faLmaE99g/yX0Y9pF1neh2IUqOf/fXMOWCVzsXjqI1EJ91lrgXmaBKf6bRWM164lLyiHxHt6t/ZO/cIzq61XA== + dependencies: + "@types/node" "*" + +"@types/micromatch@^3.1.0": + version "3.1.0" + resolved "https://registry.yarnpkg.com/@types/micromatch/-/micromatch-3.1.0.tgz#514c8a3d24b2680a9b838eeb80e6d7d724545433" + integrity sha512-06uA9V7v68RTOzA3ky1Oi0HmCPa+YJ050vM+sTECwkxnHUQnO17TAcNCGX400QT6bldUiPb7ux5oKy0j8ccEDw== + dependencies: + "@types/braces" "*" + +"@types/minimatch@*": + version "3.0.3" + resolved "https://registry.yarnpkg.com/@types/minimatch/-/minimatch-3.0.3.tgz#3dca0e3f33b200fc7d1139c0cd96c1268cadfd9d" + integrity sha512-tHq6qdbT9U1IRSGf14CL0pUlULksvY9OZ+5eEgl1N7t+OA3tGvNpxJCzuKQlsNgCVwbAs670L1vcVQi8j9HjnA== + +"@types/mkdirp@^0.5.2": + version "0.5.2" + resolved "https://registry.yarnpkg.com/@types/mkdirp/-/mkdirp-0.5.2.tgz#503aacfe5cc2703d5484326b1b27efa67a339c1f" + integrity sha512-U5icWpv7YnZYGsN4/cmh3WD2onMY0aJIiTE6+51TwJCttdHvtCYmkBNOobHlXwrJRL0nkH9jH4kD+1FAdMN4Tg== + dependencies: + "@types/node" "*" + +"@types/node-notifier@^0.0.28": + version "0.0.28" + resolved "https://registry.yarnpkg.com/@types/node-notifier/-/node-notifier-0.0.28.tgz#86ba3d3aa8d918352cc3191d88de328b20dc93c1" + integrity sha1-hro9OqjZGDUswxkdiN4yiyDck8E= + dependencies: + "@types/node" "*" + "@types/node@*": version "10.12.18" resolved "https://registry.yarnpkg.com/@types/node/-/node-10.12.18.tgz#1d3ca764718915584fcd9f6344621b7672665c67" integrity sha512-fh+pAqt4xRzPfqA6eh3Z2y6fyZavRIumvjhaCL753+TVkGKGhpPeyrJG2JftD0T9q4GF00KjefsQ+PQNDdWQaQ== +"@types/prompts@^1.2.0": + version "1.2.0" + resolved "https://registry.yarnpkg.com/@types/prompts/-/prompts-1.2.0.tgz#891e73f735ad5e82e8adae3a99424128e105fb62" + integrity sha512-7JXpT2rSd4hqd2oBWU1wfEW6x6gX+qPH+gLzGEx+My3wcb67K9Rc02xNQRVn67phusmXm5Yqn4oTP2OW1G5zdQ== + "@types/q@^1.5.1": version "1.5.1" resolved "https://registry.yarnpkg.com/@types/q/-/q-1.5.1.tgz#48fd98c1561fe718b61733daed46ff115b496e18" integrity sha512-eqz8c/0kwNi/OEHQfvIuJVLTst3in0e7uTKeuY+WL/zfKn0xVujOTp42bS/vUUokhK5P2BppLd9JXMOMHcgbjA== +"@types/resolve@*": + version "0.0.8" + resolved "https://registry.yarnpkg.com/@types/resolve/-/resolve-0.0.8.tgz#f26074d238e02659e323ce1a13d041eee280e194" + integrity sha512-auApPaJf3NPfe18hSoJkp8EbZzer2ISk7o8mCC3M9he/a04+gbMF97NkpD2S8riMGvm4BMRI59/SZQSaLTKpsQ== + dependencies: + "@types/node" "*" + +"@types/rimraf@^2.0.2": + version "2.0.2" + resolved "https://registry.yarnpkg.com/@types/rimraf/-/rimraf-2.0.2.tgz#7f0fc3cf0ff0ad2a99bb723ae1764f30acaf8b6e" + integrity sha512-Hm/bnWq0TCy7jmjeN5bKYij9vw5GrDFWME4IuxV08278NtU/VdGbzsBohcCUJ7+QMqmUq5hpRKB39HeQWJjztQ== + dependencies: + "@types/glob" "*" + "@types/node" "*" + +"@types/sane@^2.0.0": + version "2.0.0" + resolved "https://registry.yarnpkg.com/@types/sane/-/sane-2.0.0.tgz#891c272b10d1a6f735e915c731756104b5d21374" + integrity sha512-6o/YMfcKcWIK5IAxeo/1DEoVnGKBkPSPj9odxczz2i1gFY78GvguqgtNo28nyKgJUiKEWuFj11acpgdRmRFz7A== + dependencies: + "@types/node" "*" + +"@types/semver@^5.5.0": + version "5.5.0" + resolved "https://registry.yarnpkg.com/@types/semver/-/semver-5.5.0.tgz#146c2a29ee7d3bae4bf2fcb274636e264c813c45" + integrity sha512-41qEJgBH/TWgo5NFSvBCJ1qkoi3Q6ONSF2avrHq1LVEZfYpdHmj0y9SuTK+u9ZhG1sYQKBL1AWXKyLWP4RaUoQ== + +"@types/slash@^2.0.0": + version "2.0.0" + resolved "https://registry.yarnpkg.com/@types/slash/-/slash-2.0.0.tgz#2c37c08f5d2e0dad20aed808de79459e0a35ef9d" + integrity sha512-LTVXHQ+ij5F973ulc7aJEFteAtUvCflhzI3oOdV8VhWUmjy4na4LnK2bZaH8hDBq9eFX+Nb9DT3HVctqLoTy+g== + +"@types/source-map-support@^0.4.1": + version "0.4.1" + resolved "https://registry.yarnpkg.com/@types/source-map-support/-/source-map-support-0.4.1.tgz#ad77158e8c6695a16629ef82b9fb9dfe7c610ac0" + integrity sha512-eoyZxYGwaeHq5zCVeoNgY1dQy6dVdm1b7K9k1FRnWkf997Tji3NLBoLAjK5WCobeh1Qs6Q5KUV1rZCmHvzaDBw== + dependencies: + "@types/node" "*" + +"@types/stack-utils@^1.0.1": + version "1.0.1" + resolved "https://registry.yarnpkg.com/@types/stack-utils/-/stack-utils-1.0.1.tgz#0a851d3bd96498fa25c33ab7278ed3bd65f06c3e" + integrity sha512-l42BggppR6zLmpfU6fq9HEa2oGPEI8yrSPL3GITjfRInppYFahObbIQOQK3UGxEnyQpltZLaPe75046NOZQikw== + +"@types/string-length@^2.0.0": + version "2.0.0" + resolved "https://registry.yarnpkg.com/@types/string-length/-/string-length-2.0.0.tgz#358ce3ff2e8c2310270ee192ddd6b79b64fed7b2" + integrity sha512-xFwWZpIWcLsrcVEybzxmxQM/26Snj1gqxmVrelC3We3Nub7q70RCtqTBVQ7nL+315fAcw4BGSFpxvMkhLApKmQ== + +"@types/strip-bom@3.0.0": + version "3.0.0" + resolved "https://registry.yarnpkg.com/@types/strip-bom/-/strip-bom-3.0.0.tgz#14a8ec3956c2e81edb7520790aecf21c290aebd2" + integrity sha1-FKjsOVbC6B7bdSB5CuzyHCkK69I= + +"@types/supports-color@^5.3.0": + version "5.3.0" + resolved "https://registry.yarnpkg.com/@types/supports-color/-/supports-color-5.3.0.tgz#eb6a52e9531fb3ebcd401cec774d1bdfb571f793" + integrity sha512-WxwTXnHTIsk7srax1icjLgX+6w1MUAJbhyCpRP/45paEElsPDQUJZDgr1UpKuL2S3Tb+ZyX9MjWwmcSD4bUoOQ== + +"@types/tough-cookie@*": + version "2.3.4" + resolved "https://registry.yarnpkg.com/@types/tough-cookie/-/tough-cookie-2.3.4.tgz#821878b81bfab971b93a265a561d54ea61f9059f" + integrity sha512-Set5ZdrAaKI/qHdFlVMgm/GsAv/wkXhSTuZFkJ+JI7HK+wIkIlOaUXSXieIvJ0+OvGIqtREFoE+NHJtEq0gtEw== + +"@types/weak@^1.0.0": + version "1.0.0" + resolved "https://registry.yarnpkg.com/@types/weak/-/weak-1.0.0.tgz#7b3bf891c4b53e2b8a144b7e41f4b0f6e78c2ba8" + integrity sha512-6WXZpeAac3vj5+OfQvlqYEtc88oOgvkcxbrnmBw53Da6gA+MGztL+Hns3BpnyUevgz+4DxsJblgAew1A/tkcng== + dependencies: + "@types/node" "*" + +"@types/which@^1.3.1": + version "1.3.1" + resolved "https://registry.yarnpkg.com/@types/which/-/which-1.3.1.tgz#7802c380887986ca909008afea4e08025b130f8d" + integrity sha512-ZrJDWpvg75LTGX4XwuneY9s6bF3OeZcGTpoGh3zDV9ytzcHMFsRrMIaLBRJZQMBoGyKs6unBQfVdrLZiYfb1zQ== + +"@types/write-file-atomic@^2.1.1": + version "2.1.1" + resolved "https://registry.yarnpkg.com/@types/write-file-atomic/-/write-file-atomic-2.1.1.tgz#7f9fcd6c5c8d194dba03472e3fa6cb29a839764c" + integrity sha512-mROQhTxpJsOm/S0eOxDHUy5WJ0yS8fmqsq/s+u5OuAh1TxBFSqVBTkLjbyxDPcKh7DeJXk0OYrCkxXlkf8zu1g== + dependencies: + "@types/node" "*" + +"@types/yargs@^12.0.2": + version "12.0.2" + resolved "https://registry.yarnpkg.com/@types/yargs/-/yargs-12.0.2.tgz#7569157b2601d49d4442023c0d22f81d23f62d1e" + integrity sha512-NUyxaQW48vjeDHybmhy7CFx/6of1+PoaEGPMI+0PzBVr5s3BTELT7gV4lNaxUsKllNS1YAjkeTEhBtzIDWs2WQ== + "@webassemblyjs/ast@1.7.11": version "1.7.11" resolved "https://registry.yarnpkg.com/@webassemblyjs/ast/-/ast-1.7.11.tgz#b988582cafbb2b095e8b556526f30c90d057cace" @@ -9506,7 +9800,7 @@ parse-passwd@^1.0.0: resolved "https://registry.yarnpkg.com/parse-passwd/-/parse-passwd-1.0.0.tgz#6d5b934a456993b23d37f40a382d6f1666a8e5c6" integrity sha1-bVuTSkVpk7I9N/QKOC1vFmao5cY= -parse5@4.0.0: +parse5@4.0.0, parse5@^4.0.0: version "4.0.0" resolved "https://registry.yarnpkg.com/parse5/-/parse5-4.0.0.tgz#6d78656e3da8d78b4ec0b906f7c08ef1dfe3f608" integrity sha512-VrZ7eOd3T1Fk4XWNXMgiGBK/z0MG48BWG2uQNU4I72fkQuKUTZpl+u9k+CxEG0twMVzSmXEEz12z5Fnw1jIQFA== From 049ff5996d6b8542ebf663668a91e4b97ce3f862 Mon Sep 17 00:00:00 2001 From: Simen Bekkhus Date: Mon, 24 Dec 2018 00:16:14 +0100 Subject: [PATCH 2/6] compile ts files --- babel.config.js | 16 +++++++- e2e/coverage-remapping/package.json | 8 +--- e2e/stack-trace-source-maps/package.json | 4 -- e2e/typescript-coverage/package.json | 12 +----- e2e/typescript-coverage/yarn.lock | 8 ++-- jest.config.js | 2 +- package.json | 8 +++- ...lugin-jest-replace-ts-export-assignment.js | 26 ++++++++++++ scripts/browserBuild.js | 5 ++- scripts/build.js | 40 +++++++++++++------ scripts/watch.js | 12 +++++- tsconfig.json | 26 ++++++++++++ yarn.lock | 29 ++++++++++---- 13 files changed, 145 insertions(+), 51 deletions(-) create mode 100644 scripts/babel-plugin-jest-replace-ts-export-assignment.js create mode 100644 tsconfig.json diff --git a/babel.config.js b/babel.config.js index cc4688972601..21f020caca39 100644 --- a/babel.config.js +++ b/babel.config.js @@ -2,6 +2,21 @@ module.exports = { babelrcRoots: ['examples/*'], + overrides: [ + { + presets: ['@babel/preset-flow'], + test: '**/*.js', + }, + { + plugins: [ + require.resolve( + './scripts/babel-plugin-jest-replace-ts-export-assignment.js', + ), + ], + presets: ['@babel/preset-typescript'], + test: /\.tsx?$/, + }, + ], plugins: [ ['@babel/plugin-transform-modules-commonjs', {allowTopLevelThis: true}], '@babel/plugin-transform-strict-mode', @@ -14,6 +29,5 @@ module.exports = { targets: {node: 6}, }, ], - '@babel/preset-flow', ], }; diff --git a/e2e/coverage-remapping/package.json b/e2e/coverage-remapping/package.json index 293ece57d892..4aaa9f2b751e 100644 --- a/e2e/coverage-remapping/package.json +++ b/e2e/coverage-remapping/package.json @@ -4,13 +4,7 @@ "transform": { "^.+\\.(ts|js)$": "/typescriptPreprocessor.js" }, - "testRegex": "/__tests__/.*\\.(ts|tsx|js)$", - "testEnvironment": "node", - "moduleFileExtensions": [ - "ts", - "tsx", - "js" - ] + "testEnvironment": "node" }, "dependencies": { "typescript": "^1.8.10" diff --git a/e2e/stack-trace-source-maps/package.json b/e2e/stack-trace-source-maps/package.json index 5a20e78c8014..a5dbb3f82ea9 100644 --- a/e2e/stack-trace-source-maps/package.json +++ b/e2e/stack-trace-source-maps/package.json @@ -5,10 +5,6 @@ "^.+\\.(ts)$": "/preprocessor.js" }, "testEnvironment": "node", - "moduleFileExtensions": [ - "ts", - "js" - ], "testRegex": "fails" }, "dependencies": { diff --git a/e2e/typescript-coverage/package.json b/e2e/typescript-coverage/package.json index 667e970829c2..ffe9414a2849 100644 --- a/e2e/typescript-coverage/package.json +++ b/e2e/typescript-coverage/package.json @@ -4,17 +4,9 @@ "transform": { "^.+\\.(ts|js)$": "/typescriptPreprocessor.js" }, - "testMatch": [ - "**/__tests__/*.+(ts|tsx|js)" - ], - "testEnvironment": "node", - "moduleFileExtensions": [ - "ts", - "tsx", - "js" - ] + "testEnvironment": "node" }, "dependencies": { - "typescript": "^1.8.10" + "typescript": "^3.3.1" } } diff --git a/e2e/typescript-coverage/yarn.lock b/e2e/typescript-coverage/yarn.lock index ea260b12e78a..1cfa31a1591f 100644 --- a/e2e/typescript-coverage/yarn.lock +++ b/e2e/typescript-coverage/yarn.lock @@ -2,7 +2,7 @@ # yarn lockfile v1 -typescript@^1.8.10: - version "1.8.10" - resolved "https://registry.yarnpkg.com/typescript/-/typescript-1.8.10.tgz#b475d6e0dff0bf50f296e5ca6ef9fbb5c7320f1e" - integrity sha1-tHXW4N/wv1DyluXKbvn7tccyDx4= +typescript@^3.3.1: + version "3.3.1" + resolved "https://registry.yarnpkg.com/typescript/-/typescript-3.3.1.tgz#6de14e1db4b8a006ac535e482c8ba018c55f750b" + integrity sha512-cTmIDFW7O0IHbn1DPYjkiebHxwtCMU+eTy30ZtJNBPF9j2O1ITu5XH2YnBeVRKWHqF+3JQwWJv0Q0aUgX8W7IA== diff --git a/jest.config.js b/jest.config.js index f0c85d2cdb81..999b16dd01ca 100644 --- a/jest.config.js +++ b/jest.config.js @@ -56,6 +56,6 @@ module.exports = { '/e2e/__tests__/iterator-to-null-test.js', ], transform: { - '^.+\\.js$': '/packages/babel-jest', + '^.+\\.[jt]sx?$': '/packages/babel-jest', }, }; diff --git a/package.json b/package.json index 7b1a06e700a2..8d684d5e9566 100644 --- a/package.json +++ b/package.json @@ -1,13 +1,17 @@ { "private": true, "devDependencies": { - "@babel/core": "^7.1.0", + "@babel/core": "^7.2.2", "@babel/plugin-transform-modules-commonjs": "^7.1.0", "@babel/plugin-transform-strict-mode": "^7.0.0", "@babel/preset-env": "^7.1.0", "@babel/preset-flow": "^7.0.0", "@babel/preset-react": "^7.0.0", + "@babel/preset-typescript": "^7.0.0", "@babel/register": "^7.0.0", + "@types/babel__core": "^7.0.0", + "@types/babel__generator": "^7.0.0", + "@types/babel__template": "^7.0.0", "ansi-regex": "^4.0.0", "ansi-styles": "^3.2.0", "babel-eslint": "^9.0.0", @@ -60,7 +64,7 @@ "slash": "^2.0.0", "string-length": "^2.0.0", "strip-ansi": "^5.0.0", - "typescript": "^3.0.3", + "typescript": "^3.3.1", "webpack": "^4.28.4" }, "scripts": { diff --git a/scripts/babel-plugin-jest-replace-ts-export-assignment.js b/scripts/babel-plugin-jest-replace-ts-export-assignment.js new file mode 100644 index 000000000000..65722500d5cc --- /dev/null +++ b/scripts/babel-plugin-jest-replace-ts-export-assignment.js @@ -0,0 +1,26 @@ +/** + * Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + */ + +'use strict'; + +// Replace `export =` with `module.exports` which allows us to keep CJS semantics + +module.exports = ({template}) => { + const moduleExportsDeclaration = template(` + module.exports = ASSIGNMENT; + `); + return { + name: 'jest-replace-ts-export-assignment', + visitor: { + TSExportAssignment(path) { + path.replaceWith( + moduleExportsDeclaration({ASSIGNMENT: path.node.expression}) + ); + }, + }, + }; +}; diff --git a/scripts/browserBuild.js b/scripts/browserBuild.js index 60f9c75c65d4..7ca65961a13e 100644 --- a/scripts/browserBuild.js +++ b/scripts/browserBuild.js @@ -11,10 +11,13 @@ const webpack = require('webpack'); const camelCase = require('camelcase'); const rimraf = require('rimraf'); +const transformOptions = require('../babel.config.js'); + const babelEs5Options = { // Dont load other config files babelrc: false, configFile: false, + overrides: transformOptions.overrides, plugins: ['@babel/plugin-transform-strict-mode'], presets: [ [ @@ -27,7 +30,6 @@ const babelEs5Options = { targets: 'IE 11', }, ], - '@babel/preset-flow', ], }; @@ -63,6 +65,7 @@ function browserBuild(pkgName, entryPath, destination) { '../packages/expect/build/fakeChalk.js' ), }, + extensions: ['.js', '.json', '.ts'], }, node: { fs: 'empty', diff --git a/scripts/build.js b/scripts/build.js index 503e8a087ddb..9afc50653ad6 100644 --- a/scripts/build.js +++ b/scripts/build.js @@ -15,7 +15,7 @@ * node ./scripts/build.js * node ./scripts/build.js /users/123/jest/packages/jest-111/src/111.js * - * NOTE: this script is node@4 compatible + * NOTE: this script is node@6 compatible */ 'use strict'; @@ -24,6 +24,7 @@ const fs = require('fs'); const path = require('path'); const glob = require('glob'); const mkdirp = require('mkdirp'); +const execa = require('execa'); const babel = require('@babel/core'); const chalk = require('chalk'); @@ -38,13 +39,13 @@ const SRC_DIR = 'src'; const BUILD_DIR = 'build'; const BUILD_ES5_DIR = 'build-es5'; const JS_FILES_PATTERN = '**/*.js'; +const TS_FILES_PATTERN = '**/*.ts'; const IGNORE_PATTERN = '**/__{tests,mocks}__/**'; const PACKAGES_DIR = path.resolve(__dirname, '../packages'); const INLINE_REQUIRE_BLACKLIST = /packages\/expect|(jest-(circus|diff|get-type|jasmine2|matcher-utils|message-util|regex-util|snapshot))|pretty-format\//; const transformOptions = require('../babel.config.js'); -transformOptions.babelrc = false; const prettierConfig = prettier.resolveConfig.sync(__filename); prettierConfig.trailingComma = 'none'; @@ -73,19 +74,18 @@ function getBuildPath(file, buildFolder) { const pkgSrcPath = path.resolve(PACKAGES_DIR, pkgName, SRC_DIR); const pkgBuildPath = path.resolve(PACKAGES_DIR, pkgName, buildFolder); const relativeToSrcPath = path.relative(pkgSrcPath, file); - return path.resolve(pkgBuildPath, relativeToSrcPath); + return path.resolve(pkgBuildPath, relativeToSrcPath).replace(/\.ts$/, '.js'); } function buildNodePackage(p) { const srcDir = path.resolve(p, SRC_DIR); const pattern = path.resolve(srcDir, '**/*'); - const files = glob.sync(pattern, { - nodir: true, - }); + const files = glob.sync(pattern, {nodir: true}); process.stdout.write(adjustToTerminalWidth(`${path.basename(p)}\n`)); files.forEach(file => buildFile(file, true)); + process.stdout.write(`${OK}\n`); } @@ -104,11 +104,13 @@ function buildBrowserPackage(p) { `browser field for ${pkgJsonPath} should start with "${BUILD_ES5_DIR}"` ); } - browserBuild( - p.split('/').pop(), - path.resolve(srcDir, 'index.js'), - path.resolve(p, browser) - ) + let indexFile = path.resolve(srcDir, 'index.js'); + + if (!fs.existsSync(indexFile)) { + indexFile = indexFile.replace(/\.js$/, '.ts'); + } + + browserBuild(p.split('/').pop(), indexFile, path.resolve(p, browser)) .then(() => { process.stdout.write(adjustToTerminalWidth(`${path.basename(p)}\n`)); process.stdout.write(`${OK}\n`); @@ -134,7 +136,10 @@ function buildFile(file, silent) { } mkdirp.sync(path.dirname(destPath), '777'); - if (!micromatch.isMatch(file, JS_FILES_PATTERN)) { + if ( + !micromatch.isMatch(file, JS_FILES_PATTERN) && + !micromatch.isMatch(file, TS_FILES_PATTERN) + ) { fs.createReadStream(file).pipe(fs.createWriteStream(destPath)); silent || process.stdout.write( @@ -186,10 +191,21 @@ function buildFile(file, silent) { const files = process.argv.slice(2); +function compileTypes(packages) { + const packageWithTs = packages.filter(p => + fs.existsSync(path.resolve(p, 'tsconfig.json')) + ); + + execa.sync('tsc', ['-b', ...packageWithTs]); +} + if (files.length) { files.forEach(buildFile); } else { const packages = getPackages(); + process.stdout.write(chalk.inverse(' Typechecking \n')); + compileTypes(packages); + process.stdout.write(`${OK}\n\n`); process.stdout.write(chalk.inverse(' Building packages \n')); packages.forEach(buildNodePackage); process.stdout.write('\n'); diff --git a/scripts/watch.js b/scripts/watch.js index e26e24241cde..d2ab88c9791a 100644 --- a/scripts/watch.js +++ b/scripts/watch.js @@ -13,6 +13,7 @@ const fs = require('fs'); const {execSync} = require('child_process'); const path = require('path'); const chalk = require('chalk'); +const execa = require('execa'); const getPackages = require('./getPackages'); const BUILD_CMD = `node ${path.resolve(__dirname, './build.js')}`; @@ -27,11 +28,12 @@ const exists = filename => { }; const rebuild = filename => filesToBuild.set(filename, true); -getPackages().forEach(p => { +const packages = getPackages(); +packages.forEach(p => { const srcDir = path.resolve(p, 'src'); try { fs.accessSync(srcDir, fs.F_OK); - fs.watch(path.resolve(p, 'src'), {recursive: true}, (event, filename) => { + fs.watch(srcDir, {recursive: true}, (event, filename) => { const filePath = path.resolve(srcDir, filename); if ((event === 'change' || event === 'rename') && exists(filePath)) { @@ -55,6 +57,12 @@ getPackages().forEach(p => { } }); +const packageWithTs = packages.filter(p => + fs.existsSync(path.resolve(p, 'tsconfig.json')) +); + +execa('tsc', ['-b', ...packageWithTs, '--watch']); + setInterval(() => { const files = Array.from(filesToBuild.keys()); if (files.length) { diff --git a/tsconfig.json b/tsconfig.json new file mode 100644 index 000000000000..6b1f7373d1ab --- /dev/null +++ b/tsconfig.json @@ -0,0 +1,26 @@ +{ + "compilerOptions": { + "target": "es2017", + "module": "commonjs", + "lib": ["dom", "es2017"], + "declaration": true, + "declarationMap": true, + "composite": true, + "emitDeclarationOnly": true, + // "importHelpers": true, + // "isolatedModules": true, + + "strict": true, + + /* Additional Checks */ + "noUnusedLocals": true, + "noUnusedParameters": true, + "noImplicitReturns": true, + "noFallthroughCasesInSwitch": true, + + /* Module Resolution Options */ + "moduleResolution": "node", + "esModuleInterop": true + }, + "exclude": ["**/__tests__/**/*", "**/build/**/*", "**/build-es5/**/*"] +} diff --git a/yarn.lock b/yarn.lock index 86c72f3c0ded..2bf618f358a8 100644 --- a/yarn.lock +++ b/yarn.lock @@ -9,7 +9,7 @@ dependencies: "@babel/highlight" "^7.0.0" -"@babel/core@*", "@babel/core@^7.0.0", "@babel/core@^7.1.0": +"@babel/core@*", "@babel/core@^7.0.0", "@babel/core@^7.1.0", "@babel/core@^7.2.2": version "7.2.2" resolved "https://registry.yarnpkg.com/@babel/core/-/core-7.2.2.tgz#07adba6dde27bb5ad8d8672f15fde3e08184a687" integrity sha512-59vB0RWt09cAct5EIe58+NzGP4TFSD3Bz//2/ELy3ZeTeKF6VTD1AXlH8BGGbCX0PuobZBsIzO7IAI9PH67eKw== @@ -786,7 +786,7 @@ "@babel/plugin-transform-react-jsx-self" "^7.0.0" "@babel/plugin-transform-react-jsx-source" "^7.0.0" -"@babel/preset-typescript@*": +"@babel/preset-typescript@*", "@babel/preset-typescript@^7.0.0": version "7.1.0" resolved "https://registry.yarnpkg.com/@babel/preset-typescript/-/preset-typescript-7.1.0.tgz#49ad6e2084ff0bfb5f1f7fb3b5e76c434d442c7f" integrity sha512-LYveByuF9AOM8WrsNne5+N79k1YxjNB6gmpCQsnuSBAcV8QUeB+ZUxQzL7Rz7HksPbahymKkq2qBR+o36ggFZA== @@ -1491,7 +1491,7 @@ resolved "https://registry.yarnpkg.com/@types/babel__code-frame/-/babel__code-frame-7.0.0.tgz#d5658827984c1e386c1b4ef30699b344d3f732a2" integrity sha512-Rt0KuqopAdtpyvxO0JbKbwgtw7B+y0NQpTXns+tiz1lqGXywOESSKIiiQt0wnCreqEKvmrArH7KZ6bQg+w8BoA== -"@types/babel__core@^7.0.4": +"@types/babel__core@^7.0.0", "@types/babel__core@^7.0.4": version "7.0.4" resolved "https://registry.yarnpkg.com/@types/babel__core/-/babel__core-7.0.4.tgz#14b30c11113bad353cabfaea73e327b48edb0f0e" integrity sha512-2Y2RK1BN5BRFfhneGfQA8mmFmTANbzGgS5uQPluoRqGNWb6uAcefqxzNbqgxPpmPkLqKapQfmYcyyl5iAQV+fA== @@ -1499,6 +1499,21 @@ "@babel/parser" "^7.1.0" "@babel/types" "^7.0.0" +"@types/babel__generator@^7.0.0": + version "7.0.1" + resolved "https://registry.yarnpkg.com/@types/babel__generator/-/babel__generator-7.0.1.tgz#533bd37e7be8af27ebf8fcc0a053cfa4c03f4c5c" + integrity sha512-QZ+oM5v3lAh/4DqWDyCL0rVi/BJlKRANDEpShxt3Lg+rhbFA78Ec7N+8lcAIpziA/Mfp/1ShDJj2Ti3HJ/JPxA== + dependencies: + "@babel/types" "^7.0.0" + +"@types/babel__template@^7.0.0": + version "7.0.1" + resolved "https://registry.yarnpkg.com/@types/babel__template/-/babel__template-7.0.1.tgz#8de6effa729bf0b0f65eb72399b629a3998a7f10" + integrity sha512-LT1zwkpL0/2oBP+npLaOCYSWv47cxbdAvONutjalMdCIBfjtfzVNnT8rgllBmsr15QAdAZDOmYw1CPhLB2JCtA== + dependencies: + "@babel/parser" "^7.1.0" + "@babel/types" "^7.0.0" + "@types/babel__traverse@^7.0.4": version "7.0.4" resolved "https://registry.yarnpkg.com/@types/babel__traverse/-/babel__traverse-7.0.4.tgz#de652399bd8493ab712e4d6b68031b7a2f72ad5f" @@ -12624,10 +12639,10 @@ typedarray@^0.0.6: resolved "https://registry.yarnpkg.com/typedarray/-/typedarray-0.0.6.tgz#867ac74e3864187b1d3d47d996a78ec5c8830777" integrity sha1-hnrHTjhkGHsdPUfZlqeOxciDB3c= -typescript@^3.0.0, typescript@^3.0.3: - version "3.2.2" - resolved "https://registry.yarnpkg.com/typescript/-/typescript-3.2.2.tgz#fe8101c46aa123f8353523ebdcf5730c2ae493e5" - integrity sha512-VCj5UiSyHBjwfYacmDuc/NOk4QQixbE+Wn7MFJuS0nRuPQbof132Pw4u53dm264O8LPc2MVsc7RJNml5szurkg== +typescript@^3.0.0, typescript@^3.3.1: + version "3.3.1" + resolved "https://registry.yarnpkg.com/typescript/-/typescript-3.3.1.tgz#6de14e1db4b8a006ac535e482c8ba018c55f750b" + integrity sha512-cTmIDFW7O0IHbn1DPYjkiebHxwtCMU+eTy30ZtJNBPF9j2O1ITu5XH2YnBeVRKWHqF+3JQwWJv0Q0aUgX8W7IA== ua-parser-js@^0.7.18: version "0.7.19" From 72f19e550099339c45a59adbd164059a182d198d Mon Sep 17 00:00:00 2001 From: Simen Bekkhus Date: Tue, 5 Feb 2019 17:16:44 +0100 Subject: [PATCH 3/6] chore: fix linting --- .eslintrc.js | 14 +++ .../coverageRemapping.test.js.snap | 108 +++++++++--------- .../__tests__/typescript.test.ts | 2 - e2e/babel-plugin-jest-hoist/entry.ts | 1 - e2e/coverage-remapping/covered.ts | 2 + package.json | 5 +- yarn.lock | 77 ++++++++++++- 7 files changed, 149 insertions(+), 60 deletions(-) diff --git a/.eslintrc.js b/.eslintrc.js index 4a3ba1dcff90..d7ed999831eb 100644 --- a/.eslintrc.js +++ b/.eslintrc.js @@ -15,6 +15,19 @@ module.exports = { 'prettier/flowtype', ], overrides: [ + { + files: ['*.ts', '*.tsx'], + parser: '@typescript-eslint/parser', + plugins: ['@typescript-eslint/eslint-plugin'], + rules: { + '@typescript-eslint/no-unused-vars': [ + 'error', + {argsIgnorePattern: '^_'}, + ], + 'import/order': 'error', + 'no-unused-vars': 'off', + }, + }, // to make it more suitable for running on code examples in docs/ folder { files: ['*.md'], @@ -122,6 +135,7 @@ module.exports = { '^types/(.*)': './types/$1', }, }, + 'eslint-import-resolver-typescript': true, }, }, }; diff --git a/e2e/__tests__/__snapshots__/coverageRemapping.test.js.snap b/e2e/__tests__/__snapshots__/coverageRemapping.test.js.snap index 3faf7a0a5362..ee84a8e4d887 100644 --- a/e2e/__tests__/__snapshots__/coverageRemapping.test.js.snap +++ b/e2e/__tests__/__snapshots__/coverageRemapping.test.js.snap @@ -27,32 +27,32 @@ Object { "loc": Object { "end": Object { "column": 35, - "line": 4, + "line": 6, }, "start": Object { "column": 34, - "line": 4, + "line": 6, }, }, "locations": Array [ Object { "end": Object { "column": 35, - "line": 4, + "line": 6, }, "start": Object { "column": 34, - "line": 4, + "line": 6, }, }, Object { "end": Object { "column": 39, - "line": 4, + "line": 6, }, "start": Object { "column": 38, - "line": 4, + "line": 6, }, }, ], @@ -62,32 +62,32 @@ Object { "loc": Object { "end": Object { "column": 35, - "line": 5, + "line": 7, }, "start": Object { "column": 34, - "line": 5, + "line": 7, }, }, "locations": Array [ Object { "end": Object { "column": 35, - "line": 5, + "line": 7, }, "start": Object { "column": 34, - "line": 5, + "line": 7, }, }, Object { "end": Object { "column": 39, - "line": 5, + "line": 7, }, "start": Object { "column": 38, - "line": 5, + "line": 7, }, }, ], @@ -97,42 +97,42 @@ Object { "loc": Object { "end": Object { "column": 31, - "line": 6, + "line": 8, }, "start": Object { "column": 27, - "line": 6, + "line": 8, }, }, "locations": Array [ Object { "end": Object { "column": 31, - "line": 6, + "line": 8, }, "start": Object { "column": 27, - "line": 6, + "line": 8, }, }, Object { "end": Object { "column": 39, - "line": 6, + "line": 8, }, "start": Object { "column": 35, - "line": 6, + "line": 8, }, }, Object { "end": Object { "column": 48, - "line": 6, + "line": 8, }, "start": Object { "column": 43, - "line": 6, + "line": 8, }, }, ], @@ -142,32 +142,32 @@ Object { "loc": Object { "end": Object { "column": 40, - "line": 7, + "line": 9, }, "start": Object { "column": 30, - "line": 7, + "line": 9, }, }, "locations": Array [ Object { "end": Object { "column": 40, - "line": 7, + "line": 9, }, "start": Object { "column": 30, - "line": 7, + "line": 9, }, }, Object { "end": Object { "column": 53, - "line": 7, + "line": 9, }, "start": Object { "column": 43, - "line": 7, + "line": 9, }, }, ], @@ -184,21 +184,21 @@ Object { "decl": Object { "end": Object { "column": 29, - "line": 3, + "line": 5, }, "start": Object { "column": 9, - "line": 3, + "line": 5, }, }, "loc": Object { "end": Object { "column": 1, - "line": 10, + "line": 12, }, "start": Object { "column": 49, - "line": 3, + "line": 5, }, }, "name": "difference", @@ -207,21 +207,21 @@ Object { "decl": Object { "end": Object { "column": 36, - "line": 7, + "line": 9, }, "start": Object { "column": 30, - "line": 7, + "line": 9, }, }, "loc": Object { "end": Object { "column": 40, - "line": 7, + "line": 9, }, "start": Object { "column": 30, - "line": 7, + "line": 9, }, }, "name": "(anonymous_1)", @@ -230,21 +230,21 @@ Object { "decl": Object { "end": Object { "column": 49, - "line": 7, + "line": 9, }, "start": Object { "column": 43, - "line": 7, + "line": 9, }, }, "loc": Object { "end": Object { "column": 53, - "line": 7, + "line": 9, }, "start": Object { "column": 43, - "line": 7, + "line": 9, }, }, "name": "(anonymous_2)", @@ -265,81 +265,81 @@ Object { "0": Object { "end": Object { "column": 2, - "line": 10, + "line": 12, }, "start": Object { "column": 0, - "line": 3, + "line": 5, }, }, "1": Object { "end": Object { "column": 39, - "line": 4, + "line": 6, }, "start": Object { "column": 27, - "line": 4, + "line": 6, }, }, "2": Object { "end": Object { "column": 39, - "line": 5, + "line": 7, }, "start": Object { "column": 27, - "line": 5, + "line": 7, }, }, "3": Object { "end": Object { "column": 48, - "line": 6, + "line": 8, }, "start": Object { "column": 27, - "line": 6, + "line": 8, }, }, "4": Object { "end": Object { "column": 53, - "line": 7, + "line": 9, }, "start": Object { "column": 23, - "line": 7, + "line": 9, }, }, "5": Object { "end": Object { "column": 43, - "line": 7, + "line": 9, }, "start": Object { "column": 36, - "line": 7, + "line": 9, }, }, "6": Object { "end": Object { "column": 54, - "line": 7, + "line": 9, }, "start": Object { "column": 49, - "line": 7, + "line": 9, }, }, "7": Object { "end": Object { "column": 15, - "line": 9, + "line": 11, }, "start": Object { "column": 2, - "line": 9, + "line": 11, }, }, }, diff --git a/e2e/babel-plugin-jest-hoist/__tests__/typescript.test.ts b/e2e/babel-plugin-jest-hoist/__tests__/typescript.test.ts index 820294d1973e..ef772b495891 100644 --- a/e2e/babel-plugin-jest-hoist/__tests__/typescript.test.ts +++ b/e2e/babel-plugin-jest-hoist/__tests__/typescript.test.ts @@ -7,8 +7,6 @@ * @emails oncall+jsinfra */ -/* eslint-disable import/no-unresolved */ - import {Color} from '../types'; import {color} from '../entry'; diff --git a/e2e/babel-plugin-jest-hoist/entry.ts b/e2e/babel-plugin-jest-hoist/entry.ts index 00ed0fce24fa..bafd2d4f8606 100644 --- a/e2e/babel-plugin-jest-hoist/entry.ts +++ b/e2e/babel-plugin-jest-hoist/entry.ts @@ -5,7 +5,6 @@ * LICENSE file in the root directory of this source tree. */ -// eslint-disable-next-line import/no-unresolved import {Color} from './types'; export const color: Color = 'red'; diff --git a/e2e/coverage-remapping/covered.ts b/e2e/coverage-remapping/covered.ts index a11ac4f3cfb8..84b8f7ab9c2e 100644 --- a/e2e/coverage-remapping/covered.ts +++ b/e2e/coverage-remapping/covered.ts @@ -1,5 +1,7 @@ // Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved. +/* eslint-disable @typescript-eslint/no-unused-vars */ + export = function difference(a: number, b: number): number { const branch1: boolean = true ? 1 : 0; const branch2: boolean = true ? 1 : 0; diff --git a/package.json b/package.json index 8d684d5e9566..1f0df8564ba8 100644 --- a/package.json +++ b/package.json @@ -12,6 +12,8 @@ "@types/babel__core": "^7.0.0", "@types/babel__generator": "^7.0.0", "@types/babel__template": "^7.0.0", + "@typescript-eslint/eslint-plugin": "^1.2.0", + "@typescript-eslint/parser": "^1.2.0", "ansi-regex": "^4.0.0", "ansi-styles": "^3.2.0", "babel-eslint": "^9.0.0", @@ -22,6 +24,7 @@ "debug": "^4.0.1", "eslint": "^5.6.0", "eslint-config-prettier": "^3.1.0", + "eslint-import-resolver-typescript": "^1.1.1", "eslint-plugin-babel": "^5.1.0", "eslint-plugin-flowtype": "^2.35.0", "eslint-plugin-import": "^2.6.0", @@ -75,7 +78,7 @@ "clean-e2e": "find ./e2e -not \\( -path ./e2e/presets/js -prune \\) -not \\( -path ./e2e/presets/json -prune \\) -mindepth 2 -type d \\( -name node_modules -prune \\) -exec rm -r '{}' +", "jest": "node ./packages/jest-cli/bin/jest.js", "jest-coverage": "yarn jest --coverage", - "lint": "eslint . --cache --report-unused-disable-directives --ext js,md", + "lint": "eslint . --cache --report-unused-disable-directives --ext js,jsx,ts,tsx,md", "lint-es5-build": "eslint --no-eslintrc --no-ignore --env=browser packages/*/build-es5", "lint:md": "yarn --silent lint:md:ci --fix", "lint:md:ci": "prettylint '**/*.{md,yml,yaml}' --ignore-path .gitignore", diff --git a/yarn.lock b/yarn.lock index 2bf618f358a8..ffc57a710145 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1650,6 +1650,11 @@ "@types/tough-cookie" "*" parse5 "^4.0.0" +"@types/json5@^0.0.29": + version "0.0.29" + resolved "https://registry.yarnpkg.com/@types/json5/-/json5-0.0.29.tgz#ee28707ae94e11d2b827bcbe5270bcea7f3e71ee" + integrity sha1-7ihweulOEdK4J7y+UnC86n8+ce4= + "@types/leven@^2.1.1": version "2.1.1" resolved "https://registry.yarnpkg.com/@types/leven/-/leven-2.1.1.tgz#7cdc02ec636f80dc0bb0a53d8ee7eff2d8e8e1d8" @@ -1791,6 +1796,32 @@ resolved "https://registry.yarnpkg.com/@types/yargs/-/yargs-12.0.2.tgz#7569157b2601d49d4442023c0d22f81d23f62d1e" integrity sha512-NUyxaQW48vjeDHybmhy7CFx/6of1+PoaEGPMI+0PzBVr5s3BTELT7gV4lNaxUsKllNS1YAjkeTEhBtzIDWs2WQ== +"@typescript-eslint/eslint-plugin@^1.2.0": + version "1.2.0" + resolved "https://registry.yarnpkg.com/@typescript-eslint/eslint-plugin/-/eslint-plugin-1.2.0.tgz#a73021a0d5bd1116a88689186844ce4421d52ab0" + integrity sha512-em3q8Gg3euesNohOwaz+SqrQM2Jn1ZWELMM+vgKi4dEk5fC+eVoi05yfubgAi2qPE5ifG4F0SOXM1XTamB0Aig== + dependencies: + "@typescript-eslint/parser" "1.2.0" + requireindex "^1.2.0" + tsutils "^3.7.0" + +"@typescript-eslint/parser@1.2.0", "@typescript-eslint/parser@^1.2.0": + version "1.2.0" + resolved "https://registry.yarnpkg.com/@typescript-eslint/parser/-/parser-1.2.0.tgz#256de163b7cb0d79d0388266a5bfb5585bccb1ff" + integrity sha512-IXXiXgs6ocKTmtbzJjGyUvRHZFLuk2mYXyk+ayEql1woh1+rYS/Uct8b4jGtfHG8ZRUBZ12zjzsrDKFYC2pbrQ== + dependencies: + "@typescript-eslint/typescript-estree" "1.2.0" + eslint-scope "^4.0.0" + eslint-visitor-keys "^1.0.0" + +"@typescript-eslint/typescript-estree@1.2.0": + version "1.2.0" + resolved "https://registry.yarnpkg.com/@typescript-eslint/typescript-estree/-/typescript-estree-1.2.0.tgz#d9043a407d5e0f07db2b4a80d86852f7826c34f0" + integrity sha512-YGh4egbiCfUObvi6fnQNzJAMmScMGCjG5cRHaapW7GpwujWYQymLlids88imnhcTbOx8Mlz1OXFIuxyPBXK6Ig== + dependencies: + lodash.unescape "4.0.1" + semver "5.5.0" + "@webassemblyjs/ast@1.7.11": version "1.7.11" resolved "https://registry.yarnpkg.com/@webassemblyjs/ast/-/ast-1.7.11.tgz#b988582cafbb2b095e8b556526f30c90d057cace" @@ -4280,7 +4311,7 @@ deep-is@~0.1.3: resolved "https://registry.yarnpkg.com/deep-is/-/deep-is-0.1.3.tgz#b369d6fb5dbc13eecf524f91b070feedc357cf34" integrity sha1-s2nW+128E+7PUk+RsHD+7cNXzzQ= -deepmerge@^2.1.1: +deepmerge@^2.0.1, deepmerge@^2.1.1: version "2.2.1" resolved "https://registry.yarnpkg.com/deepmerge/-/deepmerge-2.2.1.tgz#5d3ff22a01c00f645405a2fbc17d0778a1801170" integrity sha512-R9hc1Xa/NOBi9WRVUWg19rl1UB7Tt4kuPd+thNJgFZoxXsTz7ncaPaeIm+40oSGuP33DfMb4sZt1QIGiJzC4EA== @@ -4953,6 +4984,15 @@ eslint-import-resolver-node@^0.3.1: debug "^2.6.9" resolve "^1.5.0" +eslint-import-resolver-typescript@^1.1.1: + version "1.1.1" + resolved "https://registry.yarnpkg.com/eslint-import-resolver-typescript/-/eslint-import-resolver-typescript-1.1.1.tgz#e6d42172b95144ef16610fe104ef38340edea591" + integrity sha512-jqSfumQ+H5y3FUJ6NjRkbOQSUOlbBucGTN3ELymOtcDBbPjVdm/luvJuCfCaIXGh8sEF26ma1qVdtDgl9ndhUg== + dependencies: + debug "^4.0.1" + resolve "^1.4.0" + tsconfig-paths "^3.6.0" + eslint-module-utils@^2.2.0: version "2.2.0" resolved "https://registry.yarnpkg.com/eslint-module-utils/-/eslint-module-utils-2.2.0.tgz#b270362cd88b1a48ad308976ce7fa54e98411746" @@ -8199,6 +8239,11 @@ lodash.throttle@^4.1.1: resolved "https://registry.yarnpkg.com/lodash.throttle/-/lodash.throttle-4.1.1.tgz#c23e91b710242ac70c37f1e1cda9274cc39bf2f4" integrity sha1-wj6RtxAkKscMN/HhzaknTMOb8vQ= +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" @@ -11244,6 +11289,11 @@ require-main-filename@^1.0.1: resolved "https://registry.yarnpkg.com/require-main-filename/-/require-main-filename-1.0.1.tgz#97f717b69d48784f5f526a6c5aa8ffdda055a4d1" integrity sha1-l/cXtp1IeE9fUmpsWqj/3aBVpNE= +requireindex@^1.2.0: + version "1.2.0" + resolved "https://registry.yarnpkg.com/requireindex/-/requireindex-1.2.0.tgz#3463cdb22ee151902635aa6c9535d4de9c2ef1ef" + integrity sha512-L9jEkOi3ASd9PYit2cwRfyppc9NoABujTP8/5gFcbERmo5jUoAKovIC3fsF17pkTnGsrByysqX+Kxd2OTNI1ww== + requires-port@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/requires-port/-/requires-port-1.0.0.tgz#925d2601d39ac485e091cf0da5c6e694dc3dcaff" @@ -11519,6 +11569,11 @@ semver-truncate@^1.1.2: resolved "https://registry.yarnpkg.com/semver/-/semver-5.6.0.tgz#7e74256fbaa49c75aa7c7a205cc22799cac80004" integrity sha512-RS9R6R35NYgQn++fkDWaOmqGoj4Ek9gGs+DPxNUZKuwE183xjJroKvyo1IzVFeXvUrvmALy6FWD5xrdJT25gMg== +semver@5.5.0: + version "5.5.0" + resolved "https://registry.yarnpkg.com/semver/-/semver-5.5.0.tgz#dc4bbc7a6ca9d916dee5d43516f0092b58f7b8ab" + integrity sha512-4SJ3dm0WAwWy/NVeioZh5AntkdJoWKxHxcmyP622fOkgHa4z3R0TdBJICINyaSDE6uNwVc8gZr+ZinwZAH4xIA== + semver@~5.3.0: version "5.3.0" resolved "https://registry.yarnpkg.com/semver/-/semver-5.3.0.tgz#9b2ce5d3de02d17c6012ad326aa6b4d0cf54f94f" @@ -12597,11 +12652,29 @@ truncate-html@^1.0.1: "@types/cheerio" "^0.22.8" cheerio "0.22.0" -tslib@^1.8.0, tslib@^1.9.0: +tsconfig-paths@^3.6.0: + version "3.7.0" + resolved "https://registry.yarnpkg.com/tsconfig-paths/-/tsconfig-paths-3.7.0.tgz#02ae978db447b22e09dafcd4198be95c4885ceb2" + integrity sha512-7iE+Q/2E1lgvxD+c0Ot+GFFmgmfIjt/zCayyruXkXQ84BLT85gHXy0WSoQSiuFX9+d+keE/jiON7notV74ZY+A== + dependencies: + "@types/json5" "^0.0.29" + deepmerge "^2.0.1" + json5 "^1.0.1" + minimist "^1.2.0" + strip-bom "^3.0.0" + +tslib@^1.8.0, tslib@^1.8.1, tslib@^1.9.0: version "1.9.3" resolved "https://registry.yarnpkg.com/tslib/-/tslib-1.9.3.tgz#d7e4dd79245d85428c4d7e4822a79917954ca286" integrity sha512-4krF8scpejhaOgqzBEcGM7yDIEfi0/8+8zDRZhNZZ2kjmHJ4hv3zCbQWxoJGz1iw5U0Jl0nma13xzHXcncMavQ== +tsutils@^3.7.0: + version "3.8.0" + resolved "https://registry.yarnpkg.com/tsutils/-/tsutils-3.8.0.tgz#7a3dbadc88e465596440622b65c04edc8e187ae5" + integrity sha512-XQdPhgcoTbCD8baXC38PQ0vpTZ8T3YrE+vR66YIj/xvDt1//8iAhafpIT/4DmvzzC1QFapEImERu48Pa01dIUA== + dependencies: + tslib "^1.8.1" + tty-browserify@0.0.0: version "0.0.0" resolved "https://registry.yarnpkg.com/tty-browserify/-/tty-browserify-0.0.0.tgz#a157ba402da24e9bf957f9aa69d524eed42901a6" From 7b08165412bd46438a9048e70d15c12a6b88dc4d Mon Sep 17 00:00:00 2001 From: Simen Bekkhus Date: Tue, 5 Feb 2019 20:31:00 +0100 Subject: [PATCH 4/6] skip `tsc` run if there are no packages to compile Will revert this when we actually have some --- scripts/build.js | 4 +++- scripts/watch.js | 4 +++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/scripts/build.js b/scripts/build.js index 9afc50653ad6..78d67bdbec5f 100644 --- a/scripts/build.js +++ b/scripts/build.js @@ -196,7 +196,9 @@ function compileTypes(packages) { fs.existsSync(path.resolve(p, 'tsconfig.json')) ); - execa.sync('tsc', ['-b', ...packageWithTs]); + if (packageWithTs.length > 0) { + execa.sync('tsc', ['-b', ...packageWithTs]); + } } if (files.length) { diff --git a/scripts/watch.js b/scripts/watch.js index d2ab88c9791a..b40d670643b5 100644 --- a/scripts/watch.js +++ b/scripts/watch.js @@ -61,7 +61,9 @@ const packageWithTs = packages.filter(p => fs.existsSync(path.resolve(p, 'tsconfig.json')) ); -execa('tsc', ['-b', ...packageWithTs, '--watch']); +if (packageWithTs.length > 0) { + execa('tsc', ['-b', ...packageWithTs, '--watch']); +} setInterval(() => { const files = Array.from(filesToBuild.keys()); From 2600b9848dd091497488a9f189387738ce87d566 Mon Sep 17 00:00:00 2001 From: Simen Bekkhus Date: Tue, 5 Feb 2019 20:34:03 +0100 Subject: [PATCH 5/6] correct syntax in babel config --- babel.config.js | 2 +- package.json | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/babel.config.js b/babel.config.js index 21f020caca39..e295ec832457 100644 --- a/babel.config.js +++ b/babel.config.js @@ -10,7 +10,7 @@ module.exports = { { plugins: [ require.resolve( - './scripts/babel-plugin-jest-replace-ts-export-assignment.js', + './scripts/babel-plugin-jest-replace-ts-export-assignment.js' ), ], presets: ['@babel/preset-typescript'], diff --git a/package.json b/package.json index 1f0df8564ba8..6c0042975e2b 100644 --- a/package.json +++ b/package.json @@ -117,7 +117,8 @@ "e2e/*/**/*", "website/*.js", "website/*/**/*", - "eslintImportResolver.js" + "eslintImportResolver.js", + "babel.config.js" ], "options": { "printWidth": 80, From 75bbe9ca21ae3c31209d3c22c629311ea3d521a4 Mon Sep 17 00:00:00 2001 From: Simen Bekkhus Date: Wed, 6 Feb 2019 10:18:27 +0100 Subject: [PATCH 6/6] changelog --- CHANGELOG.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index ac6595a4dc8b..d039d87a4441 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,6 +6,8 @@ ### Chore & Maintenance +- `[*]`: Setup building, linting and testing of TypeScript ([#7808](https://github.com/facebook/jest/pull/7808)) + ### Performance ## 24.1.0