From ba946c4a3e4fe93ac2a31d488e379d26a07f75f3 Mon Sep 17 00:00:00 2001 From: Hannan Ali Date: Wed, 1 Mar 2017 04:18:12 +0500 Subject: [PATCH 01/28] add markdown plugin in eslint --- .eslintrc | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/.eslintrc b/.eslintrc index f7903ca3d7f9..71e4807594ba 100644 --- a/.eslintrc +++ b/.eslintrc @@ -1,4 +1,7 @@ { "extends": "./packages/eslint-config-fb-strict/index.js", - "parser": "babel-eslint" + "parser": "babel-eslint", + "plugins": [ + "markdown" + ] } From b56ca27eedba43ace6b0d64a771719fec938eab2 Mon Sep 17 00:00:00 2001 From: Hannan Ali Date: Wed, 1 Mar 2017 04:19:08 +0500 Subject: [PATCH 02/28] add lint-docs build step --- circle.yml | 1 + package.json | 2 + yarn.lock | 617 +++++++++++++++++++++++++++++++++++++++++++++++---- 3 files changed, 580 insertions(+), 40 deletions(-) diff --git a/circle.yml b/circle.yml index d23724c66cd1..b9d1c1f25466 100644 --- a/circle.yml +++ b/circle.yml @@ -30,6 +30,7 @@ test: - yarn run test-ci-partial - nvm alias default 7 - yarn run test-ci-partial + - yarn run lint-docs - DANGER_GITHUB_API_TOKEN="ab0c4d396c935d3abce""fc213176da6bb7b2996ff" yarn run danger - cd website && yarn run test diff --git a/package.json b/package.json index 98f3350c77d9..b25ebde93e4e 100644 --- a/package.json +++ b/package.json @@ -14,6 +14,7 @@ "eslint": "^3.11.1", "eslint-plugin-babel": "^4.0.0", "eslint-plugin-flowtype": "^2.28.2", + "eslint-plugin-markdown": "^1.0.0-beta.3", "eslint-plugin-react": "^6.7.1", "flow-bin": "^0.39.0", "glob": "^7.1.1", @@ -43,6 +44,7 @@ "jest": "node ./packages/jest-cli/bin/jest.js", "jest-coverage": "yarn run jest -- --coverage", "lint": "eslint . --cache", + "lint-docs": "eslint --no-ignore --ext md ./docs/*.md", "postinstall": "node ./scripts/postinstall.js && node ./scripts/build.js && (cd packages/eslint-plugin-jest && yarn link) && yarn link eslint-plugin-jest", "publish": "yarn run build-clean && yarn run build && lerna publish", "test-ci": "yarn run typecheck && yarn run lint && yarn run build && yarn run jest-coverage -- -i && yarn run test-examples && node scripts/mapCoverage.js && codecov", diff --git a/yarn.lock b/yarn.lock index 2dc03beab5fb..c187a49819cc 100644 --- a/yarn.lock +++ b/yarn.lock @@ -6,6 +6,10 @@ abab@^1.0.3: version "1.0.3" resolved "https://registry.yarnpkg.com/abab/-/abab-1.0.3.tgz#b81de5f7274ec4e756d797cd834f303642724e5d" +abbrev@1: + version "1.1.0" + resolved "https://registry.yarnpkg.com/abbrev/-/abbrev-1.1.0.tgz#d0554c2256636e2f56e7c2e5ad183f859428d81f" + acorn-globals@^3.1.0: version "3.1.0" resolved "https://registry.yarnpkg.com/acorn-globals/-/acorn-globals-3.1.0.tgz#fd8270f71fbb4996b004fa880ee5d46573a731bf" @@ -34,7 +38,7 @@ ajv-keywords@^1.0.0: version "1.5.1" resolved "https://registry.yarnpkg.com/ajv-keywords/-/ajv-keywords-1.5.1.tgz#314dd0a4b3368fad3dfcdc54ede6171b886daf3c" -ajv@^4.7.0: +ajv@^4.7.0, ajv@^4.9.1: version "4.11.3" resolved "https://registry.yarnpkg.com/ajv/-/ajv-4.11.3.tgz#ce30bdb90d1254f762c75af915fb3a63e7183d22" dependencies: @@ -53,7 +57,7 @@ amdefine@>=0.0.4: version "1.0.1" resolved "https://registry.yarnpkg.com/amdefine/-/amdefine-1.0.1.tgz#4a5282ac164729e93619bcfd3ad151f817ce91f5" -ansi-escapes@^1.1.0: +ansi-escapes@^1.0.0, ansi-escapes@^1.1.0: version "1.4.0" resolved "https://registry.yarnpkg.com/ansi-escapes/-/ansi-escapes-1.4.0.tgz#d3a8a83b319aa67793662b13e761c7911422306e" @@ -71,12 +75,30 @@ ansi-styles@^3.0.0: dependencies: color-convert "^1.0.0" +anymatch@^1.3.0: + version "1.3.0" + resolved "https://registry.yarnpkg.com/anymatch/-/anymatch-1.3.0.tgz#a3e52fa39168c825ff57b0248126ce5a8ff95507" + dependencies: + arrify "^1.0.0" + micromatch "^2.1.5" + append-transform@^0.4.0: version "0.4.0" resolved "https://registry.yarnpkg.com/append-transform/-/append-transform-0.4.0.tgz#d76ebf8ca94d276e247a36bad44a4b74ab611991" dependencies: default-require-extensions "^1.0.0" +aproba@^1.0.3: + version "1.1.1" + resolved "https://registry.yarnpkg.com/aproba/-/aproba-1.1.1.tgz#95d3600f07710aa0e9298c726ad5ecf2eacbabab" + +are-we-there-yet@~1.1.2: + version "1.1.2" + resolved "https://registry.yarnpkg.com/are-we-there-yet/-/are-we-there-yet-1.1.2.tgz#80e470e95a084794fe1899262c5667c6e88de1b3" + dependencies: + delegates "^1.0.0" + readable-stream "^2.0.0 || ^1.1.13" + argparse@^1.0.7: version "1.0.9" resolved "https://registry.yarnpkg.com/argparse/-/argparse-1.0.9.tgz#73d83bc263f86e97f8cc4f6bae1b0e90a7d22c86" @@ -154,6 +176,10 @@ ast-types@0.9.4: version "0.9.4" resolved "https://registry.yarnpkg.com/ast-types/-/ast-types-0.9.4.tgz#410d1f81890aeb8e0a38621558ba5869ae53c91b" +async-each@^1.0.0: + version "1.0.1" + resolved "https://registry.yarnpkg.com/async-each/-/async-each-1.0.1.tgz#19d386a1d9edc6e7c1c85d388aedbcc56d33602d" + async@^1.4.0, async@^1.4.2, async@^1.5.0: version "1.5.2" resolved "https://registry.yarnpkg.com/async/-/async-1.5.2.tgz#ec6a61ae56480c0c3cb241c95618e20892f9672a" @@ -172,6 +198,12 @@ asynckit@^0.4.0: version "0.4.0" resolved "https://registry.yarnpkg.com/asynckit/-/asynckit-0.4.0.tgz#c79ed97f7f34cb8f2ba1bc9790bcc366474b4b79" +attach-ware@^2.0.0: + version "2.0.1" + resolved "https://registry.yarnpkg.com/attach-ware/-/attach-ware-2.0.1.tgz#01d67a0972c750ea427cbd030d4c0399ff15125d" + dependencies: + unherit "^1.0.0" + aws-sign2@~0.6.0: version "0.6.0" resolved "https://registry.yarnpkg.com/aws-sign2/-/aws-sign2-0.6.0.tgz#14342dd38dbcc94d0e5b87d763cd63612c0e794f" @@ -395,6 +427,10 @@ babylon@^6.11.0, babylon@^6.13.0, babylon@^6.15.0: version "6.16.1" resolved "https://registry.yarnpkg.com/babylon/-/babylon-6.16.1.tgz#30c5a22f481978a9e7f8cdfdf496b11d94b404d3" +bail@^1.0.0: + version "1.0.1" + resolved "https://registry.yarnpkg.com/bail/-/bail-1.0.1.tgz#912579de8b391aadf3c5fdf4cd2a0fc225df3bc2" + balanced-match@^0.4.1: version "0.4.2" resolved "https://registry.yarnpkg.com/balanced-match/-/balanced-match-0.4.2.tgz#cb3f3e3c732dc0f01ee70b403f302e61d7709838" @@ -405,6 +441,16 @@ bcrypt-pbkdf@^1.0.0: dependencies: tweetnacl "^0.14.3" +binary-extensions@^1.0.0: + version "1.8.0" + resolved "https://registry.yarnpkg.com/binary-extensions/-/binary-extensions-1.8.0.tgz#48ec8d16df4377eae5fa5884682480af4d95c774" + +block-stream@*: + version "0.0.9" + resolved "https://registry.yarnpkg.com/block-stream/-/block-stream-0.0.9.tgz#13ebfe778a03205cfe03751481ebb4b3300c126a" + dependencies: + inherits "~2.0.0" + boom@2.x.x: version "2.10.1" resolved "https://registry.yarnpkg.com/boom/-/boom-2.10.1.tgz#39c8918ceff5799f83f9492a848f625add0c766f" @@ -459,9 +505,13 @@ camelcase@^2.0.0: version "2.1.1" resolved "https://registry.yarnpkg.com/camelcase/-/camelcase-2.1.1.tgz#7c1d16d679a1bbe59ca02cacecfb011e201f5a1f" -caseless@~0.11.0: - version "0.11.0" - resolved "https://registry.yarnpkg.com/caseless/-/caseless-0.11.0.tgz#715b96ea9841593cc33067923f5ec60ebda4f7d7" +caseless@~0.12.0: + version "0.12.0" + resolved "https://registry.yarnpkg.com/caseless/-/caseless-0.12.0.tgz#1b681c21ff84033c826543090689420d187151dc" + +ccount@^1.0.0: + version "1.0.1" + resolved "https://registry.yarnpkg.com/ccount/-/ccount-1.0.1.tgz#665687945168c218ec77ff61a4155ae00227a96c" center-align@^0.1.1: version "0.1.3" @@ -480,11 +530,42 @@ chalk@1.1.3, chalk@^1.0.0, chalk@^1.1.0, chalk@^1.1.1, chalk@^1.1.3: strip-ansi "^3.0.0" supports-color "^2.0.0" +character-entities-html4@^1.0.0: + version "1.1.0" + resolved "https://registry.yarnpkg.com/character-entities-html4/-/character-entities-html4-1.1.0.tgz#1ab08551d3ce1fa1df08d00fb9ca1defb147a06c" + +character-entities-legacy@^1.0.0: + version "1.1.0" + resolved "https://registry.yarnpkg.com/character-entities-legacy/-/character-entities-legacy-1.1.0.tgz#b18aad98f6b7bcc646c1e4c81f9f1956376a561a" + +character-entities@^1.0.0: + version "1.2.0" + resolved "https://registry.yarnpkg.com/character-entities/-/character-entities-1.2.0.tgz#a683e2cf75dbe8b171963531364e58e18a1b155f" + +character-reference-invalid@^1.0.0: + version "1.1.0" + resolved "https://registry.yarnpkg.com/character-reference-invalid/-/character-reference-invalid-1.1.0.tgz#dec9ad1dfb9f8d06b4fcdaa2adc3c4fd97af1e68" + +chokidar@^1.0.5: + version "1.6.1" + resolved "https://registry.yarnpkg.com/chokidar/-/chokidar-1.6.1.tgz#2f4447ab5e96e50fb3d789fd90d4c72e0e4c70c2" + dependencies: + anymatch "^1.3.0" + async-each "^1.0.0" + glob-parent "^2.0.0" + inherits "^2.0.1" + is-binary-path "^1.0.0" + is-glob "^2.0.0" + path-is-absolute "^1.0.0" + readdirp "^2.0.0" + optionalDependencies: + fsevents "^1.0.0" + circular-json@^0.3.1: version "0.3.1" resolved "https://registry.yarnpkg.com/circular-json/-/circular-json-0.3.1.tgz#be8b36aefccde8b3ca7aa2d6afc07a37242c0d2d" -cli-cursor@^1.0.1: +cli-cursor@^1.0.1, cli-cursor@^1.0.2: version "1.0.2" resolved "https://registry.yarnpkg.com/cli-cursor/-/cli-cursor-1.0.2.tgz#64da3f7d56a54412e59794bd62dc35295e8f2987" dependencies: @@ -519,6 +600,10 @@ cmd-shim@^2.0.2: graceful-fs "^4.1.2" mkdirp "~0.5.0" +co@3.1.0: + version "3.1.0" + resolved "https://registry.yarnpkg.com/co/-/co-3.1.0.tgz#4ea54ea5a08938153185e15210c68d9092bc1b78" + co@^4.6.0: version "4.6.0" resolved "https://registry.yarnpkg.com/co/-/co-4.6.0.tgz#6ea6bdf3d853ae54ccb8e47bfa0bf3f9031fb184" @@ -536,6 +621,10 @@ codecov@^1.0.1: request ">=2.42.0" urlgrey ">=0.4.0" +collapse-white-space@^1.0.0: + version "1.0.2" + resolved "https://registry.yarnpkg.com/collapse-white-space/-/collapse-white-space-1.0.2.tgz#9c463fb9c6d190d2dcae21a356a01bcae9eeef6d" + color-convert@^1.0.0: version "1.9.0" resolved "https://registry.yarnpkg.com/color-convert/-/color-convert-1.9.0.tgz#1accf97dd739b983bf994d56fec8f95853641b7a" @@ -567,7 +656,7 @@ command-join@^2.0.0: version "2.0.0" resolved "https://registry.yarnpkg.com/command-join/-/command-join-2.0.0.tgz#52e8b984f4872d952ff1bdc8b98397d27c7144cf" -commander@^2.9.0: +commander@^2.0.0: version "2.9.0" resolved "https://registry.yarnpkg.com/commander/-/commander-2.9.0.tgz#9c99094176e12240cb22d6c5146098400fe0f7d4" dependencies: @@ -577,7 +666,7 @@ concat-map@0.0.1: version "0.0.1" resolved "https://registry.yarnpkg.com/concat-map/-/concat-map-0.0.1.tgz#d8a96bd77fd68df7793a73036a3ba0d5405d477b" -concat-stream@^1.4.6: +concat-stream@^1.0.0, concat-stream@^1.4.6: version "1.6.0" resolved "https://registry.yarnpkg.com/concat-stream/-/concat-stream-1.6.0.tgz#0aac662fd52be78964d5532f694784e70110acf7" dependencies: @@ -585,6 +674,10 @@ concat-stream@^1.4.6: readable-stream "^2.2.2" typedarray "^0.0.6" +console-control-strings@^1.0.0, console-control-strings@~1.1.0: + version "1.1.0" + resolved "https://registry.yarnpkg.com/console-control-strings/-/console-control-strings-1.1.0.tgz#3d7cf4464db6446ea644bf4b39507f9851008e8e" + content-type-parser@^1.0.1: version "1.0.1" resolved "https://registry.yarnpkg.com/content-type-parser/-/content-type-parser-1.0.1.tgz#c3e56988c53c65127fb46d4032a3a900246fdc94" @@ -654,16 +747,26 @@ dashdash@^1.12.0: dependencies: assert-plus "^1.0.0" -debug@^2.1.1, debug@^2.2.0: +debug@^2.0.0, debug@^2.1.1, debug@^2.2.0: version "2.6.1" resolved "https://registry.yarnpkg.com/debug/-/debug-2.6.1.tgz#79855090ba2c4e3115cc7d8769491d58f0491351" dependencies: ms "0.7.2" +debug@~2.2.0: + version "2.2.0" + resolved "https://registry.yarnpkg.com/debug/-/debug-2.2.0.tgz#f87057e995b1a1f6ae6a4960664137bc56f039da" + dependencies: + ms "0.7.1" + decamelize@^1.0.0, decamelize@^1.1.2: version "1.2.0" resolved "https://registry.yarnpkg.com/decamelize/-/decamelize-1.2.0.tgz#f6534d15148269b20352e7bee26f501f9a191290" +deep-extend@~0.4.0: + version "0.4.1" + resolved "https://registry.yarnpkg.com/deep-extend/-/deep-extend-0.4.1.tgz#efe4113d08085f4e6f9687759810f807469e2253" + deep-is@~0.1.3: version "0.1.3" resolved "https://registry.yarnpkg.com/deep-is/-/deep-is-0.1.3.tgz#b369d6fb5dbc13eecf524f91b070feedc357cf34" @@ -703,6 +806,10 @@ delayed-stream@~1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/delayed-stream/-/delayed-stream-1.0.0.tgz#df3ae199acadfb7d440aaae0b29e2272b24ec619" +delegates@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/delegates/-/delegates-1.0.0.tgz#84c6e159b81904fdca59a0ef44cd870d31250f9a" + detect-indent@^4.0.0: version "4.0.0" resolved "https://registry.yarnpkg.com/detect-indent/-/detect-indent-4.0.0.tgz#f76d064352cdf43a1cb6ce619c4ee3a9475de208" @@ -722,6 +829,10 @@ ecc-jsbn@~0.1.1: dependencies: jsbn "~0.1.0" +elegant-spinner@^1.0.0: + version "1.0.1" + resolved "https://registry.yarnpkg.com/elegant-spinner/-/elegant-spinner-1.0.1.tgz#db043521c95d7e303fd8f345bedc3349cfb0729e" + encoding@^0.1.11: version "0.1.12" resolved "https://registry.yarnpkg.com/encoding/-/encoding-0.1.12.tgz#538b66f3ee62cd1ab51ec323829d1f9480c74beb" @@ -729,8 +840,8 @@ encoding@^0.1.11: iconv-lite "~0.4.13" error-ex@^1.2.0: - version "1.3.0" - resolved "https://registry.yarnpkg.com/error-ex/-/error-ex-1.3.0.tgz#e67b43f3e82c96ea3a584ffee0b9fc3325d802d9" + version "1.3.1" + resolved "https://registry.yarnpkg.com/error-ex/-/error-ex-1.3.1.tgz#f855a86ce61adc4e8621c3cda21e7a7612c3a8dc" dependencies: is-arrayish "^0.2.1" @@ -837,6 +948,14 @@ eslint-plugin-flowtype@^2.28.2: dependencies: lodash "^4.15.0" +eslint-plugin-markdown@^1.0.0-beta.3: + version "1.0.0-beta.3" + resolved "https://registry.yarnpkg.com/eslint-plugin-markdown/-/eslint-plugin-markdown-1.0.0-beta.3.tgz#84762b7507b82f01a0c8694a4de4ca70ef56ae03" + dependencies: + object-assign "^4.0.1" + parse5 "^2.2.2" + remark "^4.1.1" + eslint-plugin-react@^6.7.1: version "6.10.0" resolved "https://registry.yarnpkg.com/eslint-plugin-react/-/eslint-plugin-react-6.10.0.tgz#9c48b48d101554b5355413e7c64238abde6ef1ef" @@ -848,8 +967,8 @@ eslint-plugin-react@^6.7.1: object.assign "^4.0.4" eslint@^3.11.1: - version "3.16.1" - resolved "https://registry.yarnpkg.com/eslint/-/eslint-3.16.1.tgz#9bc31fc7341692cf772e80607508f67d711c5609" + version "3.17.0" + resolved "https://registry.yarnpkg.com/eslint/-/eslint-3.17.0.tgz#e2704b09c5bae9fb49ee8bafeea3832c7257d498" dependencies: babel-code-frame "^6.16.0" chalk "^1.1.3" @@ -957,7 +1076,7 @@ expand-range@^1.8.1: dependencies: fill-range "^2.1.0" -extend@~3.0.0: +extend@^3.0.0, extend@~3.0.0: version "3.0.0" resolved "https://registry.yarnpkg.com/extend/-/extend-3.0.0.tgz#5a474353b9f3353ddd8176dfd37b91c83a46f1d4" @@ -1092,10 +1211,47 @@ fs.realpath@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/fs.realpath/-/fs.realpath-1.0.0.tgz#1504ad2523158caa40db4a2787cb01411994ea4f" +fsevents@^1.0.0: + version "1.1.1" + resolved "https://registry.yarnpkg.com/fsevents/-/fsevents-1.1.1.tgz#f19fd28f43eeaf761680e519a203c4d0b3d31aff" + dependencies: + nan "^2.3.0" + node-pre-gyp "^0.6.29" + +fstream-ignore@~1.0.5: + version "1.0.5" + resolved "https://registry.yarnpkg.com/fstream-ignore/-/fstream-ignore-1.0.5.tgz#9c31dae34767018fe1d249b24dada67d092da105" + dependencies: + fstream "^1.0.0" + inherits "2" + minimatch "^3.0.0" + +fstream@^1.0.0, fstream@^1.0.2, fstream@~1.0.10: + version "1.0.10" + resolved "https://registry.yarnpkg.com/fstream/-/fstream-1.0.10.tgz#604e8a92fe26ffd9f6fae30399d4984e1ab22822" + dependencies: + graceful-fs "^4.1.2" + inherits "~2.0.0" + mkdirp ">=0.5 0" + rimraf "2" + function-bind@^1.0.2, function-bind@^1.1.0: version "1.1.0" resolved "https://registry.yarnpkg.com/function-bind/-/function-bind-1.1.0.tgz#16176714c801798e4e8f2cf7f7529467bb4a5771" +gauge@~2.7.1: + version "2.7.3" + resolved "https://registry.yarnpkg.com/gauge/-/gauge-2.7.3.tgz#1c23855f962f17b3ad3d0dc7443f304542edfe09" + dependencies: + aproba "^1.0.3" + console-control-strings "^1.0.0" + has-unicode "^2.0.0" + object-assign "^4.1.0" + signal-exit "^3.0.0" + string-width "^1.0.1" + strip-ansi "^3.0.1" + wide-align "^1.1.0" + generate-function@^2.0.0: version "2.0.0" resolved "https://registry.yarnpkg.com/generate-function/-/generate-function-2.0.0.tgz#6858fe7c0969b7d4e9093337647ac79f60dfbe74" @@ -1144,10 +1300,31 @@ glob@7.1.1, glob@^7.0.0, glob@^7.0.3, glob@^7.0.5, glob@^7.0.6, glob@^7.1.1: once "^1.3.0" path-is-absolute "^1.0.0" +glob@^6.0.1: + version "6.0.4" + resolved "https://registry.yarnpkg.com/glob/-/glob-6.0.4.tgz#0f08860f6a155127b2fadd4f9ce24b1aab6e4d22" + dependencies: + inflight "^1.0.4" + inherits "2" + minimatch "2 || 3" + once "^1.3.0" + path-is-absolute "^1.0.0" + globals@^9.0.0, globals@^9.14.0: version "9.16.0" resolved "https://registry.yarnpkg.com/globals/-/globals-9.16.0.tgz#63e903658171ec2d9f51b1d31de5e2b8dc01fb80" +globby@^4.0.0: + version "4.1.0" + resolved "https://registry.yarnpkg.com/globby/-/globby-4.1.0.tgz#080f54549ec1b82a6c60e631fc82e1211dbe95f8" + dependencies: + array-union "^1.0.1" + arrify "^1.0.0" + glob "^6.0.1" + object-assign "^4.0.1" + pify "^2.0.0" + pinkie-promise "^2.0.0" + globby@^5.0.0: version "5.0.0" resolved "https://registry.yarnpkg.com/globby/-/globby-5.0.0.tgz#ebd84667ca0dbb330b99bcfc68eac2bc54370e0d" @@ -1181,14 +1358,16 @@ handlebars@^4.0.3: optionalDependencies: uglify-js "^2.6" -har-validator@~2.0.6: - version "2.0.6" - resolved "https://registry.yarnpkg.com/har-validator/-/har-validator-2.0.6.tgz#cdcbc08188265ad119b6a5a7c8ab70eecfb5d27d" +har-schema@^1.0.5: + version "1.0.5" + resolved "https://registry.yarnpkg.com/har-schema/-/har-schema-1.0.5.tgz#d263135f43307c02c602afc8fe95970c0151369e" + +har-validator@~4.2.0: + version "4.2.0" + resolved "https://registry.yarnpkg.com/har-validator/-/har-validator-4.2.0.tgz#c2efa9f6c50fee92ef033cf30b796a2c5b660cd7" dependencies: - chalk "^1.1.1" - commander "^2.9.0" - is-my-json-valid "^2.12.4" - pinkie-promise "^2.0.0" + ajv "^4.9.1" + har-schema "^1.0.5" has-ansi@^2.0.0: version "2.0.0" @@ -1200,6 +1379,10 @@ has-flag@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/has-flag/-/has-flag-1.0.0.tgz#9d9e793165ce017a00f00418c43f942a7b1d11fa" +has-unicode@^2.0.0: + version "2.0.1" + resolved "https://registry.yarnpkg.com/has-unicode/-/has-unicode-2.0.1.tgz#e0e6fe6a28cf51138855e086d1691e771de2a8b9" + has@^1.0.1: version "1.0.1" resolved "https://registry.yarnpkg.com/has/-/has-1.0.1.tgz#8461733f538b0837c9361e39a9ab9e9704dc2f28" @@ -1269,10 +1452,14 @@ inflight@^1.0.4: once "^1.3.0" wrappy "1" -inherits@2, inherits@^2.0.3, inherits@~2.0.1: +inherits@2, inherits@^2.0.1, inherits@^2.0.3, inherits@~2.0.0, inherits@~2.0.1: version "2.0.3" resolved "https://registry.yarnpkg.com/inherits/-/inherits-2.0.3.tgz#633c2c83e3da42a502f52466022480f4208261de" +ini@~1.3.0: + version "1.3.4" + resolved "https://registry.yarnpkg.com/ini/-/ini-1.3.4.tgz#0537cb79daf59b59a1a517dff706c86ec039162e" + inquirer@^0.12.0: version "0.12.0" resolved "https://registry.yarnpkg.com/inquirer/-/inquirer-0.12.0.tgz#1ef2bfd63504df0bc75785fff8c2c41df12f077e" @@ -1292,8 +1479,8 @@ inquirer@^0.12.0: through "^2.3.6" inquirer@^3.0.1: - version "3.0.5" - resolved "https://registry.yarnpkg.com/inquirer/-/inquirer-3.0.5.tgz#172cabc8eacbfb91d595f5d7c354b446b8141f65" + version "3.0.6" + resolved "https://registry.yarnpkg.com/inquirer/-/inquirer-3.0.6.tgz#e04aaa9d05b7a3cb9b0f407d04375f0447190347" dependencies: ansi-escapes "^1.1.0" chalk "^1.0.0" @@ -1319,10 +1506,31 @@ invariant@^2.2.0: dependencies: loose-envify "^1.0.0" +irregular-plurals@^1.0.0: + version "1.2.0" + resolved "https://registry.yarnpkg.com/irregular-plurals/-/irregular-plurals-1.2.0.tgz#38f299834ba8c00c30be9c554e137269752ff3ac" + +is-alphabetical@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/is-alphabetical/-/is-alphabetical-1.0.0.tgz#e2544c13058255f2144cb757066cd3342a1c8c46" + +is-alphanumerical@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/is-alphanumerical/-/is-alphanumerical-1.0.0.tgz#e06492e719c1bf15dec239e4f1af5f67b4d6e7bf" + dependencies: + is-alphabetical "^1.0.0" + is-decimal "^1.0.0" + is-arrayish@^0.2.1: version "0.2.1" resolved "https://registry.yarnpkg.com/is-arrayish/-/is-arrayish-0.2.1.tgz#77c99840527aa8ecb1a8ba697b80645a7a926a9d" +is-binary-path@^1.0.0: + version "1.0.1" + resolved "https://registry.yarnpkg.com/is-binary-path/-/is-binary-path-1.0.1.tgz#75f16642b480f187a711c814161fd3a4a7655898" + dependencies: + binary-extensions "^1.0.0" + is-buffer@^1.0.2: version "1.1.4" resolved "https://registry.yarnpkg.com/is-buffer/-/is-buffer-1.1.4.tgz#cfc86ccd5dc5a52fa80489111c6920c457e2d98b" @@ -1341,6 +1549,10 @@ is-date-object@^1.0.1: version "1.0.1" resolved "https://registry.yarnpkg.com/is-date-object/-/is-date-object-1.0.1.tgz#9aa20eb6aeebbff77fbd33e74ca01b33581d3a16" +is-decimal@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/is-decimal/-/is-decimal-1.0.0.tgz#940579b6ea63c628080a69e62bda88c8470b4fe0" + is-dotfile@^1.0.0: version "1.0.2" resolved "https://registry.yarnpkg.com/is-dotfile/-/is-dotfile-1.0.2.tgz#2c132383f39199f8edc268ca01b9b007d205cc4d" @@ -1381,7 +1593,11 @@ is-glob@^2.0.0, is-glob@^2.0.1: dependencies: is-extglob "^1.0.0" -is-my-json-valid@^2.10.0, is-my-json-valid@^2.12.4: +is-hexadecimal@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/is-hexadecimal/-/is-hexadecimal-1.0.0.tgz#5c459771d2af9a2e3952781fd54fcb1bcfe4113c" + +is-my-json-valid@^2.10.0: version "2.16.0" resolved "https://registry.yarnpkg.com/is-my-json-valid/-/is-my-json-valid-2.16.0.tgz#f079dd9bfdae65ee2038aae8acbc86ab109e3693" dependencies: @@ -1738,6 +1954,23 @@ lodash@^4.0.0, lodash@^4.14.0, lodash@^4.15.0, lodash@^4.17.4, lodash@^4.2.0, lo version "4.17.4" resolved "https://registry.yarnpkg.com/lodash/-/lodash-4.17.4.tgz#78203a4d1c328ae1d86dca6460e369b57f4055ae" +log-symbols@^1.0.2: + version "1.0.2" + resolved "https://registry.yarnpkg.com/log-symbols/-/log-symbols-1.0.2.tgz#376ff7b58ea3086a0f09facc74617eca501e1a18" + dependencies: + chalk "^1.0.0" + +log-update@^1.0.1: + version "1.0.2" + resolved "https://registry.yarnpkg.com/log-update/-/log-update-1.0.2.tgz#19929f64c4093d2d2e7075a1dad8af59c296b8d1" + dependencies: + ansi-escapes "^1.0.0" + cli-cursor "^1.0.2" + +longest-streak@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/longest-streak/-/longest-streak-1.0.0.tgz#d06597c4d4c31b52ccb1f5d8f8fe7148eafd6965" + longest@^1.0.1: version "1.0.1" resolved "https://registry.yarnpkg.com/longest/-/longest-1.0.1.tgz#30a0b2da38f73770e8294a0d22e6625ed77d0097" @@ -1766,6 +1999,10 @@ map-obj@^1.0.0, map-obj@^1.0.1: version "1.0.1" resolved "https://registry.yarnpkg.com/map-obj/-/map-obj-1.0.1.tgz#d933ceb9205d82bdcf4886f6742bdc2b4dea146d" +markdown-table@^0.4.0: + version "0.4.0" + resolved "https://registry.yarnpkg.com/markdown-table/-/markdown-table-0.4.0.tgz#890c2c1b3bfe83fb00e4129b8e4cfe645270f9d1" + meow@^3.7.0: version "3.7.0" resolved "https://registry.yarnpkg.com/meow/-/meow-3.7.0.tgz#72cb668b425228290abbfa856892587308a801fb" @@ -1781,7 +2018,7 @@ meow@^3.7.0: redent "^1.0.0" trim-newlines "^1.0.0" -micromatch@^2.3.11: +micromatch@^2.1.5, micromatch@^2.3.11: version "2.3.11" resolved "https://registry.yarnpkg.com/micromatch/-/micromatch-2.3.11.tgz#86677c97d1720b363431d04d0d15293bd38c1565" dependencies: @@ -1813,7 +2050,7 @@ mimic-fn@^1.0.0: version "1.1.0" resolved "https://registry.yarnpkg.com/mimic-fn/-/mimic-fn-1.1.0.tgz#e667783d92e89dbd342818b5230b9d62a672ad18" -minimatch@^3.0.0, minimatch@^3.0.2, minimatch@^3.0.3: +"minimatch@2 || 3", minimatch@^3.0.0, minimatch@^3.0.2, minimatch@^3.0.3: version "3.0.3" resolved "https://registry.yarnpkg.com/minimatch/-/minimatch-3.0.3.tgz#2a4e4090b96b2db06a9d7df01055a62a77c9b774" dependencies: @@ -1823,16 +2060,20 @@ minimist@0.0.8, minimist@~0.0.1: version "0.0.8" resolved "https://registry.yarnpkg.com/minimist/-/minimist-0.0.8.tgz#857fcabfc3397d2625b8228262e86aa7a011b05d" -minimist@1.2.0, minimist@>=0.2.0, minimist@^1.1.3: +minimist@1.2.0, minimist@>=0.2.0, minimist@^1.1.3, minimist@^1.2.0: version "1.2.0" resolved "https://registry.yarnpkg.com/minimist/-/minimist-1.2.0.tgz#a35008b20f41383eec1fb914f4cd5df79a264284" -mkdirp@^0.5.0, mkdirp@^0.5.1, mkdirp@~0.5.0: +"mkdirp@>=0.5 0", mkdirp@^0.5.0, mkdirp@^0.5.1, mkdirp@~0.5.0, mkdirp@~0.5.1: version "0.5.1" resolved "https://registry.yarnpkg.com/mkdirp/-/mkdirp-0.5.1.tgz#30057438eac6cf7f8c4767f38648d6697d75c903" dependencies: minimist "0.0.8" +ms@0.7.1: + version "0.7.1" + resolved "https://registry.yarnpkg.com/ms/-/ms-0.7.1.tgz#9cd13c03adbff25b65effde7ce864ee952017098" + ms@0.7.2: version "0.7.2" resolved "https://registry.yarnpkg.com/ms/-/ms-0.7.2.tgz#ae25cf2512b3885a1d95d7f037868d8431124765" @@ -1845,6 +2086,10 @@ mute-stream@0.0.7: version "0.0.7" resolved "https://registry.yarnpkg.com/mute-stream/-/mute-stream-0.0.7.tgz#3075ce93bc21b8fab43e1bc4da7e8115ed1e7bab" +nan@^2.3.0: + version "2.5.1" + resolved "https://registry.yarnpkg.com/nan/-/nan-2.5.1.tgz#d5b01691253326a97a2bbee9e61c55d8d60351e2" + natural-compare@^1.4.0: version "1.4.0" resolved "https://registry.yarnpkg.com/natural-compare/-/natural-compare-1.4.0.tgz#4abebfeed7541f2c27acfb29bdbbd15c8d5ba4f7" @@ -1856,6 +2101,26 @@ node-fetch@^1.0.1: encoding "^0.1.11" is-stream "^1.0.1" +node-pre-gyp@^0.6.29: + version "0.6.33" + resolved "https://registry.yarnpkg.com/node-pre-gyp/-/node-pre-gyp-0.6.33.tgz#640ac55198f6a925972e0c16c4ac26a034d5ecc9" + dependencies: + mkdirp "~0.5.1" + nopt "~3.0.6" + npmlog "^4.0.1" + rc "~1.1.6" + request "^2.79.0" + rimraf "~2.5.4" + semver "~5.3.0" + tar "~2.2.1" + tar-pack "~3.3.0" + +nopt@~3.0.6: + version "3.0.6" + resolved "https://registry.yarnpkg.com/nopt/-/nopt-3.0.6.tgz#c6465dbf08abcd4db359317f79ac68a646b28ff9" + dependencies: + abbrev "1" + normalize-package-data@^2.3.2, normalize-package-data@^2.3.4: version "2.3.5" resolved "https://registry.yarnpkg.com/normalize-package-data/-/normalize-package-data-2.3.5.tgz#8d924f142960e1777e7ffe170543631cc7cb02df" @@ -1869,6 +2134,23 @@ normalize-path@^2.0.1: version "2.0.1" resolved "https://registry.yarnpkg.com/normalize-path/-/normalize-path-2.0.1.tgz#47886ac1662760d4261b7d979d241709d3ce3f7a" +npm-prefix@^1.0.1: + version "1.2.0" + resolved "https://registry.yarnpkg.com/npm-prefix/-/npm-prefix-1.2.0.tgz#e619455f7074ba54cc66d6d0d37dd9f1be6bcbc0" + dependencies: + rc "^1.1.0" + shellsubstitute "^1.1.0" + untildify "^2.1.0" + +npmlog@^4.0.1: + version "4.0.2" + resolved "https://registry.yarnpkg.com/npmlog/-/npmlog-4.0.2.tgz#d03950e0e78ce1527ba26d2a7592e9348ac3e75f" + dependencies: + are-we-there-yet "~1.1.2" + console-control-strings "~1.1.0" + gauge "~2.7.1" + set-blocking "~2.0.0" + number-is-nan@^1.0.0: version "1.0.1" resolved "https://registry.yarnpkg.com/number-is-nan/-/number-is-nan-1.0.1.tgz#097b602b53422a522c1afb8790318336941a011d" @@ -1916,6 +2198,12 @@ once@^1.3.0, once@^1.4.0: dependencies: wrappy "1" +once@~1.3.3: + version "1.3.3" + resolved "https://registry.yarnpkg.com/once/-/once-1.3.3.tgz#b2e261557ce4c314ec8304f3fa82663e4297ca20" + dependencies: + wrappy "1" + onetime@^1.0.0: version "1.1.0" resolved "https://registry.yarnpkg.com/onetime/-/onetime-1.1.0.tgz#a1f7838f8314c516f05ecefcbc4ccfe04b4ed789" @@ -1952,6 +2240,18 @@ os-tmpdir@^1.0.1, os-tmpdir@~1.0.1: version "1.0.2" resolved "https://registry.yarnpkg.com/os-tmpdir/-/os-tmpdir-1.0.2.tgz#bbe67406c79aa85c5cfec766fe5734555dfa1274" +parse-entities@^1.0.0: + version "1.1.0" + resolved "https://registry.yarnpkg.com/parse-entities/-/parse-entities-1.1.0.tgz#4bc58f35fdc8e65dded35a12f2e40223ca24a3f7" + dependencies: + character-entities "^1.0.0" + character-entities-legacy "^1.0.0" + character-reference-invalid "^1.0.0" + has "^1.0.1" + is-alphanumerical "^1.0.0" + is-decimal "^1.0.0" + is-hexadecimal "^1.0.0" + parse-glob@^3.0.4: version "3.0.4" resolved "https://registry.yarnpkg.com/parse-glob/-/parse-glob-3.0.4.tgz#b2c376cfb11f35513badd173ef0bb6e3a388391c" @@ -1971,6 +2271,10 @@ parse5@^1.5.1: version "1.5.1" resolved "https://registry.yarnpkg.com/parse5/-/parse5-1.5.1.tgz#9b7f3b0de32be78dc2401b17573ccaf0f6f59d94" +parse5@^2.2.2: + version "2.2.3" + resolved "https://registry.yarnpkg.com/parse5/-/parse5-2.2.3.tgz#0c4fc41c1000c5e6b93d48b03f8083837834e9f6" + path-exists@^2.0.0, path-exists@^2.1.0: version "2.1.0" resolved "https://registry.yarnpkg.com/path-exists/-/path-exists-2.1.0.tgz#0feb6c64f0fc518d9a754dd5efb62c7022761f4b" @@ -1997,6 +2301,10 @@ path-type@^1.0.0: pify "^2.0.0" pinkie-promise "^2.0.0" +performance-now@^0.2.0: + version "0.2.0" + resolved "https://registry.yarnpkg.com/performance-now/-/performance-now-0.2.0.tgz#33ef30c5c77d4ea21c5a53869d91b56d8f2555e5" + pify@^2.0.0: version "2.3.0" resolved "https://registry.yarnpkg.com/pify/-/pify-2.3.0.tgz#ed141a6ac043a849ea588498e7dca8b15330e90c" @@ -2011,6 +2319,12 @@ pinkie@^2.0.0: version "2.0.4" resolved "https://registry.yarnpkg.com/pinkie/-/pinkie-2.0.4.tgz#72556b80cfa0d48a974e80e77248e80ed4f7f870" +plur@^2.0.0: + version "2.1.2" + resolved "https://registry.yarnpkg.com/plur/-/plur-2.1.2.tgz#7482452c1a0f508e3e344eaec312c91c29dc655a" + dependencies: + irregular-plurals "^1.0.0" + pluralize@^1.2.1: version "1.2.1" resolved "https://registry.yarnpkg.com/pluralize/-/pluralize-1.2.1.tgz#d1a21483fd22bb41e58a12fa3421823140897c45" @@ -2081,6 +2395,15 @@ randomatic@^1.1.3: is-number "^2.0.2" kind-of "^3.0.2" +rc@^1.1.0, rc@~1.1.6: + version "1.1.7" + resolved "https://registry.yarnpkg.com/rc/-/rc-1.1.7.tgz#c5ea564bb07aff9fd3a5b32e906c1d3a65940fea" + dependencies: + deep-extend "~0.4.0" + ini "~1.3.0" + minimist "^1.2.0" + strip-json-comments "~2.0.1" + react-test-renderer@^15.4.1: version "15.4.2" resolved "https://registry.yarnpkg.com/react-test-renderer/-/react-test-renderer-15.4.2.tgz#27e1dff5d26d0e830f99614c487622bc831416f3" @@ -2117,7 +2440,7 @@ read-pkg@^1.0.0: normalize-package-data "^2.3.2" path-type "^1.0.0" -readable-stream@^2.2.2: +"readable-stream@^2.0.0 || ^1.1.13", readable-stream@^2.0.2, readable-stream@^2.2.2: version "2.2.3" resolved "https://registry.yarnpkg.com/readable-stream/-/readable-stream-2.2.3.tgz#9cf49463985df016c8ae8813097a9293a9b33729" dependencies: @@ -2129,6 +2452,27 @@ readable-stream@^2.2.2: string_decoder "~0.10.x" util-deprecate "~1.0.1" +readable-stream@~2.1.4: + version "2.1.5" + resolved "https://registry.yarnpkg.com/readable-stream/-/readable-stream-2.1.5.tgz#66fa8b720e1438b364681f2ad1a63c618448c9d0" + dependencies: + buffer-shims "^1.0.0" + core-util-is "~1.0.0" + inherits "~2.0.1" + isarray "~1.0.0" + process-nextick-args "~1.0.6" + string_decoder "~0.10.x" + util-deprecate "~1.0.1" + +readdirp@^2.0.0: + version "2.1.0" + resolved "https://registry.yarnpkg.com/readdirp/-/readdirp-2.1.0.tgz#4ed0ad060df3073300c48440373f72d1cc642d78" + dependencies: + graceful-fs "^4.1.2" + minimatch "^3.0.2" + readable-stream "^2.0.2" + set-immediate-shim "^1.0.1" + readline2@^1.0.1: version "1.0.1" resolved "https://registry.yarnpkg.com/readline2/-/readline2-1.0.1.tgz#41059608ffc154757b715d9989d199ffbf372e35" @@ -2161,11 +2505,48 @@ regex-cache@^0.4.2: is-equal-shallow "^0.1.3" is-primitive "^2.0.0" +remark@^4.1.1: + version "4.2.2" + resolved "https://registry.yarnpkg.com/remark/-/remark-4.2.2.tgz#42dc5d0b3a6a2d5443e7cbdbb2a3202854be698f" + dependencies: + camelcase "^2.0.0" + ccount "^1.0.0" + chalk "^1.0.0" + chokidar "^1.0.5" + collapse-white-space "^1.0.0" + commander "^2.0.0" + concat-stream "^1.0.0" + debug "^2.0.0" + elegant-spinner "^1.0.0" + extend "^3.0.0" + glob "^7.0.0" + globby "^4.0.0" + log-update "^1.0.1" + longest-streak "^1.0.0" + markdown-table "^0.4.0" + minimatch "^3.0.0" + npm-prefix "^1.0.1" + parse-entities "^1.0.0" + repeat-string "^1.5.0" + stringify-entities "^1.0.0" + to-vfile "^1.0.0" + trim "^0.0.1" + trim-trailing-lines "^1.0.0" + unified "^3.0.0" + unist-util-remove-position "^1.0.0" + user-home "^2.0.0" + vfile "^1.1.0" + vfile-find-down "^1.0.0" + vfile-find-up "^1.0.0" + vfile-location "^2.0.0" + vfile-reporter "^1.5.0" + ware "^1.3.0" + repeat-element@^1.1.2: version "1.1.2" resolved "https://registry.yarnpkg.com/repeat-element/-/repeat-element-1.1.2.tgz#ef089a178d1483baae4d93eb98b4f9e4e11d990a" -repeat-string@^1.5.2: +repeat-string@^1.5.0, repeat-string@^1.5.2: version "1.6.1" resolved "https://registry.yarnpkg.com/repeat-string/-/repeat-string-1.6.1.tgz#8dcae470e1c88abc2d600fff4a776286da75e637" @@ -2176,17 +2557,17 @@ repeating@^2.0.0: is-finite "^1.0.0" request@>=2.42.0, request@^2.79.0: - version "2.79.0" - resolved "https://registry.yarnpkg.com/request/-/request-2.79.0.tgz#4dfe5bf6be8b8cdc37fcf93e04b65577722710de" + version "2.80.0" + resolved "https://registry.yarnpkg.com/request/-/request-2.80.0.tgz#8cc162d76d79381cdefdd3505d76b80b60589bd0" dependencies: aws-sign2 "~0.6.0" aws4 "^1.2.1" - caseless "~0.11.0" + caseless "~0.12.0" combined-stream "~1.0.5" extend "~3.0.0" forever-agent "~0.6.1" form-data "~2.1.1" - har-validator "~2.0.6" + har-validator "~4.2.0" hawk "~3.1.3" http-signature "~1.1.0" is-typedarray "~1.0.0" @@ -2194,6 +2575,7 @@ request@>=2.42.0, request@^2.79.0: json-stringify-safe "~5.0.1" mime-types "~2.1.7" oauth-sign "~0.8.1" + performance-now "^0.2.0" qs "~6.3.0" stringstream "~0.0.4" tough-cookie "~2.3.0" @@ -2237,7 +2619,7 @@ right-align@^0.1.1: dependencies: align-text "^0.1.1" -rimraf@^2.2.8, rimraf@^2.4.3, rimraf@^2.4.4, rimraf@^2.5.4: +rimraf@2, rimraf@^2.2.8, rimraf@^2.4.3, rimraf@^2.4.4, rimraf@^2.5.4: version "2.6.1" resolved "https://registry.yarnpkg.com/rimraf/-/rimraf-2.6.1.tgz#c2338ec643df7a1b7fe5c54fa86f57428a55f33d" dependencies: @@ -2249,6 +2631,12 @@ rimraf@~2.1.4: optionalDependencies: graceful-fs "~1" +rimraf@~2.5.1, rimraf@~2.5.4: + version "2.5.4" + resolved "https://registry.yarnpkg.com/rimraf/-/rimraf-2.5.4.tgz#96800093cbf1a0c86bd95b4625467535c29dfa04" + dependencies: + glob "^7.0.5" + run-async@^0.1.0: version "0.1.0" resolved "https://registry.yarnpkg.com/run-async/-/run-async-0.1.0.tgz#c8ad4a5e110661e402a7d21b530e009f25f8e389" @@ -2273,10 +2661,18 @@ sax@^1.2.1: version "1.2.2" resolved "https://registry.yarnpkg.com/sax/-/sax-1.2.2.tgz#fd8631a23bc7826bef5d871bdb87378c95647828" -"semver@2 || 3 || 4 || 5", semver@^5.1.0, semver@^5.3.0: +"semver@2 || 3 || 4 || 5", semver@^5.1.0, semver@^5.3.0, semver@~5.3.0: version "5.3.0" resolved "https://registry.yarnpkg.com/semver/-/semver-5.3.0.tgz#9b2ce5d3de02d17c6012ad326aa6b4d0cf54f94f" +set-blocking@~2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/set-blocking/-/set-blocking-2.0.0.tgz#045f9782d011ae9a6803ddd382b24392b3d890f7" + +set-immediate-shim@^1.0.1: + version "1.0.1" + resolved "https://registry.yarnpkg.com/set-immediate-shim/-/set-immediate-shim-1.0.1.tgz#4b2b1b27eb808a9f8dcc481a58e5e56f599f3f61" + setimmediate@^1.0.5: version "1.0.5" resolved "https://registry.yarnpkg.com/setimmediate/-/setimmediate-1.0.5.tgz#290cbb232e306942d7d7ea9b83732ab7856f8285" @@ -2299,6 +2695,10 @@ shelljs@^0.7.5: interpret "^1.0.0" rechoir "^0.6.2" +shellsubstitute@^1.1.0: + version "1.2.0" + resolved "https://registry.yarnpkg.com/shellsubstitute/-/shellsubstitute-1.2.0.tgz#e4f702a50c518b0f6fe98451890d705af29b6b70" + signal-exit@^3.0.0, signal-exit@^3.0.2: version "3.0.2" resolved "https://registry.yarnpkg.com/signal-exit/-/signal-exit-3.0.2.tgz#b5fdc08f1287ea1178628e415e25132b73646c6d" @@ -2376,7 +2776,7 @@ sshpk@^1.7.0: jsbn "~0.1.0" tweetnacl "~0.14.0" -string-width@^1.0.1: +string-width@^1.0.0, string-width@^1.0.1: version "1.0.2" resolved "https://registry.yarnpkg.com/string-width/-/string-width-1.0.2.tgz#118bdf5b8cdc51a2a7e70d211e07e2b0b9b107d3" dependencies: @@ -2395,6 +2795,16 @@ string_decoder@~0.10.x: version "0.10.31" resolved "https://registry.yarnpkg.com/string_decoder/-/string_decoder-0.10.31.tgz#62e203bc41766c6c28c9fc84301dab1c5310fa94" +stringify-entities@^1.0.0: + version "1.3.0" + resolved "https://registry.yarnpkg.com/stringify-entities/-/stringify-entities-1.3.0.tgz#2244a516c4f1e8e01b73dad01023016776abd917" + dependencies: + character-entities-html4 "^1.0.0" + character-entities-legacy "^1.0.0" + has "^1.0.1" + is-alphanumerical "^1.0.0" + is-hexadecimal "^1.0.0" + stringstream@~0.0.4: version "0.0.5" resolved "https://registry.yarnpkg.com/stringstream/-/stringstream-0.0.5.tgz#4e484cd4de5a0bbbee18e46307710a8a81621878" @@ -2450,13 +2860,34 @@ table@^3.7.8: slice-ansi "0.0.4" string-width "^2.0.0" +tar-pack@~3.3.0: + version "3.3.0" + resolved "https://registry.yarnpkg.com/tar-pack/-/tar-pack-3.3.0.tgz#30931816418f55afc4d21775afdd6720cee45dae" + dependencies: + debug "~2.2.0" + fstream "~1.0.10" + fstream-ignore "~1.0.5" + once "~1.3.3" + readable-stream "~2.1.4" + rimraf "~2.5.1" + tar "~2.2.1" + uid-number "~0.0.6" + +tar@~2.2.1: + version "2.2.1" + resolved "https://registry.yarnpkg.com/tar/-/tar-2.2.1.tgz#8e4d2a256c0e2185c6b18ad694aec968b83cb1d1" + dependencies: + block-stream "*" + fstream "^1.0.2" + inherits "2" + temp@~0.5.1: version "0.5.1" resolved "https://registry.yarnpkg.com/temp/-/temp-0.5.1.tgz#77ab19c79aa7b593cbe4fac2441768cad987b8df" dependencies: rimraf "~2.1.4" -text-table@~0.2.0: +text-table@^0.2.0, text-table@~0.2.0: version "0.2.0" resolved "https://registry.yarnpkg.com/text-table/-/text-table-0.2.0.tgz#7f5ee823ae805207c00af2df4a84ec3fcfa570b4" @@ -2474,6 +2905,12 @@ to-fast-properties@^1.0.1: version "1.0.2" resolved "https://registry.yarnpkg.com/to-fast-properties/-/to-fast-properties-1.0.2.tgz#f3f5c0c3ba7299a7ef99427e44633257ade43320" +to-vfile@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/to-vfile/-/to-vfile-1.0.0.tgz#88defecd43adb2ef598625f0e3d59f7f342941ba" + dependencies: + vfile "^1.0.0" + tough-cookie@^2.3.2, tough-cookie@~2.3.0: version "2.3.2" resolved "https://registry.yarnpkg.com/tough-cookie/-/tough-cookie-2.3.2.tgz#f081f76e4c85720e6c37a5faced737150d84072a" @@ -2492,6 +2929,14 @@ trim-right@^1.0.1: version "1.0.1" resolved "https://registry.yarnpkg.com/trim-right/-/trim-right-1.0.1.tgz#cb2e1203067e0c8de1f614094b9fe45704ea6003" +trim-trailing-lines@^1.0.0: + version "1.1.0" + resolved "https://registry.yarnpkg.com/trim-trailing-lines/-/trim-trailing-lines-1.1.0.tgz#7aefbb7808df9d669f6da2e438cac8c46ada7684" + +trim@^0.0.1: + version "0.0.1" + resolved "https://registry.yarnpkg.com/trim/-/trim-0.0.1.tgz#5858547f6b290757ee95cccc666fb50084c460dd" + tryit@^1.0.1: version "1.0.3" resolved "https://registry.yarnpkg.com/tryit/-/tryit-1.0.3.tgz#393be730a9446fd1ead6da59a014308f36c289cb" @@ -2535,6 +2980,44 @@ uglify-to-browserify@~1.0.0: version "1.0.2" resolved "https://registry.yarnpkg.com/uglify-to-browserify/-/uglify-to-browserify-1.0.2.tgz#6e0924d6bda6b5afe349e39a6d632850a0f882b7" +uid-number@~0.0.6: + version "0.0.6" + resolved "https://registry.yarnpkg.com/uid-number/-/uid-number-0.0.6.tgz#0ea10e8035e8eb5b8e4449f06da1c730663baa81" + +unherit@^1.0.0, unherit@^1.0.4: + version "1.1.0" + resolved "https://registry.yarnpkg.com/unherit/-/unherit-1.1.0.tgz#6b9aaedfbf73df1756ad9e316dd981885840cd7d" + dependencies: + inherits "^2.0.1" + xtend "^4.0.1" + +unified@^3.0.0: + version "3.0.0" + resolved "https://registry.yarnpkg.com/unified/-/unified-3.0.0.tgz#85ce4169b09ee9f084d07f4d0a1fbe3939518712" + dependencies: + attach-ware "^2.0.0" + bail "^1.0.0" + extend "^3.0.0" + unherit "^1.0.4" + vfile "^1.0.0" + ware "^1.3.0" + +unist-util-remove-position@^1.0.0: + version "1.1.0" + resolved "https://registry.yarnpkg.com/unist-util-remove-position/-/unist-util-remove-position-1.1.0.tgz#2444fedc344bc5f540dab6353e013b6d78101dc2" + dependencies: + unist-util-visit "^1.1.0" + +unist-util-visit@^1.1.0: + version "1.1.1" + resolved "https://registry.yarnpkg.com/unist-util-visit/-/unist-util-visit-1.1.1.tgz#e917a3b137658b335cb4420c7da2e74d928e4e94" + +untildify@^2.1.0: + version "2.1.0" + resolved "https://registry.yarnpkg.com/untildify/-/untildify-2.1.0.tgz#17eb2807987f76952e9c0485fc311d06a826a2e0" + dependencies: + os-homedir "^1.0.0" + urlgrey@>=0.4.0: version "0.4.4" resolved "https://registry.yarnpkg.com/urlgrey/-/urlgrey-0.4.4.tgz#892fe95960805e85519f1cd4389f2cb4cbb7652f" @@ -2566,6 +3049,48 @@ verror@1.3.6: dependencies: extsprintf "1.0.2" +vfile-find-down@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/vfile-find-down/-/vfile-find-down-1.0.0.tgz#84a4d66d03513f6140a84e0776ef0848d4f0ad95" + dependencies: + to-vfile "^1.0.0" + +vfile-find-up@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/vfile-find-up/-/vfile-find-up-1.0.0.tgz#5604da6fe453b34350637984eb5fe4909e280390" + dependencies: + to-vfile "^1.0.0" + +vfile-location@^2.0.0: + version "2.0.1" + resolved "https://registry.yarnpkg.com/vfile-location/-/vfile-location-2.0.1.tgz#0bf8816f732b0f8bd902a56fda4c62c8e935dc52" + +vfile-reporter@^1.5.0: + version "1.5.0" + resolved "https://registry.yarnpkg.com/vfile-reporter/-/vfile-reporter-1.5.0.tgz#21a7009bfe55e24df8ff432aa5bf6f6efa74e418" + dependencies: + chalk "^1.1.0" + log-symbols "^1.0.2" + plur "^2.0.0" + repeat-string "^1.5.0" + string-width "^1.0.0" + text-table "^0.2.0" + vfile-sort "^1.0.0" + +vfile-sort@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/vfile-sort/-/vfile-sort-1.0.0.tgz#17ee491ba43e8951bb22913fcff32a7dc4d234d4" + +vfile@^1.0.0, vfile@^1.1.0: + version "1.4.0" + resolved "https://registry.yarnpkg.com/vfile/-/vfile-1.4.0.tgz#c0fd6fa484f8debdb771f68c31ed75d88da97fe7" + +ware@^1.3.0: + version "1.3.0" + resolved "https://registry.yarnpkg.com/ware/-/ware-1.3.0.tgz#d1b14f39d2e2cb4ab8c4098f756fe4b164e473d4" + dependencies: + wrap-fn "^0.1.0" + wcwidth@^1.0.0: version "1.0.1" resolved "https://registry.yarnpkg.com/wcwidth/-/wcwidth-1.0.1.tgz#f0b0dcf915bc5ff1528afadb2c0e17b532da2fe8" @@ -2603,6 +3128,12 @@ which@^1.2.9: dependencies: isexe "^1.1.1" +wide-align@^1.1.0: + version "1.1.0" + resolved "https://registry.yarnpkg.com/wide-align/-/wide-align-1.1.0.tgz#40edde802a71fea1f070da3e62dcda2e7add96ad" + dependencies: + string-width "^1.0.1" + window-size@0.1.0: version "0.1.0" resolved "https://registry.yarnpkg.com/window-size/-/window-size-0.1.0.tgz#5438cd2ea93b202efa3a19fe8887aee7c94f9c9d" @@ -2619,6 +3150,12 @@ wordwrap@~1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/wordwrap/-/wordwrap-1.0.0.tgz#27584810891456a4171c8d0226441ade90cbcaeb" +wrap-fn@^0.1.0: + version "0.1.5" + resolved "https://registry.yarnpkg.com/wrap-fn/-/wrap-fn-0.1.5.tgz#f21b6e41016ff4a7e31720dbc63a09016bdf9845" + dependencies: + co "3.1.0" + wrappy@1: version "1.0.2" resolved "https://registry.yarnpkg.com/wrappy/-/wrappy-1.0.2.tgz#b5243d8f3ec1aa35f1364605bc0d1036e30ab69f" @@ -2637,7 +3174,7 @@ xmldom@^0.1.22: version "0.1.27" resolved "https://registry.yarnpkg.com/xmldom/-/xmldom-0.1.27.tgz#d501f97b3bdb403af8ef9ecc20573187aadac0e9" -xtend@^4.0.0: +xtend@^4.0.0, xtend@^4.0.1: version "4.0.1" resolved "https://registry.yarnpkg.com/xtend/-/xtend-4.0.1.tgz#a5c6d532be656e23db820efb943a1f04998d63af" From 332a17f180aabc2b95317a12f21d1bc42a28fda2 Mon Sep 17 00:00:00 2001 From: Hannan Ali Date: Wed, 1 Mar 2017 04:28:46 +0500 Subject: [PATCH 03/28] lint JavaScript file --- docs/Configuration.md | 35 ++++++++++++++++++++++------------- 1 file changed, 22 insertions(+), 13 deletions(-) diff --git a/docs/Configuration.md b/docs/Configuration.md index e8f9182f8949..c5b8cb4167a6 100644 --- a/docs/Configuration.md +++ b/docs/Configuration.md @@ -13,7 +13,7 @@ or through the `--config ` option. If you'd like to use your `package.json` to store Jest's config, the "jest" key should be used on the top level so Jest will know how to find your settings: -```js +```json { "name": "my-project", "jest": { @@ -24,7 +24,7 @@ top level so Jest will know how to find your settings: When using the --config option, the JSON file must not contain a "jest" key: -```js +```json { "bail": true, "verbose": true @@ -79,8 +79,10 @@ the specified glob pattern, coverage information will be collected for it even i this file and it's never required in the test suite. Example: -```js -collectCoverageFrom: ["**/*.{js,jsx}", "!**/node_modules/**", "!**/vendor/**"] +```json +{ + "collectCoverageFrom" : ["**/*.{js,jsx}", "!**/node_modules/**", "!**/vendor/**"] +} ``` This will collect coverage information for all the files inside the project's `rootDir`, except the ones that match @@ -114,7 +116,7 @@ This will be used to configure minimum threshold enforcement for coverage result For example, statements: 90 implies minimum statement coverage is 90%. statements: -10 implies that no more than 10 uncovered statements are allowed. -```js +```json { ... "jest": { @@ -137,7 +139,7 @@ A set of global variables that need to be available in all test environments. For example, the following would create a global `__DEV__` variable set to `true` in all test environments: -```js +```json { ... "jest": { @@ -193,12 +195,14 @@ Use `` string token to refer to [`rootDir`](#rootdir-string) value if y Additionally, you can substitute captured regex groups using numbered backreferences. Example: -```js +```json +{ "moduleNameMapper": { "^image![a-zA-Z0-9$_-]+$": "GlobalImageStub", "^[./a-zA-Z0-9$_-]+\.png$": "/RelativeImageStub.js", "module_name_(.*)": "/substituted_module_$1.js" } +} ``` *Note: If you provide module name without boundaries `^$` it may cause hard to spot errors. E.g. `relay` will replace all modules which contain `relay` as a substring in its name: `relay`, `react-relay` and `graphql-relay` will all be pointed to your stub.* @@ -303,12 +307,14 @@ Example serializer module: ```js // my-serializer-module module.exports = { - test: function(val) { + print(val, serialize, indent) { + return 'Pretty foo: ' + serialize(val.foo); + }, + + test(val) { return val && val.hasOwnProperty('foo'); }, - print: function(val, serialize, indent) { - return 'Pretty foo: ' + serialize(val.foo); - } + }; ``` @@ -317,7 +323,7 @@ module.exports = { To use `my-serializer-module` as a serializer, configuration would be as follows: -```js +```json { ... "jest": { @@ -331,7 +337,10 @@ Finally tests would look as follows: ```js test(() => { const bar = { - foo: {x: 1, y: 2} + foo: { + x: 1, + y: 2, + }, }; expect(bar).toMatchSnapshot(); From a31cfcba17725438886ae160476d636f3bb39bc2 Mon Sep 17 00:00:00 2001 From: Hannan Ali Date: Wed, 1 Mar 2017 06:49:35 +0500 Subject: [PATCH 04/28] final lint-docs command --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index b25ebde93e4e..85728a6aa8b5 100644 --- a/package.json +++ b/package.json @@ -44,7 +44,7 @@ "jest": "node ./packages/jest-cli/bin/jest.js", "jest-coverage": "yarn run jest -- --coverage", "lint": "eslint . --cache", - "lint-docs": "eslint --no-ignore --ext md ./docs/*.md", + "lint-docs": "eslint --rule \"{'no-undef': 0}\" --no-ignore --ext md ./docs/*.md", "postinstall": "node ./scripts/postinstall.js && node ./scripts/build.js && (cd packages/eslint-plugin-jest && yarn link) && yarn link eslint-plugin-jest", "publish": "yarn run build-clean && yarn run build && lerna publish", "test-ci": "yarn run typecheck && yarn run lint && yarn run build && yarn run jest-coverage -- -i && yarn run test-examples && node scripts/mapCoverage.js && codecov", From ac365534e810ac1cec6c71f88f3f9e89f74d4c59 Mon Sep 17 00:00:00 2001 From: Hannan Ali Date: Wed, 1 Mar 2017 07:50:07 +0500 Subject: [PATCH 05/28] lint ExpectAPI --- docs/ExpectAPI.md | 88 +++++++++++++++++++++++++---------------------- 1 file changed, 47 insertions(+), 41 deletions(-) diff --git a/docs/ExpectAPI.md b/docs/ExpectAPI.md index 7791c0cecf54..06b4a9d643b5 100644 --- a/docs/ExpectAPI.md +++ b/docs/ExpectAPI.md @@ -45,16 +45,18 @@ expect.extend({ const pass = (received % argument == 0); if (pass) { return { + message: () => ( + `expected ${received} not to be divisible by ${argument}` + ), pass: true, - message: () => `expected ${received} not to be divisible by ${argument}`, - } + }; } else { return { + message: () => (`expected ${received} to be divisible by ${argument}`), pass: false, - message: () => `expected ${received} to be divisible by ${argument}`, - } + }; } - } + }, }); test('even and odd numbers', () => { @@ -125,10 +127,10 @@ When an assertion fails, the error message should give as much signal as necessa ```js test('map calls its argument with a non-null argument', () => { - let mock = jest.fn(); + const mock = jest.fn(); [1].map(mock); expect(mock).toBeCalledWith(expect.anything()); -}) +}); ``` ### `expect.any(constructor)` @@ -141,10 +143,10 @@ function randocall(fn) { } test('randocall calls its callback with a number', () => { - let mock = jest.fn(); + const mock = jest.fn(); randocall(mock); expect(mock).toBeCalledWith(expect.any(Number)); -}) +}); ``` ### `expect.arrayContaining(array)` @@ -172,10 +174,12 @@ describe('arrayContaining', () => { describe('Beware of a misunderstanding! A sequence of dice rolls', () => { const expected = [1, 2, 3, 4, 5, 6]; it('matches even with an unexpected number 7', () => { - expect([4, 1, 6, 7, 3, 5, 2, 5, 4, 6]).toEqual(expect.arrayContaining(expected)); + expect([4, 1, 6, 7, 3, 5, 2, 5, 4, 6]) + .toEqual(expect.arrayContaining(expected)); }); it('does not match without an expected number 2', () => { - expect([4, 1, 6, 7, 3, 5, 7, 5, 4, 6]).not.toEqual(expect.arrayContaining(expected)); + expect([4, 1, 6, 7, 3, 5, 7, 5, 4, 6]) + .not.toEqual(expect.arrayContaining(expected)); }); }); ``` @@ -189,11 +193,11 @@ For example, let's say that we have a few functions that all deal with state. `p ```js test('prepareState prepares a valid state', () => { expect.assertions(1); - prepareState((state) => { + prepareState(state => { expect(validateState(state)).toBeTruthy(); - }) + }); return waitOnState(); -}) +}); ``` The `expect.assertions(1)` call ensures that the `prepareState` callback actually gets called. @@ -208,13 +212,13 @@ For example, let's say that we expect an `onPress` function to be called with an ```js test('onPress gets called with the right thing', () => { - let onPress = jest.fn(); + const onPress = jest.fn(); simulatePresses(onPress); expect(onPress).toBeCalledWith(expect.objectContaining({ x: expect.any(Number), y: expect.any(Number), })); -}) +}); ``` ### `expect.stringContaining(string)` @@ -242,10 +246,12 @@ describe('stringMatching in arrayContaining', () => { expect.stringMatching(/^[BR]ob/), ]; it('matches even if received contains additional elements', () => { - expect(['Alicia', 'Roberto', 'Evelina']).toEqual(expect.arrayContaining(expected)); + expect(['Alicia', 'Roberto', 'Evelina']) + .toEqual(expect.arrayContaining(expected)); }); it('does not match if received does not contain expected elements', () => { - expect(['Roberto', 'Evelina']).not.toEqual(expect.arrayContaining(expected)); + expect(['Roberto', 'Evelina']) + .not.toEqual(expect.arrayContaining(expected)); }); }); ``` @@ -289,8 +295,8 @@ For example, this code will validate some properties of the `beverage` object: ```js const can = { - ounces: 12, name: 'pamplemousse', + ounces: 12, }; describe('the can', () => { @@ -317,13 +323,13 @@ For example, let's say you have a `drinkAll(drink, flavor)` function that takes ```js describe('drinkAll', () => { test('drinks something lemon-flavored', () => { - let drink = jest.fn(); + const drink = jest.fn(); drinkAll(drink, 'lemon'); expect(drink).toHaveBeenCalled(); }); test('does not drink something octopus-flavored', () => { - let drink = jest.fn(); + const drink = jest.fn(); drinkAll(drink, 'octopus'); expect(drink).not.toHaveBeenCalled(); }); @@ -338,7 +344,7 @@ For example, let's say you have a `drinkEach(drink, Array)` function tha ```js test('drinkEach drinks each drink', () => { - let drink = jest.fn(); + const drink = jest.fn(); drinkEach(drink, ['lemon', 'octopus']); expect(drink).toHaveBeenCalledTimes(2); }); @@ -354,9 +360,9 @@ For example, let's say that you can register a beverage with a `register` functi ```js test('registration applies correctly to orange La Croix', () => { - let beverage = new LaCroix('orange'); + const beverage = new LaCroix('orange'); register(beverage); - let f = jest.fn(); + const f = jest.fn(); applyToAll(f); expect(f).toHaveBeenCalledWith(beverage); }); @@ -370,7 +376,7 @@ If you have a mock function, you can use `.toHaveBeenLastCalledWith` to test wha ```js test('applying to all flavors does mango last', () => { - let drink = jest.fn(); + const drink = jest.fn(); applyToAllFlavors(drink); expect(drink).toHaveBeenLastCalledWith('mango'); }); @@ -605,8 +611,8 @@ describe('an essay on the best flavor', () => { test('mentions grapefruit', () => { expect(essayOnTheBestFlavor()).toMatch(/grapefruit/); expect(essayOnTheBestFlavor()).toMatch(new RegExp('grapefruit')); - }) -}) + }); +}); ``` This matcher also accepts a string, which it will try to match: @@ -615,8 +621,8 @@ This matcher also accepts a string, which it will try to match: describe('grapefruits are healthy', () => { test('grapefruits are a fruit', () => { expect('grapefruits').toMatch('fruit'); - }) -}) + }); +}); ``` ### `.toMatchObject(object)` @@ -625,20 +631,20 @@ Use `.toMatchObject` to check that a JavaScript object matches a subset of the p ```js const houseForSale = { - bath: true, - kitchen: { - amenities: ['oven', 'stove', 'washer'], - area: 20, - wallColor: 'white' - }, - bedrooms: 4 + bath: true, + bedrooms: 4, + kitchen: { + amenities: ['oven', 'stove', 'washer'], + area: 20, + wallColor: 'white', + }, }; const desiredHouse = { - bath: true, - kitchen: { - amenities: ['oven', 'stove', 'washer'], - wallColor: 'white' - } + bath: true, + kitchen: { + amenities: ['oven', 'stove', 'washer'], + wallColor: 'white', + }, }; test('the house has my desired features', () => { From bc078f36d8f82af771f07ec2a476bad6af39e347 Mon Sep 17 00:00:00 2001 From: Hannan Ali Date: Thu, 2 Mar 2017 22:34:44 +0500 Subject: [PATCH 06/28] lint GettingStarted.md --- docs/GettingStarted.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/GettingStarted.md b/docs/GettingStarted.md index ea031188ae2e..97d502d5ce3d 100644 --- a/docs/GettingStarted.md +++ b/docs/GettingStarted.md @@ -34,7 +34,7 @@ test('adds 1 + 2 to equal 3', () => { Add the following section to your `package.json`: -```js +```json "scripts": { "test": "jest" } @@ -77,7 +77,7 @@ npm install --save-dev babel-jest regenerator-runtime Don't forget to add a [`.babelrc`](https://babeljs.io/docs/usage/babelrc/) file in your project's root folder. For example, if you are using ES6 and [React.js](https://facebook.github.io/react/) with the [`babel-preset-es2015`](https://babeljs.io/docs/plugins/preset-es2015/) and [`babel-preset-react`](https://babeljs.io/docs/plugins/preset-react/) presets: -```js +```json { "presets": ["es2015", "react"] } From 7c60fdb77e7417cfeb51e01f4e0f3c1b1c6e3f06 Mon Sep 17 00:00:00 2001 From: Hannan Ali Date: Thu, 2 Mar 2017 22:35:17 +0500 Subject: [PATCH 07/28] lint GlobalAPI --- docs/GlobalAPI.md | 68 +++++++++++++++++++++++------------------------ 1 file changed, 34 insertions(+), 34 deletions(-) diff --git a/docs/GlobalAPI.md b/docs/GlobalAPI.md index 84f3332c0c4c..c0a48a7a35a6 100644 --- a/docs/GlobalAPI.md +++ b/docs/GlobalAPI.md @@ -26,7 +26,7 @@ This is often useful if you want to clean up some global setup state that is sha For example: ```js -let globalDatabase = makeGlobalDatabase(); +const globalDatabase = makeGlobalDatabase(); function cleanUpDatabase(db) { db.cleanUp(); @@ -34,19 +34,19 @@ function cleanUpDatabase(db) { afterAll(() => { cleanUpDatabase(globalDatabase); -}) +}); test('can find things', () => { - return globalDatabase.find('thing', {}, (results) => { - expect(results.length).toBeGreaterThan(0) - }) -}) + return globalDatabase.find('thing', {}, results => { + expect(results.length).toBeGreaterThan(0); + }); +}); test('can insert a thing', () => { - return globalDatabase.insert('thing', makeThing(), (response) => { + return globalDatabase.insert('thing', makeThing(), response => { expect(response.success).toBeTruthy(); - }) -}) + }); +}); ``` Here the `afterAll` ensures that `cleanUpDatabase` is called after all tests run. @@ -64,7 +64,7 @@ This is often useful if you want to clean up some temporary state that is create For example: ```js -let globalDatabase = makeGlobalDatabase(); +const globalDatabase = makeGlobalDatabase(); function cleanUpDatabase(db) { db.cleanUp(); @@ -72,19 +72,19 @@ function cleanUpDatabase(db) { afterEach(() => { cleanUpDatabase(globalDatabase); -}) +}); test('can find things', () => { - return globalDatabase.find('thing', {}, (results) => { + return globalDatabase.find('thing', {}, results => { expect(results.length).toBeGreaterThan(0); - }) -}) + }); +}); test('can insert a thing', () => { - return globalDatabase.insert('thing', makeThing(), (response) => { + return globalDatabase.insert('thing', makeThing(), response => { expect(response.success).toBeTruthy(); - }) -}) + }); +}); ``` Here the `afterEach` ensures that `cleanUpDatabase` is called after each test runs. @@ -102,23 +102,23 @@ This is often useful if you want to set up some global state that will be used b For example: ```js -let globalDatabase = makeGlobalDatabase(); +const globalDatabase = makeGlobalDatabase(); beforeAll(() => { // Clears the database and adds some testing data. // Jest will wait for this promise to resolve before running tests. return globalDatabase.clear().then(() => { - return globalDatabase.insert({ testData: 'foo' }) - }) -}) + return globalDatabase.insert({testData: 'foo'}); + }); +}); // Since we only set up the database once in this example, it's important // that our tests don't modify it. test('can find things', () => { - return globalDatabase.find('thing', {}, (results) => { + return globalDatabase.find('thing', {}, results => { expect(results.length).toBeGreaterThan(0); - }) -}) + }); +}); ``` Here the `beforeAll` ensures that the database is set up before tests run. If setup was synchronous, you could just do this without `beforeAll`. The key is that Jest will wait for a promise to resolve, so you can have asynchronous setup as well. @@ -136,27 +136,27 @@ This is often useful if you want to reset some global state that will be used by For example: ```js -let globalDatabase = makeGlobalDatabase(); +const globalDatabase = makeGlobalDatabase(); beforeEach(() => { // Clears the database and adds some testing data. // Jest will wait for this promise to resolve before running tests. return globalDatabase.clear().then(() => { - return globalDatabase.insert({ testData: 'foo' }) - }) -}) + return globalDatabase.insert({testData: 'foo'}); + }); +}); test('can find things', () => { - return globalDatabase.find('thing', {}, (results) => { + return globalDatabase.find('thing', {}, results => { expect(results.length).toBeGreaterThan(0); - }) -}) + }); +}); test('can insert a thing', () => { - return globalDatabase.insert('thing', makeThing(), (response) => { + return globalDatabase.insert('thing', makeThing(), response => { expect(response.success).toBeTruthy(); - }) -}) + }); +}); ``` Here the `beforeEach` ensures that the database is reset for each test. From c930511eab29af398967b4cc815e1ebf53e9fd18 Mon Sep 17 00:00:00 2001 From: Hannan Ali Date: Thu, 2 Mar 2017 22:42:25 +0500 Subject: [PATCH 08/28] lint GlobalAPI --- docs/GlobalAPI.md | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/docs/GlobalAPI.md b/docs/GlobalAPI.md index c0a48a7a35a6..22e26e5ae92e 100644 --- a/docs/GlobalAPI.md +++ b/docs/GlobalAPI.md @@ -195,6 +195,8 @@ Also under the alias: `fdescribe(name, fn)` You can use `describe.only` if you want to run only one describe block: ```js + +/* eslint jest/no-focused-tests: "off" */ describe.only('my beverage', () => { test('is delicious', () => { expect(myBeverage.delicious).toBeTruthy(); @@ -264,7 +266,7 @@ For example, let's say `fetchBeverageList()` returns a promise that is supposed ```js test('has lemon in it', () => { - return fetchBeverageList().then((list) => { + return fetchBeverageList().then(list => { expect(list).toContain('lemon'); }); }); @@ -281,13 +283,15 @@ When you are debugging a large codebase, you will often only want to run a subse For example, let's say you had these tests: ```js +/* eslint jest/no-focused-tests: "off" */ + test.only('it is raining', () => { expect(inchesOfRain()).toBeGreaterThan(0); -}) +}); test('it is not snowing', () => { expect(inchesOfSnow()).toBe(0); -}) +}); ``` Only the "it is raining" test will run, since it is run with `test.only`. @@ -305,11 +309,11 @@ For example, let's say you had these tests: ```js test('it is raining', () => { expect(inchesOfRain()).toBeGreaterThan(0); -}) +}); test.skip('it is not snowing', () => { expect(inchesOfSnow()).toBe(0); -}) +}); ``` Only the "it is raining" test will run, since the other test is run with `test.skip`. From 60ad96a180c98f179d67528fcbe0635de13553f0 Mon Sep 17 00:00:00 2001 From: Hannan Ali Date: Thu, 2 Mar 2017 22:46:00 +0500 Subject: [PATCH 09/28] lint JestObjectAPI --- docs/JestObjectAPI.md | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/docs/JestObjectAPI.md b/docs/JestObjectAPI.md index 0daccda5cefc..c659b5438a1b 100644 --- a/docs/JestObjectAPI.md +++ b/docs/JestObjectAPI.md @@ -71,7 +71,7 @@ Returns a new, unused [mock function](/jest/docs/mock-function-api.html). Option // With a mock implementation: const returnsTrue = jest.fn(() => true); - console.log(returnsTrue()) // true; + console.log(returnsTrue()); // true; ``` ### `jest.isMockFunction(fn)` @@ -112,7 +112,10 @@ The third argument can be used to create virtual mocks – mocks of modules that ```js jest.mock('../moduleName', () => { - // custom implementation of a module that doesn't exist in JS, like a generated module or a native module in react-native. + /* + * Custom implementation of a module that doesn't exist in JS, + * like a generated module or a native module in react-native. + */ }, {virtual: true}); ``` @@ -139,7 +142,8 @@ Example: const sum1 = require('../sum'); jest.resetModules(); const sum2 = require('../sum'); -sum1 === sum2 // false! Both sum modules are separate "instances" of the sum module. +sum1 === sum2; +// > false (Both sum modules are separate "instances" of the sum module.) ``` Example in a test: @@ -225,9 +229,9 @@ Example: ```js const video = { - play: function () { + play() { return true; - } + }, }; module.exports = video; @@ -238,7 +242,7 @@ Example test: const video = require('./video'); test('plays video', () => { - const spy = jest.spyOn(video, 'play') + const spy = jest.spyOn(video, 'play'); const isPlaying = video.play(); expect(spy).toHaveBeenCalled(); From bb4b33edf0802e4f92240ad5f5fc599e57427b85 Mon Sep 17 00:00:00 2001 From: Hannan Ali Date: Thu, 2 Mar 2017 22:58:23 +0500 Subject: [PATCH 10/28] lint Webpack.md --- docs/Webpack.md | 36 ++++++++++++++++++------------------ 1 file changed, 18 insertions(+), 18 deletions(-) diff --git a/docs/Webpack.md b/docs/Webpack.md index d18591fade70..0d5093fefc11 100644 --- a/docs/Webpack.md +++ b/docs/Webpack.md @@ -19,22 +19,22 @@ Let's start with a common sort of webpack config file and translate it to a Jest module.exports = { module: { loaders: [ - { test: /\\.jsx?$/, loader: 'babel', exclude: ['node_modules'] }, - { test: /\\.css$/, loader: "style-loader!css-loader" }, - { test: /\\.gif$/, loader: "url-loader" }, - { test: /\\.(ttf|eot|svg)$/, loader: "file-loader" }, - ] + {exclude: ['node_modules'], loader: 'babel', test: /\\.jsx?$/}, + {loader: 'style-loader!css-loader', test: /\\.css$/}, + {loader: 'url-loader', test: /\\.gif$/}, + {loader: 'file-loader', test: /\\.(ttf|eot|svg)$/}, + ], }, resolve: { - extensions: ['', 'js', 'jsx'], - modulesDirectories: ['node_modules', 'bower_components', 'shared'], - root: '/shared/vendor/modules', alias: { - react: './vendor/react-master', config$: './configs/app-config.js', + react: './vendor/react-master', }, - } -} + extensions: ['', 'js', 'jsx'], + modulesDirectories: ['node_modules', 'bower_components', 'shared'], + root: '/shared/vendor/modules', + }, +}; ``` If you have JavaScript files that are transformed by Babel, you can [enable support for Babel](/jest/docs/getting-started.html#using-babel-with-jest) by installing the `babel-jest` plugin. Non-Babel JavaScript transformations can be handled with Jest's [`transform`](/jest/docs/configuration.html#transform-object-string-string) config option. @@ -43,7 +43,7 @@ If you have JavaScript files that are transformed by Babel, you can [enable supp Next, let's configure Jest to gracefully handle asset files such as stylesheets and images. Usually, these files aren't particularly useful in tests so we can safely mock them out. However, if you are using CSS Modules then it's better to mock a proxy for your className lookups. -```js +```json // package.json { "jest": { @@ -79,7 +79,7 @@ npm install --save-dev identity-obj-proxy Then all your className lookups on the styles object will be returned as-is (e.g., `styles.foobar === 'foobar'`). This is pretty handy for React [Snapshot Testing](/jest/docs/snapshot-testing.html). -```js +```json // package.json (for CSS Modules) { "jest": { @@ -110,7 +110,7 @@ module.exports = { }; ``` -```js +```json // package.json (for custom transformers and CSS Modules) { "jest": { @@ -128,7 +128,7 @@ We've told Jest to ignore files matching a stylesheet or image extension, and in *Note: if you are using babel-jest with additional code preprocessors, you have to explicitly define babel-jest as a transformer for your JavaScript code to map `.js` files to the babel-jest module.* -``` +```json "transform": { "^.+\\.js$": "babel-jest", "^.+\\.css$": "custom-transformer", @@ -140,7 +140,7 @@ We've told Jest to ignore files matching a stylesheet or image extension, and in Now that Jest knows how to process our files, we need to tell it how to _find_ them. For webpack's `modulesDirectories`, and `extensions` options there are direct analogs in Jest's `moduleDirectories` and `moduleFileExtensions` options. -```js +```json // package.json { "jest": { @@ -160,7 +160,7 @@ Now that Jest knows how to process our files, we need to tell it how to _find_ t Similarly webpack's `resolve.root` option functions like setting the `NODE_PATH` env variable, which you can set, or make use of the `modulePaths` option. -```js +```json // package.json { "jest": { @@ -179,7 +179,7 @@ Similarly webpack's `resolve.root` option functions like setting the `NODE_PATH` And finally we just have the webpack `alias` left to handle. For that we can make use of the `moduleNameMapper` option again. -```js +```json // package.json { "jest": { From 9f9ec1f4dca023cff37f15574de7f5494f9989ec Mon Sep 17 00:00:00 2001 From: Hannan Ali Date: Thu, 2 Mar 2017 23:02:01 +0500 Subject: [PATCH 11/28] lint UsingMatchers.md in docs --- docs/UsingMatchers.md | 34 ++++++++++++++++++++-------------- 1 file changed, 20 insertions(+), 14 deletions(-) diff --git a/docs/UsingMatchers.md b/docs/UsingMatchers.md index 8cfeeb6a5593..363ccb61455d 100644 --- a/docs/UsingMatchers.md +++ b/docs/UsingMatchers.md @@ -17,7 +17,7 @@ The simplest way to test a value is with exact equality. ```js test('two plus two is four', () => { expect(2 + 2).toBe(4); -}) +}); ``` In this code, `expect(2 + 2)` returns an "expectation" object. You typically won't do much with these expectation objects except call matchers on them. In this code, `.toBe(4)` is the matcher. When Jest runs, it tracks all the failing matchers so that it can print out nice error messages for you. @@ -26,10 +26,10 @@ In this code, `expect(2 + 2)` returns an "expectation" object. You typically won ```js test('object assignment', () => { - let data = { one: 1 }; + const data = {one: 1}; data['two'] = 2; - expect(data).toEqual({ one: 1, two: 2 }); -}) + expect(data).toEqual({one: 1, two: 2}); +}); ``` `toEqual` recursively checks every field of an object or array. @@ -43,7 +43,7 @@ test('adding positive numbers is not zero', () => { expect(a + b).not.toBe(0); } } -}) +}); ``` ### Truthiness @@ -60,7 +60,7 @@ For example: ```js test('null', () => { - let n = null; + const n = null; expect(n).toBeNull(); expect(n).toBeDefined(); expect(n).not.toBeUndefined(); @@ -69,7 +69,7 @@ test('null', () => { }); test('zero', () => { - let z = 0; + const z = 0; expect(z).not.toBeNull(); expect(z).toBeDefined(); expect(z).not.toBeUndefined(); @@ -86,7 +86,7 @@ Most ways of comparing numbers have matcher equivalents. ```js test('two plus two', () => { - let value = 2 + 2; + const value = 2 + 2; expect(value).toBeGreaterThan(3); expect(value).toBeGreaterThanOrEqual(3.5); expect(value).toBeLessThan(5); @@ -102,10 +102,10 @@ For floating point equality, use `toBeCloseTo` instead of `toEqual`, because you ```js test('adding floating point numbers', () => { - let value = 0.1 + 0.2; + const value = 0.1 + 0.2; expect(value).not.toBe(0.3); // It isn't! Because rounding error expect(value).toBeCloseTo(0.3); // This works. -}) +}); ``` ### Strings @@ -119,7 +119,7 @@ test('there is no I in team', () => { test('but there is a "stop" in Christoph', () => { expect('Christoph').toMatch(/stop/); -}) +}); ``` ### Arrays @@ -127,11 +127,17 @@ test('but there is a "stop" in Christoph', () => { You can check if an array contains a particular item using `toContain`: ```js -let shoppingList = ['diapers', 'kleenex', 'trash bags', 'paper towels', 'beer']; +const shoppingList = [ + 'diapers', + 'kleenex', + 'trash bags', + 'paper towels', + 'beer', +]; test('the shopping list has beer on it', () => { expect(shoppingList).toContain('beer'); -}) +}); ``` ### Exceptions @@ -150,7 +156,7 @@ test('compiling android goes as expected', () => { // You can also use the exact error message or a regexp expect(compileAndroidCode).toThrow('you are using the wrong JDK'); expect(compileAndroidCode).toThrow(/JDK/); -}) +}); ``` ### And More From c4ee489a06ab0280964a02fdf1f8eea42fbff64f Mon Sep 17 00:00:00 2001 From: Hannan Ali Date: Thu, 2 Mar 2017 23:05:01 +0500 Subject: [PATCH 12/28] lint TutorialReactNative.md in docs --- docs/TutorialReactNative.md | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/docs/TutorialReactNative.md b/docs/TutorialReactNative.md index e5fffc9296b1..8e2211cfc284 100644 --- a/docs/TutorialReactNative.md +++ b/docs/TutorialReactNative.md @@ -16,7 +16,7 @@ Get a deeper insight into testing a working example React Native app reading the ## Setup Starting from react-native version 0.38, a Jest setup is included by default when running `react-native init`. The following configuration should be automatically added to your package.json file: -```javascript +```json // package.json "scripts": { "test": "jest" @@ -40,25 +40,25 @@ import React, {Component} from 'react'; import { StyleSheet, Text, - View + View, } from 'react-native'; const styles = StyleSheet.create({ container: { - flex: 1, - justifyContent: 'center', alignItems: 'center', backgroundColor: '#F5FCFF', + flex: 1, + justifyContent: 'center', + }, + instructions: { + color: '#333333', + marginBottom: 5, + textAlign: 'center', }, welcome: { fontSize: 20, - textAlign: 'center', margin: 10, - }, - instructions: { textAlign: 'center', - color: '#333333', - marginBottom: 5, }, }); @@ -154,7 +154,7 @@ The [`transformIgnorePatterns`](configuration.html#transformignorepatterns-array By default the jest-react-native preset only processes the project's own source files and react-native. If you have npm dependencies that have to be transformed you can customize this configuration option by whitelisting modules other than react-native: -```js +```json "transformIgnorePatterns": [ "node_modules/(?!react-native|my-project|react-native-button)" ] @@ -168,7 +168,7 @@ If you'd like to provide additional configuration for every test file, the [`set The [`moduleNameMapper`](configuration.html#modulenamemapper-object-string-string) can be used to map a module path to a different module. By default the preset maps all images to an image stub module but if a module cannot be found this configuration option can help: -```js +```json "moduleNameMapper": { "my-module.js": "/path/to/my-module.js" } @@ -230,7 +230,7 @@ import renderer from 'react-test-renderer'; ### `@providesModule` If you'd like to use Facebook's `@providesModule` module system through an npm package, the default haste config option must be overwritten and npm modules must be added to `providesModuleNodeModules`: -```js +```json "haste": { "defaultPlatform": "ios", "platforms": ["android", "ios"], From d3181c092d3c9e24603e5156f5cae7faf197c78e Mon Sep 17 00:00:00 2001 From: Hannan Ali Date: Thu, 2 Mar 2017 23:13:05 +0500 Subject: [PATCH 13/28] lint TutorialReact.md in docs --- docs/TutorialReact.md | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/docs/TutorialReact.md b/docs/TutorialReact.md index c92ee08f7fac..b71c09a63aca 100644 --- a/docs/TutorialReact.md +++ b/docs/TutorialReact.md @@ -19,13 +19,13 @@ If you have an existing application you'll need to install a few packages to mak Run -```javascript +```bash npm install --save-dev jest babel-jest babel-preset-es2015 babel-preset-react react-test-renderer ``` Your `package.json` should look something like this (where `` is the actual latest version number for the package). Please add the scripts and jest configuration entries: -```javascript +```json // package.json "dependencies": { "react": "", @@ -43,7 +43,7 @@ Your `package.json` should look something like this (where `` i } ``` -```javascript +```json // .babelrc { "presets": ["es2015", "react"] @@ -61,8 +61,8 @@ Let's create a [snapshot test](/jest/docs/snapshot-testing.html) for a Link comp import React from 'react'; const STATUS = { - NORMAL: 'normal', HOVERED: 'hovered', + NORMAL: 'normal', }; export default class Link extends React.Component { From 1b4d43110eccc22d5424a9fb3362c046f3930c9e Mon Sep 17 00:00:00 2001 From: Hannan Ali Date: Thu, 2 Mar 2017 23:45:28 +0500 Subject: [PATCH 14/28] lint docs file --- docs/ManualMocks.md | 24 ++++++++--------- docs/MockFunctionAPI.md | 12 ++++----- docs/MockFunctions.md | 58 ++++++++++++++++++++-------------------- docs/SetupAndTeardown.md | 2 ++ docs/SnapshotTesting.md | 2 ++ docs/TestingAsyncCode.md | 12 ++++----- docs/TimerMocks.md | 22 +++++++-------- docs/Troubleshooting.md | 2 +- docs/TutorialAsync.md | 8 ++++-- docs/TutorialjQuery.md | 2 +- 10 files changed, 76 insertions(+), 68 deletions(-) diff --git a/docs/ManualMocks.md b/docs/ManualMocks.md index 1bb2396e659b..c457932d8626 100644 --- a/docs/ManualMocks.md +++ b/docs/ManualMocks.md @@ -17,17 +17,17 @@ put it in the ``models/__mocks__`` directory. If the module you are mocking is a node module (eg: `fs`), the mock should be placed in the same parent directory as the ``node_modules`` folder. Eg: -``` - node_modules - __mocks__ - fs.js - __tests__ - models - __mocks__ - user.js - user.js - views - config +```bash +. +├── config +├── fs.js +├── __mocks__ +├── models +│   ├── __mocks__ +│   │   └── user.js +│   └── user.js +├── node_modules +└── views ``` When a manual mock exists for a given module, Jest's module system will use that module when explicitly calling `jest.mock('moduleName')`. However, manual mocks will take precedence over node modules even if `jest.mock('moduleName')` is not called. To opt out of this behavior you will need to explicitly call `jest.unmock('moduleName')` in tests that should use the actual module implementation. @@ -43,8 +43,8 @@ const fs = require('fs'); function summarizeFilesInDirectorySync(directory) { return fs.readdirSync(directory).map(fileName => ({ - fileName, directory, + fileName, })); } diff --git a/docs/MockFunctionAPI.md b/docs/MockFunctionAPI.md index e462c4603d27..9c27daba56d1 100644 --- a/docs/MockFunctionAPI.md +++ b/docs/MockFunctionAPI.md @@ -26,8 +26,8 @@ For example: A mock function `f` that has been called twice, with the arguments ```js [ ['arg1', 'arg2'], - ['arg3', 'arg4'] -] + ['arg3', 'arg4'], +]; ``` ### `mockFn.mock.instances` @@ -36,10 +36,10 @@ An array that contains all the object instances that have been instantiated from For example: A mock function that has been instantiated twice would have the following `mock.instances` array: ```js -var mockFn = jest.fn(); +const mockFn = jest.fn(); -var a = new mockFn(); -var b = new mockFn(); +const a = new mockFn(); +const b = new mockFn(); mockFn.mock.instances[0] === a; // true mockFn.mock.instances[1] === b; // true @@ -153,7 +153,7 @@ jest.genMockFunction().mockImplementation(() => value); Just a simple sugar function for: ```js -const valueReturned = false; +let valueReturned = false; jest.fn(() => { if (!valueReturned) { valueReturned = true; diff --git a/docs/MockFunctions.md b/docs/MockFunctions.md index 6253d6dc02ee..2d6c34bab8c3 100644 --- a/docs/MockFunctions.md +++ b/docs/MockFunctions.md @@ -19,11 +19,11 @@ There are two ways to get your hands on mock functions: Either by or by explicitly requesting one from `jest.fn()` in your test: ```javascript -var myMock = jest.fn(); +const myMock = jest.fn(); myMock('1'); myMock('a', 'b'); console.log(myMock.mock.calls); -> [ [1], ['a', 'b'] ] +// > [ [1], ['a', 'b'] ] ``` ## `.mock` property @@ -33,15 +33,15 @@ how the function has been called is kept. The `.mock` property also tracks the value of `this` for each call, so it is possible to inspect this as well: ```javascript -var myMock = jest.fn(); +const myMock = jest.fn(); -var a = new myMock(); -var b = {}; -var bound = myMock.bind(b); +const a = new myMock(); +const b = {}; +const bound = myMock.bind(b); bound(); console.log(myMock.mock.instances); -> [ , ] +// > [ , ] ``` These mock members are very useful in tests to assert how these functions get @@ -71,16 +71,16 @@ Mock functions can also be used to inject test values into your code during a test: ```javascript -var myMock = jest.fn(); -console.log( myMock() ); -> undefined +const myMock = jest.fn(); +console.log(myMock()); +// > undefined myMock.mockReturnValueOnce(10) .mockReturnValueOnce('x') .mockReturnValue(true); console.log(myMock(), myMock(), myMock(), myMock()); -> 10, 'x', true, true +// > 10, 'x', true, true ``` Mock functions are also very effective in code that uses a functional @@ -90,7 +90,7 @@ in for, in favor of injecting values directly into the test right before they're used. ```javascript -var filterTestFn = jest.fn(); +const filterTestFn = jest.fn(); // Make the mock return `true` for the first call, // and `false` for the second call @@ -98,12 +98,12 @@ filterTestFn .mockReturnValueOnce(true) .mockReturnValueOnce(false); -var result = [11, 12].filter(filterTestFn); +const result = [11, 12].filter(filterTestFn); console.log(result); -> [11] +// > [11] console.log(filterTestFn.mock.calls); -> [ [11], [12] ] +// > [ [11], [12] ] ``` Most real-world examples actually involve getting ahold of a mock function on a @@ -119,13 +119,13 @@ can be done with `jest.fn` or the `mockImplementationOnce` method on mock functions. ```javascript -var myMockFn = jest.fn(cb => cb(null, true)); +const myMockFn = jest.fn(cb => cb(null, true)); myMockFn((err, val) => console.log(val)); -> true +// > true myMockFn((err, val) => console.log(val)); -> true +// > true ``` The `mockImplementation` method is useful when you need to define the default @@ -144,7 +144,7 @@ const foo = require('../foo'); // foo is a mock function foo.mockImplementation(() => 42); foo(); -> 42 +// > 42 ``` @@ -153,15 +153,15 @@ multiple function calls produce different results, use the `mockImplementationOnce` method: ```javascript -var myMockFn = jest.fn() +const myMockFn = jest.fn() .mockImplementationOnce(cb => cb(null, true)) .mockImplementationOnce(cb => cb(null, false)); myMockFn((err, val) => console.log(val)); -> true +// > true myMockFn((err, val) => console.log(val)); -> false +// > false ``` When the mocked function runs out of implementations defined with @@ -169,12 +169,12 @@ When the mocked function runs out of implementations defined with set with `jest.fn` (if it is defined): ```javascript -var myMockFn = jest.fn(() => 'default') +const myMockFn = jest.fn(() => 'default') .mockImplementationOnce(() => 'first call') .mockImplementationOnce(() => 'second call'); console.log(myMockFn(), myMockFn(), myMockFn(), myMockFn()); -> 'first call', 'second call', 'default', 'default' +// > 'first call', 'second call', 'default', 'default' ``` For cases where we have methods that are typically chained (and thus always need @@ -182,16 +182,16 @@ to return `this`), we have a sugary API to simplify this in the form of a `.mockReturnThis()` function that also sits on all mocks: ```javascript -var myObj = { - myMethod: jest.fn().mockReturnThis() +const myObj = { + myMethod: jest.fn().mockReturnThis(), }; // is the same as -var myObj = { - myMethod = jest.fn(function() { +const otherObj = { + myMethod: jest.fn(function() { return this; - }); + }), }; ``` diff --git a/docs/SetupAndTeardown.md b/docs/SetupAndTeardown.md index f31cfa4ee461..5dec7751c828 100644 --- a/docs/SetupAndTeardown.md +++ b/docs/SetupAndTeardown.md @@ -107,6 +107,8 @@ describe('matching cities to foods', () => { If a test is failing, one of the first things to check should be whether the test is failing when it's the only test that runs. In Jest it's simple to run only one test - just temporarily change that `test` command to a `test.only`: ```js +/* eslint jest/no-focused-tests: "off" */ + test.only('this will be the only test that runs', () => { expect(true).toBe(false); }); diff --git a/docs/SnapshotTesting.md b/docs/SnapshotTesting.md index e00f7097b5c5..a6c60b4c9a95 100644 --- a/docs/SnapshotTesting.md +++ b/docs/SnapshotTesting.md @@ -55,6 +55,8 @@ One such situation can arise if we intentionally change the address the Link com ```javascript // Updated test case with a Link to a different address it('renders correctly', () => { + /* eslint react/react-in-jsx-scope: "off", react/jsx-no-undef: "off" */ + const tree = renderer.create( Instagram ).toJSON(); diff --git a/docs/TestingAsyncCode.md b/docs/TestingAsyncCode.md index 9f530fbdfc1f..0cffcd5f451c 100644 --- a/docs/TestingAsyncCode.md +++ b/docs/TestingAsyncCode.md @@ -34,14 +34,14 @@ The problem is that the test will complete as soon as `fetchData` completes, bef There is an alternate form of `test` that fixes this. Instead of putting the test in a function with an empty argument, use a single argument called `done`. Jest will wait until the `done` callback is called before finishing the test. ```js -test('the data is peanut butter', (done) => { +test('the data is peanut butter', done => { function callback(data) { expect(data).toBe('peanut butter'); done(); } fetchData(callback); -}) +}); ``` If `done()` is never called, the test will fail, which is what you want to happen. @@ -54,10 +54,10 @@ For example, let's say that `fetchData`, instead of using a callback, returns a ```js test('the data is peanut butter', () => { - return fetchData().then((data) => { + return fetchData().then(data => { expect(data).toBe('peanut butter'); }); -}) +}); ``` Be sure to return the promise - if you omit this `return` statement, your test will complete before `fetchData` completes. @@ -68,9 +68,9 @@ If your code uses `async` and `await`, you can use these in your tests as well. ```js test('the data is peanut butter', async () => { - let data = await fetchData(); + const data = await fetchData(); expect(data).toBe('peanut butter'); -}) +}); ``` In this case, `async` and `await` are effectively just syntactic sugar for the same logic as the promises example uses. diff --git a/docs/TimerMocks.md b/docs/TimerMocks.md index 976b7e439e2d..0a2503fdf8c7 100644 --- a/docs/TimerMocks.md +++ b/docs/TimerMocks.md @@ -153,21 +153,21 @@ module.exports = timerGame; ```javascript it('calls the callback after 1 second via runTimersToTime', () => { - const timerGame = require('../timerGame'); - const callback = jest.fn(); + const timerGame = require('../timerGame'); + const callback = jest.fn(); - timerGame(callback); + timerGame(callback); - // At this point in time, the callback should not have been called yet - expect(callback).not.toBeCalled(); + // At this point in time, the callback should not have been called yet + expect(callback).not.toBeCalled(); - // Fast-forward until all timers have been executed - jest.runTimersToTime(1000); + // Fast-forward until all timers have been executed + jest.runTimersToTime(1000); - // Now our callback should have been called! - expect(callback).toBeCalled(); - expect(callback.mock.calls.length).toBe(1); - }); + // Now our callback should have been called! + expect(callback).toBeCalled(); + expect(callback.mock.calls.length).toBe(1); +}); ``` Lastly, it may occasionally be useful in some tests to be able to clear all of diff --git a/docs/Troubleshooting.md b/docs/Troubleshooting.md index ed96cd8c2cdc..dad45036e487 100644 --- a/docs/Troubleshooting.md +++ b/docs/Troubleshooting.md @@ -115,7 +115,7 @@ import foo from './foo'; In ES6, import statements get hoisted before all other ```js -var foo = require('foo'); +const foo = require('foo'); jest.dontMock('foo'); // Oops! ``` diff --git a/docs/TutorialAsync.md b/docs/TutorialAsync.md index c1d3b3052b78..5de60158dd74 100644 --- a/docs/TutorialAsync.md +++ b/docs/TutorialAsync.md @@ -113,7 +113,9 @@ if a Promise throws and the error is not handled, the test will fail. `expect.as ```js // Testing for async errors can be done using `catch`. it('tests error with promises', () => { - expect.assertions(1); // to be sure that `Promise` rejected and `expect` has been called once + // to be sure that `Promise` rejected and `expect` has been called once + expect.assertions(1); + return user.getUserName(3) .catch(e => expect(e).toEqual({ error: 'User with 3 not found.', @@ -122,7 +124,9 @@ it('tests error with promises', () => { // Or try-catch. it('tests error with async/await', async () => { - expect.assertions(1); // to be sure that `await` throws error and `expect` has been called once + // to be sure that `await` throws error and `expect` has been called once + expect.assertions(1); + try { await user.getUserName(2); } catch (object) { diff --git a/docs/TutorialjQuery.md b/docs/TutorialjQuery.md index 08ae861a9a6d..72df88a745ac 100644 --- a/docs/TutorialjQuery.md +++ b/docs/TutorialjQuery.md @@ -53,8 +53,8 @@ test('displays a user after a click', () => { // its callback with some data fetchCurrentUser.mockImplementation(cb => { cb({ - loggedIn: true, fullName: 'Johnny Cash', + loggedIn: true, }); }); From 34ec518507a146d862c1a481f2508363a70345ba Mon Sep 17 00:00:00 2001 From: Hannan Ali Date: Thu, 2 Mar 2017 23:51:54 +0500 Subject: [PATCH 15/28] add lint-docs to test-ci script --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 85728a6aa8b5..2e6cda67cfe1 100644 --- a/package.json +++ b/package.json @@ -47,7 +47,7 @@ "lint-docs": "eslint --rule \"{'no-undef': 0}\" --no-ignore --ext md ./docs/*.md", "postinstall": "node ./scripts/postinstall.js && node ./scripts/build.js && (cd packages/eslint-plugin-jest && yarn link) && yarn link eslint-plugin-jest", "publish": "yarn run build-clean && yarn run build && lerna publish", - "test-ci": "yarn run typecheck && yarn run lint && yarn run build && yarn run jest-coverage -- -i && yarn run test-examples && node scripts/mapCoverage.js && codecov", + "test-ci": "yarn run typecheck && yarn run lint && yarn run lint-docs && yarn run build && yarn run jest-coverage -- -i && yarn run test-examples && node scripts/mapCoverage.js && codecov", "test-ci-partial": "yarn run build && yarn run jest -- -i && yarn run test-examples", "test-examples": "node scripts/test_examples.js", "test-pretty-format-perf": "node packages/pretty-format/perf/test.js", From 7184d5cfcaa6d0cb82dccc659cbd649e72b50c58 Mon Sep 17 00:00:00 2001 From: Hannan Ali Date: Fri, 3 Mar 2017 00:10:02 +0500 Subject: [PATCH 16/28] add lint-docs script to test & test-ci --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 2e6cda67cfe1..90ee002b96c5 100644 --- a/package.json +++ b/package.json @@ -51,7 +51,7 @@ "test-ci-partial": "yarn run build && yarn run jest -- -i && yarn run test-examples", "test-examples": "node scripts/test_examples.js", "test-pretty-format-perf": "node packages/pretty-format/perf/test.js", - "test": "yarn run typecheck && yarn run lint && yarn run build && yarn run jest && yarn run test-examples", + "test": "yarn run typecheck && yarn run lint && yarn run lint-docs && yarn run build && yarn run jest && yarn run test-examples", "typecheck": "flow check", "watch": "yarn run build; node ./scripts/watch.js" }, From 09b837ab897778587f8f2c894d672f6a8183ef00 Mon Sep 17 00:00:00 2001 From: Hannan Ali Date: Fri, 3 Mar 2017 00:45:48 +0500 Subject: [PATCH 17/28] turn off more rules to lint-docs in package.json --- examples/enzyme/yarn-error.log | 43 ++++++++++++++++++++++++++++++++++ package.json | 2 +- 2 files changed, 44 insertions(+), 1 deletion(-) create mode 100644 examples/enzyme/yarn-error.log diff --git a/examples/enzyme/yarn-error.log b/examples/enzyme/yarn-error.log new file mode 100644 index 000000000000..635dc24d7220 --- /dev/null +++ b/examples/enzyme/yarn-error.log @@ -0,0 +1,43 @@ +Arguments: + /home/hannan/.nvm/versions/node/v7.4.0/bin/node /home/hannan/.nvm/versions/node/v7.4.0/bin/yarn install --pure-lockfile + +PATH: + /home/hannan/Programming/jest/node_modules/.bin:/home/hannan/.config/yarn/link/node_modules/.bin:/home/hannan/Programming/jest/node_modules/.bin:/home/hannan/.config/yarn/link/node_modules/.bin:/home/hannan/.nvm/versions/node/v7.4.0/lib/node_modules/yarn/bin/node-gyp-bin:/home/hannan/Programming/jest/node_modules/.bin:/home/hannan/.config/yarn/link/node_modules/.bin:/home/hannan/Programming/jest/node_modules/.bin:/home/hannan/.config/yarn/link/node_modules/.bin:/home/hannan/.nvm/versions/node/v7.4.0/lib/node_modules/yarn/bin/node-gyp-bin:/home/hannan/.gvm/bin:/home/hannan/.nvm/versions/node/v7.4.0/bin:/home/hannan/bin:/home/hannan/.local/bin:/home/hannan/.gvm/bin:/home/hannan/bin:/home/hannan/.local/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin:/home/hannan/.rvm/bin:/snap/bin:/home/hannan/.rvm/bin:/home/hannan/.rvm/bin:/home/hannan/.rvm/bin + +Yarn version: + 0.20.3 + +Node version: + 7.4.0 + +Platform: + linux x64 + +npm manifest: + { + "dependencies": { + "react": "~15.3.1", + "react-dom": "~15.3.1" + }, + "devDependencies": { + "babel-jest": "*", + "babel-preset-es2015": "*", + "babel-preset-react": "*", + "enzyme": "~2.4.1", + "jest": "*", + "react-addons-test-utils": "15.3.2", + "regenerator-runtime": "*" + }, + "scripts": { + "test": "jest" + } + } + +yarn manifest: + No manifest + +Lockfile: + No lockfile + +Trace: + Error: ENOENT: no such file or directory, open '/home/hannan/.cache/yarn/npm-whatwg-fetch-2.0.3-9c84ec2dcf68187ff00bc64e1274b442176e1c84/.yarn-metadata.json' diff --git a/package.json b/package.json index 90ee002b96c5..fca61d57cb1d 100644 --- a/package.json +++ b/package.json @@ -44,7 +44,7 @@ "jest": "node ./packages/jest-cli/bin/jest.js", "jest-coverage": "yarn run jest -- --coverage", "lint": "eslint . --cache", - "lint-docs": "eslint --rule \"{'no-undef': 0}\" --no-ignore --ext md ./docs/*.md", + "lint-docs": "eslint --rule \"{'no-undef': 0, 'consistent-return': 0, 'no-unused-vars': 0}\" --no-ignore --ext md ./docs/*.md", "postinstall": "node ./scripts/postinstall.js && node ./scripts/build.js && (cd packages/eslint-plugin-jest && yarn link) && yarn link eslint-plugin-jest", "publish": "yarn run build-clean && yarn run build && lerna publish", "test-ci": "yarn run typecheck && yarn run lint && yarn run lint-docs && yarn run build && yarn run jest-coverage -- -i && yarn run test-examples && node scripts/mapCoverage.js && codecov", From a67a26f873e59f440fb6ad10f345fd28066fc080 Mon Sep 17 00:00:00 2001 From: Hannan Ali Date: Fri, 3 Mar 2017 00:47:47 +0500 Subject: [PATCH 18/28] remove lint-docs from test and test-ci --- package.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/package.json b/package.json index fca61d57cb1d..ff5c03460181 100644 --- a/package.json +++ b/package.json @@ -47,11 +47,11 @@ "lint-docs": "eslint --rule \"{'no-undef': 0, 'consistent-return': 0, 'no-unused-vars': 0}\" --no-ignore --ext md ./docs/*.md", "postinstall": "node ./scripts/postinstall.js && node ./scripts/build.js && (cd packages/eslint-plugin-jest && yarn link) && yarn link eslint-plugin-jest", "publish": "yarn run build-clean && yarn run build && lerna publish", - "test-ci": "yarn run typecheck && yarn run lint && yarn run lint-docs && yarn run build && yarn run jest-coverage -- -i && yarn run test-examples && node scripts/mapCoverage.js && codecov", + "test-ci": "yarn run typecheck && yarn run lint && yarn run build && yarn run jest-coverage -- -i && yarn run test-examples && node scripts/mapCoverage.js && codecov", "test-ci-partial": "yarn run build && yarn run jest -- -i && yarn run test-examples", "test-examples": "node scripts/test_examples.js", "test-pretty-format-perf": "node packages/pretty-format/perf/test.js", - "test": "yarn run typecheck && yarn run lint && yarn run lint-docs && yarn run build && yarn run jest && yarn run test-examples", + "test": "yarn run typecheck && yarn run lint && yarn run build && yarn run jest && yarn run test-examples", "typecheck": "flow check", "watch": "yarn run build; node ./scripts/watch.js" }, From 3e606869d0b8f55d6cab4f8855cb2cfef2f56319 Mon Sep 17 00:00:00 2001 From: Hannan Ali Date: Fri, 3 Mar 2017 00:50:19 +0500 Subject: [PATCH 19/28] add lint-docs to test script in package.json --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index ff5c03460181..4fe3b10ec1c5 100644 --- a/package.json +++ b/package.json @@ -51,7 +51,7 @@ "test-ci-partial": "yarn run build && yarn run jest -- -i && yarn run test-examples", "test-examples": "node scripts/test_examples.js", "test-pretty-format-perf": "node packages/pretty-format/perf/test.js", - "test": "yarn run typecheck && yarn run lint && yarn run build && yarn run jest && yarn run test-examples", + "test": "yarn run typecheck && yarn run lint && yarn run build && yarn run jest && yarn run test-examples && yarn run lint-docs", "typecheck": "flow check", "watch": "yarn run build; node ./scripts/watch.js" }, From c0ca1184098042f2ac1724952006c45f0657b940 Mon Sep 17 00:00:00 2001 From: Hannan Ali Date: Fri, 3 Mar 2017 00:50:34 +0500 Subject: [PATCH 20/28] remove lint-docs script from circle.yml --- circle.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/circle.yml b/circle.yml index b9d1c1f25466..d23724c66cd1 100644 --- a/circle.yml +++ b/circle.yml @@ -30,7 +30,6 @@ test: - yarn run test-ci-partial - nvm alias default 7 - yarn run test-ci-partial - - yarn run lint-docs - DANGER_GITHUB_API_TOKEN="ab0c4d396c935d3abce""fc213176da6bb7b2996ff" yarn run danger - cd website && yarn run test From 928e12244884e19b863a3586e00e3c53a810c78d Mon Sep 17 00:00:00 2001 From: Hannan Ali Date: Fri, 3 Mar 2017 01:07:05 +0500 Subject: [PATCH 21/28] add lint-docs script to test-ci in package.json --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 4fe3b10ec1c5..cc2b260d3fb2 100644 --- a/package.json +++ b/package.json @@ -47,7 +47,7 @@ "lint-docs": "eslint --rule \"{'no-undef': 0, 'consistent-return': 0, 'no-unused-vars': 0}\" --no-ignore --ext md ./docs/*.md", "postinstall": "node ./scripts/postinstall.js && node ./scripts/build.js && (cd packages/eslint-plugin-jest && yarn link) && yarn link eslint-plugin-jest", "publish": "yarn run build-clean && yarn run build && lerna publish", - "test-ci": "yarn run typecheck && yarn run lint && yarn run build && yarn run jest-coverage -- -i && yarn run test-examples && node scripts/mapCoverage.js && codecov", + "test-ci": "yarn run typecheck && yarn run lint && yarn run lint-docs && yarn run build && yarn run jest-coverage -- -i && yarn run test-examples && node scripts/mapCoverage.js && codecov", "test-ci-partial": "yarn run build && yarn run jest -- -i && yarn run test-examples", "test-examples": "node scripts/test_examples.js", "test-pretty-format-perf": "node packages/pretty-format/perf/test.js", From ed693f823de722e78e6195f85d831fca6f2aa7bb Mon Sep 17 00:00:00 2001 From: Hannan Ali Date: Fri, 3 Mar 2017 01:30:38 +0500 Subject: [PATCH 22/28] rename js codeblock with json appropriately --- README.md | 4 ++-- examples/async/yarn-error.log | 39 ++++++++++++++++++++++++++++++++++ examples/enzyme/yarn-error.log | 4 +++- 3 files changed, 44 insertions(+), 3 deletions(-) create mode 100644 examples/async/yarn-error.log diff --git a/README.md b/README.md index ec342c2f1f0c..e8188f4f2882 100644 --- a/README.md +++ b/README.md @@ -41,7 +41,7 @@ test('adds 1 + 2 to equal 3', () => { Add the following section to your `package.json`: -```js +```json "scripts": { "test": "jest" } @@ -84,7 +84,7 @@ npm install --save-dev babel-jest regenerator-runtime Don't forget to add a [`.babelrc`](https://babeljs.io/docs/usage/babelrc/) file in your project's root folder. For example, if you are using ES6 and [React.js](https://facebook.github.io/react/) with the [`babel-preset-es2015`](https://babeljs.io/docs/plugins/preset-es2015/) and [`babel-preset-react`](https://babeljs.io/docs/plugins/preset-react/) presets: -```js +```json { "presets": ["es2015", "react"] } diff --git a/examples/async/yarn-error.log b/examples/async/yarn-error.log new file mode 100644 index 000000000000..354a0888431a --- /dev/null +++ b/examples/async/yarn-error.log @@ -0,0 +1,39 @@ +Arguments: + /home/hannan/.nvm/versions/node/v7.4.0/bin/node /home/hannan/.nvm/versions/node/v7.4.0/bin/yarn install --pure-lockfile + +PATH: + /home/hannan/Programming/jest/node_modules/.bin:/home/hannan/.config/yarn/link/node_modules/.bin:/home/hannan/Programming/jest/node_modules/.bin:/home/hannan/.config/yarn/link/node_modules/.bin:/home/hannan/.nvm/versions/node/v7.4.0/lib/node_modules/yarn/bin/node-gyp-bin:/home/hannan/Programming/jest/node_modules/.bin:/home/hannan/.config/yarn/link/node_modules/.bin:/home/hannan/Programming/jest/node_modules/.bin:/home/hannan/.config/yarn/link/node_modules/.bin:/home/hannan/.nvm/versions/node/v7.4.0/lib/node_modules/yarn/bin/node-gyp-bin:/home/hannan/.gvm/bin:/home/hannan/.nvm/versions/node/v7.4.0/bin:/home/hannan/bin:/home/hannan/.local/bin:/home/hannan/.gvm/bin:/home/hannan/bin:/home/hannan/.local/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin:/home/hannan/.rvm/bin:/snap/bin:/home/hannan/.rvm/bin:/home/hannan/.rvm/bin:/home/hannan/.rvm/bin + +Yarn version: + 0.20.3 + +Node version: + 7.4.0 + +Platform: + linux x64 + +npm manifest: + { + "devDependencies": { + "babel-jest": "*", + "babel-plugin-transform-async-to-generator": "^6.5.0", + "babel-preset-es2015": "*", + "jest": "*", + "regenerator-runtime": "*" + }, + "scripts": { + "test": "jest" + } + } + +yarn manifest: + No manifest + +Lockfile: + No lockfile + +Trace: + Error: read ECONNRESET + at exports._errnoException (util.js:1022:11) + at TLSWrap.onread (net.js:572:26) diff --git a/examples/enzyme/yarn-error.log b/examples/enzyme/yarn-error.log index 635dc24d7220..26d8a01798c2 100644 --- a/examples/enzyme/yarn-error.log +++ b/examples/enzyme/yarn-error.log @@ -40,4 +40,6 @@ Lockfile: No lockfile Trace: - Error: ENOENT: no such file or directory, open '/home/hannan/.cache/yarn/npm-whatwg-fetch-2.0.3-9c84ec2dcf68187ff00bc64e1274b442176e1c84/.yarn-metadata.json' + Error: read ECONNRESET + at exports._errnoException (util.js:1022:11) + at TLSWrap.onread (net.js:572:26) From 51bf06297de5644518ddd58087867e85854795c2 Mon Sep 17 00:00:00 2001 From: Hannan Ali Date: Fri, 3 Mar 2017 01:34:21 +0500 Subject: [PATCH 23/28] remove unnecessary log files --- examples/enzyme/yarn-error.log | 45 ---------------------------------- 1 file changed, 45 deletions(-) delete mode 100644 examples/enzyme/yarn-error.log diff --git a/examples/enzyme/yarn-error.log b/examples/enzyme/yarn-error.log deleted file mode 100644 index 26d8a01798c2..000000000000 --- a/examples/enzyme/yarn-error.log +++ /dev/null @@ -1,45 +0,0 @@ -Arguments: - /home/hannan/.nvm/versions/node/v7.4.0/bin/node /home/hannan/.nvm/versions/node/v7.4.0/bin/yarn install --pure-lockfile - -PATH: - /home/hannan/Programming/jest/node_modules/.bin:/home/hannan/.config/yarn/link/node_modules/.bin:/home/hannan/Programming/jest/node_modules/.bin:/home/hannan/.config/yarn/link/node_modules/.bin:/home/hannan/.nvm/versions/node/v7.4.0/lib/node_modules/yarn/bin/node-gyp-bin:/home/hannan/Programming/jest/node_modules/.bin:/home/hannan/.config/yarn/link/node_modules/.bin:/home/hannan/Programming/jest/node_modules/.bin:/home/hannan/.config/yarn/link/node_modules/.bin:/home/hannan/.nvm/versions/node/v7.4.0/lib/node_modules/yarn/bin/node-gyp-bin:/home/hannan/.gvm/bin:/home/hannan/.nvm/versions/node/v7.4.0/bin:/home/hannan/bin:/home/hannan/.local/bin:/home/hannan/.gvm/bin:/home/hannan/bin:/home/hannan/.local/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin:/home/hannan/.rvm/bin:/snap/bin:/home/hannan/.rvm/bin:/home/hannan/.rvm/bin:/home/hannan/.rvm/bin - -Yarn version: - 0.20.3 - -Node version: - 7.4.0 - -Platform: - linux x64 - -npm manifest: - { - "dependencies": { - "react": "~15.3.1", - "react-dom": "~15.3.1" - }, - "devDependencies": { - "babel-jest": "*", - "babel-preset-es2015": "*", - "babel-preset-react": "*", - "enzyme": "~2.4.1", - "jest": "*", - "react-addons-test-utils": "15.3.2", - "regenerator-runtime": "*" - }, - "scripts": { - "test": "jest" - } - } - -yarn manifest: - No manifest - -Lockfile: - No lockfile - -Trace: - Error: read ECONNRESET - at exports._errnoException (util.js:1022:11) - at TLSWrap.onread (net.js:572:26) From f6f8aafae3d9f93d081bd05af3a0acb2eb489648 Mon Sep 17 00:00:00 2001 From: Hannan Ali Date: Fri, 3 Mar 2017 02:18:50 +0500 Subject: [PATCH 24/28] remove lint-docs from test-ci test script already includes lint-docs, it'll be reduntant to do the same for more than one node versions --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index cc2b260d3fb2..4fe3b10ec1c5 100644 --- a/package.json +++ b/package.json @@ -47,7 +47,7 @@ "lint-docs": "eslint --rule \"{'no-undef': 0, 'consistent-return': 0, 'no-unused-vars': 0}\" --no-ignore --ext md ./docs/*.md", "postinstall": "node ./scripts/postinstall.js && node ./scripts/build.js && (cd packages/eslint-plugin-jest && yarn link) && yarn link eslint-plugin-jest", "publish": "yarn run build-clean && yarn run build && lerna publish", - "test-ci": "yarn run typecheck && yarn run lint && yarn run lint-docs && yarn run build && yarn run jest-coverage -- -i && yarn run test-examples && node scripts/mapCoverage.js && codecov", + "test-ci": "yarn run typecheck && yarn run lint && yarn run build && yarn run jest-coverage -- -i && yarn run test-examples && node scripts/mapCoverage.js && codecov", "test-ci-partial": "yarn run build && yarn run jest -- -i && yarn run test-examples", "test-examples": "node scripts/test_examples.js", "test-pretty-format-perf": "node packages/pretty-format/perf/test.js", From 2af605a06033eb96d066f509b8d2ab11bf6e0ea1 Mon Sep 17 00:00:00 2001 From: Hannan Ali Date: Fri, 3 Mar 2017 02:49:57 +0500 Subject: [PATCH 25/28] remove error.log file --- examples/async/yarn-error.log | 39 ----------------------------------- 1 file changed, 39 deletions(-) delete mode 100644 examples/async/yarn-error.log diff --git a/examples/async/yarn-error.log b/examples/async/yarn-error.log deleted file mode 100644 index 354a0888431a..000000000000 --- a/examples/async/yarn-error.log +++ /dev/null @@ -1,39 +0,0 @@ -Arguments: - /home/hannan/.nvm/versions/node/v7.4.0/bin/node /home/hannan/.nvm/versions/node/v7.4.0/bin/yarn install --pure-lockfile - -PATH: - /home/hannan/Programming/jest/node_modules/.bin:/home/hannan/.config/yarn/link/node_modules/.bin:/home/hannan/Programming/jest/node_modules/.bin:/home/hannan/.config/yarn/link/node_modules/.bin:/home/hannan/.nvm/versions/node/v7.4.0/lib/node_modules/yarn/bin/node-gyp-bin:/home/hannan/Programming/jest/node_modules/.bin:/home/hannan/.config/yarn/link/node_modules/.bin:/home/hannan/Programming/jest/node_modules/.bin:/home/hannan/.config/yarn/link/node_modules/.bin:/home/hannan/.nvm/versions/node/v7.4.0/lib/node_modules/yarn/bin/node-gyp-bin:/home/hannan/.gvm/bin:/home/hannan/.nvm/versions/node/v7.4.0/bin:/home/hannan/bin:/home/hannan/.local/bin:/home/hannan/.gvm/bin:/home/hannan/bin:/home/hannan/.local/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin:/home/hannan/.rvm/bin:/snap/bin:/home/hannan/.rvm/bin:/home/hannan/.rvm/bin:/home/hannan/.rvm/bin - -Yarn version: - 0.20.3 - -Node version: - 7.4.0 - -Platform: - linux x64 - -npm manifest: - { - "devDependencies": { - "babel-jest": "*", - "babel-plugin-transform-async-to-generator": "^6.5.0", - "babel-preset-es2015": "*", - "jest": "*", - "regenerator-runtime": "*" - }, - "scripts": { - "test": "jest" - } - } - -yarn manifest: - No manifest - -Lockfile: - No lockfile - -Trace: - Error: read ECONNRESET - at exports._errnoException (util.js:1022:11) - at TLSWrap.onread (net.js:572:26) From 8d83aff829485d36f3c20060f6e7319a154b759b Mon Sep 17 00:00:00 2001 From: Hannan Ali Date: Fri, 3 Mar 2017 18:37:20 +0500 Subject: [PATCH 26/28] use eslintrc-docs.json for overriding --- .eslintrc-docs.json | 11 +++++++++++ package.json | 2 +- 2 files changed, 12 insertions(+), 1 deletion(-) create mode 100644 .eslintrc-docs.json diff --git a/.eslintrc-docs.json b/.eslintrc-docs.json new file mode 100644 index 000000000000..7559902ff681 --- /dev/null +++ b/.eslintrc-docs.json @@ -0,0 +1,11 @@ +{ + "rules": { + "react/react-in-jsx-scope": 0, + "react/jsx-no-undef": 0, + "jest/no-focused-tests": 0, + "no-undef": 0, + "no-unused-vars": 0, + "consistent-return": 0 + }, + "description": ".eslintrc-docs.json overrides the rules specified in .eslintrc, to make it more suitable for running on code examples in docs/ folder" +} \ No newline at end of file diff --git a/package.json b/package.json index 4fe3b10ec1c5..11ae2a7e018b 100644 --- a/package.json +++ b/package.json @@ -44,7 +44,7 @@ "jest": "node ./packages/jest-cli/bin/jest.js", "jest-coverage": "yarn run jest -- --coverage", "lint": "eslint . --cache", - "lint-docs": "eslint --rule \"{'no-undef': 0, 'consistent-return': 0, 'no-unused-vars': 0}\" --no-ignore --ext md ./docs/*.md", + "lint-docs": "eslint --config ./.eslintrc-docs.json --no-ignore --ext md ./docs/*.md", "postinstall": "node ./scripts/postinstall.js && node ./scripts/build.js && (cd packages/eslint-plugin-jest && yarn link) && yarn link eslint-plugin-jest", "publish": "yarn run build-clean && yarn run build && lerna publish", "test-ci": "yarn run typecheck && yarn run lint && yarn run build && yarn run jest-coverage -- -i && yarn run test-examples && node scripts/mapCoverage.js && codecov", From 4b2a07215938cffd84eb89cb2fd874553e0f9d9f Mon Sep 17 00:00:00 2001 From: Hannan Ali Date: Fri, 3 Mar 2017 18:37:58 +0500 Subject: [PATCH 27/28] remove eslint comments from docs Removing eslint comments from docs and moving them to top level in .eslintrc-docs.json --- docs/GlobalAPI.md | 4 ---- docs/SetupAndTeardown.md | 2 -- docs/SnapshotTesting.md | 4 +--- 3 files changed, 1 insertion(+), 9 deletions(-) diff --git a/docs/GlobalAPI.md b/docs/GlobalAPI.md index 22e26e5ae92e..8e27b4584190 100644 --- a/docs/GlobalAPI.md +++ b/docs/GlobalAPI.md @@ -195,8 +195,6 @@ Also under the alias: `fdescribe(name, fn)` You can use `describe.only` if you want to run only one describe block: ```js - -/* eslint jest/no-focused-tests: "off" */ describe.only('my beverage', () => { test('is delicious', () => { expect(myBeverage.delicious).toBeTruthy(); @@ -283,8 +281,6 @@ When you are debugging a large codebase, you will often only want to run a subse For example, let's say you had these tests: ```js -/* eslint jest/no-focused-tests: "off" */ - test.only('it is raining', () => { expect(inchesOfRain()).toBeGreaterThan(0); }); diff --git a/docs/SetupAndTeardown.md b/docs/SetupAndTeardown.md index 5dec7751c828..f31cfa4ee461 100644 --- a/docs/SetupAndTeardown.md +++ b/docs/SetupAndTeardown.md @@ -107,8 +107,6 @@ describe('matching cities to foods', () => { If a test is failing, one of the first things to check should be whether the test is failing when it's the only test that runs. In Jest it's simple to run only one test - just temporarily change that `test` command to a `test.only`: ```js -/* eslint jest/no-focused-tests: "off" */ - test.only('this will be the only test that runs', () => { expect(true).toBe(false); }); diff --git a/docs/SnapshotTesting.md b/docs/SnapshotTesting.md index a6c60b4c9a95..505d25cda73d 100644 --- a/docs/SnapshotTesting.md +++ b/docs/SnapshotTesting.md @@ -54,9 +54,7 @@ One such situation can arise if we intentionally change the address the Link com ```javascript // Updated test case with a Link to a different address -it('renders correctly', () => { - /* eslint react/react-in-jsx-scope: "off", react/jsx-no-undef: "off" */ - +it('renders correctly', () => { const tree = renderer.create( Instagram ).toJSON(); From 42406ccb59acef3d81d3269e989fb0b14d0092da Mon Sep 17 00:00:00 2001 From: Hannan Ali Date: Fri, 3 Mar 2017 18:41:19 +0500 Subject: [PATCH 28/28] add lint-docs in correct order to test-ci and test --- package.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/package.json b/package.json index 11ae2a7e018b..914fd2c0dd31 100644 --- a/package.json +++ b/package.json @@ -47,11 +47,11 @@ "lint-docs": "eslint --config ./.eslintrc-docs.json --no-ignore --ext md ./docs/*.md", "postinstall": "node ./scripts/postinstall.js && node ./scripts/build.js && (cd packages/eslint-plugin-jest && yarn link) && yarn link eslint-plugin-jest", "publish": "yarn run build-clean && yarn run build && lerna publish", - "test-ci": "yarn run typecheck && yarn run lint && yarn run build && yarn run jest-coverage -- -i && yarn run test-examples && node scripts/mapCoverage.js && codecov", + "test-ci": "yarn run typecheck && yarn run lint && yarn run lint-docs && yarn run build && yarn run jest-coverage -- -i && yarn run test-examples && node scripts/mapCoverage.js && codecov", "test-ci-partial": "yarn run build && yarn run jest -- -i && yarn run test-examples", "test-examples": "node scripts/test_examples.js", "test-pretty-format-perf": "node packages/pretty-format/perf/test.js", - "test": "yarn run typecheck && yarn run lint && yarn run build && yarn run jest && yarn run test-examples && yarn run lint-docs", + "test": "yarn run typecheck && yarn run lint && yarn run lint-docs && yarn run build && yarn run jest && yarn run test-examples", "typecheck": "flow check", "watch": "yarn run build; node ./scripts/watch.js" },