@samitouri / QOS-React-2 / commits / 5fa99b5aa6

chore: add eslint-plugin-jest's valid-expect rule (#16332)

* chore: add eslint-plugin-jest's valid-expect rule * update assertion

Simen Bekkhus committed Aug 14, 2019 at 12:51 UTC 5fa99b5aa665073f8c81e2cfec6b49e0b0b1aff0
4 files changed +46 -7
.eslintrc.js
+2
@@ -129,6 +129,8 @@ module.exports = {
129 rules: {
130 // https://github.com/jest-community/eslint-plugin-jest
131 'jest/no-focused-tests': ERROR,
132 + 'jest/valid-expect': ERROR,
133 + 'jest/valid-expect-in-promise': ERROR,
134 },
135 },
136 {
package.json
+1 -1
@@ -48,7 +48,7 @@
48 "eslint": "^6.1.0",
49 "eslint-config-fbjs": "^1.1.1",
50 "eslint-plugin-flowtype": "^2.25.0",
51 - "eslint-plugin-jest": "^21.6.1",
51 + "eslint-plugin-jest": "^22.15.0",
52 "eslint-plugin-no-for-of-loops": "^1.0.0",
53 "eslint-plugin-babel": "^5.3.0",
54 "eslint-plugin-react": "^6.7.1",
packages/react-dom/src/__tests__/ReactDOMComponent-test.js
+1 -1
@@ -1040,7 +1040,7 @@ describe('ReactDOMComponent', () => {
1040 if (typeof value !== 'undefined') {
1041 re += quoteRegexp(value) + '[\\\'"]';
1042 }
1043 - expect(new RegExp(re).test(actual)).toBe(true);
1043 + expect(actual).toMatch(new RegExp(re));
1044 }
1045
1046 function genMarkup(props) {
yarn.lock
+42 -5
@@ -571,11 +571,33 @@
571 dependencies:
572 "@types/whatwg-streams" "^0.0.6"
573
574 +"@types/json-schema@^7.0.3":
575 + version "7.0.3"
576 + resolved "https://registry.yarnpkg.com/@types/json-schema/-/json-schema-7.0.3.tgz#bdfd69d61e464dcc81b25159c270d75a73c1a636"
577 + integrity sha512-Il2DtDVRGDcqjDtE+rF8iqg1CArehSK84HZJCT7AMITlyXRBpuPhqGLDQMowraqqu1coEaimg4ZOqggt6L6L+A==
578 +
579 "@types/whatwg-streams@^0.0.6":
580 version "0.0.6"
581 resolved "https://registry.yarnpkg.com/@types/whatwg-streams/-/whatwg-streams-0.0.6.tgz#5062c67efb695c886fe3dbb9618df35aac418503"
582 integrity sha512-O4Hat94N1RUCObqAbVUtd6EcucseqBcpfbFXzy12CYF6BQVHWR+ztDA3YPjewCmdKHYZ5VA7TZ5hq2bMyqxiBw==
583
584 +"@typescript-eslint/experimental-utils@^1.13.0":
585 + version "1.13.0"
586 + resolved "https://registry.yarnpkg.com/@typescript-eslint/experimental-utils/-/experimental-utils-1.13.0.tgz#b08c60d780c0067de2fb44b04b432f540138301e"
587 + integrity sha512-zmpS6SyqG4ZF64ffaJ6uah6tWWWgZ8m+c54XXgwFtUv0jNz8aJAVx8chMCvnk7yl6xwn8d+d96+tWp7fXzTuDg==
588 + dependencies:
589 + "@types/json-schema" "^7.0.3"
590 + "@typescript-eslint/typescript-estree" "1.13.0"
591 + eslint-scope "^4.0.0"
592 +
593 +"@typescript-eslint/typescript-estree@1.13.0":
594 + version "1.13.0"
595 + resolved "https://registry.yarnpkg.com/@typescript-eslint/typescript-estree/-/typescript-estree-1.13.0.tgz#8140f17d0f60c03619798f1d628b8434913dc32e"
596 + integrity sha512-b5rCmd2e6DCC6tCTN9GSUAuxdYwCM/k/2wdjHGrIRGPSJotWMCe/dGpi66u42bhuh8q3QBzqM4TMA1GUUCJvdw==
597 + dependencies:
598 + lodash.unescape "4.0.1"
599 + semver "5.5.0"
600 +
601 abab@^1.0.4:
602 version "1.0.4"
603 resolved "https://registry.yarnpkg.com/abab/-/abab-1.0.4.tgz#5faad9c2c07f60dd76770f71cf025b62a63cfd4e"
@@ -2104,10 +2126,12 @@ eslint-plugin-flowtype@^2.25.0:
2126 dependencies:
2127 lodash "^4.17.10"
2128
2107 -eslint-plugin-jest@^21.6.1:
2108 - version "21.27.2"
2109 - resolved "https://registry.yarnpkg.com/eslint-plugin-jest/-/eslint-plugin-jest-21.27.2.tgz#2a795b7c3b5e707df48a953d651042bd01d7b0a8"
2110 - integrity sha512-0E4OIgBJVlAmf1KfYFtZ3gYxgUzC5Eb3Jzmrc9ikI1OY+/cM8Kh72Ti7KfpeHNeD3HJNf9SmEfmvQLIz44Hrhw==
2129 +eslint-plugin-jest@^22.15.0:
2130 + version "22.15.0"
2131 + resolved "https://registry.yarnpkg.com/eslint-plugin-jest/-/eslint-plugin-jest-22.15.0.tgz#fe70bfff7eeb47ca0ab229588a867f82bb8592c5"
2132 + integrity sha512-hgnPbSqAIcLLS9ePb12hNHTRkXnkVaCfOwCt2pzQ8KpOKPWGA4HhLMaFN38NBa/0uvLfrZpcIRjT+6tMAfr58Q==
2133 + dependencies:
2134 + "@typescript-eslint/experimental-utils" "^1.13.0"
2135
2136 eslint-plugin-no-for-of-loops@^1.0.0:
2137 version "1.0.1"
@@ -2141,6 +2165,14 @@ eslint-scope@3.7.1:
2165 esrecurse "^4.1.0"
2166 estraverse "^4.1.1"
2167
2168 +eslint-scope@^4.0.0:
2169 + version "4.0.3"
2170 + resolved "https://registry.yarnpkg.com/eslint-scope/-/eslint-scope-4.0.3.tgz#ca03833310f6889a3264781aa82e63eb9cfe7848"
2171 + integrity sha512-p7VutNr1O/QrxysMo3E45FjYDTeXBy0iTltPFNSqKAIfjDSXC+4dj+qfyuD8bfAXrW/y6lW3O76VaYNPKfpKrg==
2172 + dependencies:
2173 + esrecurse "^4.1.0"
2174 + estraverse "^4.1.1"
2175 +
2176 eslint-scope@^5.0.0:
2177 version "5.0.0"
2178 resolved "https://registry.yarnpkg.com/eslint-scope/-/eslint-scope-5.0.0.tgz#e87c8887c73e8d1ec84f1ca591645c358bfc8fb9"
@@ -3939,6 +3971,11 @@ lodash.sortby@^4.7.0:
3971 version "4.7.0"
3972 resolved "https://registry.yarnpkg.com/lodash.sortby/-/lodash.sortby-4.7.0.tgz#edd14c824e2cc9c1e0b0a1b42bb5210516a42438"
3973
3974 +lodash.unescape@4.0.1:
3975 + version "4.0.1"
3976 + resolved "https://registry.yarnpkg.com/lodash.unescape/-/lodash.unescape-4.0.1.tgz#bf2249886ce514cda112fae9218cdc065211fc9c"
3977 + integrity sha1-vyJJiGzlFM2hEvrpIYzcBlIR/Jw=
3978 +
3979 lodash@^4.13.1, lodash@^4.17.10, lodash@^4.17.4, lodash@^4.2.0:
3980 version "4.17.10"
3981 resolved "https://registry.yarnpkg.com/lodash/-/lodash-4.17.10.tgz#1b7793cf7259ea38fb3661d4d38b3260af8ae4e7"
@@ -5106,7 +5143,7 @@ scheduler@^0.11.0:
5143 loose-envify "^1.1.0"
5144 object-assign "^4.1.1"
5145
5109 -"semver@2 || 3 || 4 || 5", semver@^5.1.0, semver@^5.3.0, semver@^5.4.1, semver@^5.5.0:
5146 +"semver@2 || 3 || 4 || 5", semver@5.5.0, semver@^5.1.0, semver@^5.3.0, semver@^5.4.1, semver@^5.5.0:
5147 version "5.5.0"
5148 resolved "https://registry.yarnpkg.com/semver/-/semver-5.5.0.tgz#dc4bbc7a6ca9d916dee5d43516f0092b58f7b8ab"
5149