Bug 1620162 - Upgrade eslint-plugin-jest and fix new lint errors. r=bomsy,Standard8

Currently the `jest/no-standalone-expect` rule needs to be disabled for `jest-in-case` cases blocks as it is not compatible.

Differential Revision: https://phabricator.services.mozilla.com/D87184
This commit is contained in:
Duncan Dean 2020-08-20 08:52:42 +00:00
parent 98009bde06
commit d99484e5ff
6 changed files with 52 additions and 44 deletions

View File

@ -96,6 +96,10 @@ module.exports = {
"flowtype/define-flow-type": 1,
"flowtype/use-flow-type": 1,
// Incompatible with jest-in-case cases. See related GitHub issue
// https://github.com/jest-community/eslint-plugin-jest/issues/534
"jest/no-standalone-expect": "off",
// Disallow flow control that escapes from "finally".
"no-unsafe-finally": "error",

View File

@ -89,7 +89,10 @@ describe("Event - mouse event", () => {
const renderRep = props => shallow(Event.rep({ object, ...props }));
const grips = getSelectableInInspectorGrips(object);
expect(grips).toHaveLength(1, "the stub has one node grip");
it("has stub with one node grip", () => {
expect(grips).toHaveLength(1);
});
it("correctly selects Event Rep", () => {
expect(getRep(object)).toBe(Event.rep);

View File

@ -37,11 +37,9 @@ describe("network request", () => {
text: async () => "Sad",
}));
try {
await networkRequest("foo");
} catch (e) {
expect(e.message).toEqual("failed to request foo");
}
await expect(networkRequest("foo")).rejects.toThrow(
expect.objectContaining({ message: "failed to request foo" })
);
});
it("timed out fetch", async () => {

73
package-lock.json generated
View File

@ -170,42 +170,36 @@
"dev": true
},
"@typescript-eslint/experimental-utils": {
"version": "1.13.0",
"resolved": "https://registry.npmjs.org/@typescript-eslint/experimental-utils/-/experimental-utils-1.13.0.tgz",
"integrity": "sha512-zmpS6SyqG4ZF64ffaJ6uah6tWWWgZ8m+c54XXgwFtUv0jNz8aJAVx8chMCvnk7yl6xwn8d+d96+tWp7fXzTuDg==",
"version": "2.34.0",
"resolved": "https://registry.npmjs.org/@typescript-eslint/experimental-utils/-/experimental-utils-2.34.0.tgz",
"integrity": "sha512-eS6FTkq+wuMJ+sgtuNTtcqavWXqsflWcfBnlYhg/nS4aZ1leewkXGbvBhaapn1q6qf4M71bsR1tez5JTRMuqwA==",
"dev": true,
"requires": {
"@types/json-schema": "^7.0.3",
"@typescript-eslint/typescript-estree": "1.13.0",
"eslint-scope": "^4.0.0"
},
"dependencies": {
"eslint-scope": {
"version": "4.0.3",
"resolved": "https://registry.npmjs.org/eslint-scope/-/eslint-scope-4.0.3.tgz",
"integrity": "sha512-p7VutNr1O/QrxysMo3E45FjYDTeXBy0iTltPFNSqKAIfjDSXC+4dj+qfyuD8bfAXrW/y6lW3O76VaYNPKfpKrg==",
"dev": true,
"requires": {
"esrecurse": "^4.1.0",
"estraverse": "^4.1.1"
}
}
"@typescript-eslint/typescript-estree": "2.34.0",
"eslint-scope": "^5.0.0",
"eslint-utils": "^2.0.0"
}
},
"@typescript-eslint/typescript-estree": {
"version": "1.13.0",
"resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-1.13.0.tgz",
"integrity": "sha512-b5rCmd2e6DCC6tCTN9GSUAuxdYwCM/k/2wdjHGrIRGPSJotWMCe/dGpi66u42bhuh8q3QBzqM4TMA1GUUCJvdw==",
"version": "2.34.0",
"resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-2.34.0.tgz",
"integrity": "sha512-OMAr+nJWKdlVM9LOqCqh3pQQPwxHAN7Du8DR6dmwCrAmxtiXQnhHJ6tBNtf+cggqfo51SG/FCwnKhXCIM7hnVg==",
"dev": true,
"requires": {
"lodash.unescape": "4.0.1",
"semver": "5.5.0"
"debug": "^4.1.1",
"eslint-visitor-keys": "^1.1.0",
"glob": "^7.1.6",
"is-glob": "^4.0.1",
"lodash": "^4.17.15",
"semver": "^7.3.2",
"tsutils": "^3.17.1"
},
"dependencies": {
"semver": {
"version": "5.5.0",
"resolved": "https://registry.npmjs.org/semver/-/semver-5.5.0.tgz",
"integrity": "sha512-4SJ3dm0WAwWy/NVeioZh5AntkdJoWKxHxcmyP622fOkgHa4z3R0TdBJICINyaSDE6uNwVc8gZr+ZinwZAH4xIA==",
"version": "7.3.2",
"resolved": "https://registry.npmjs.org/semver/-/semver-7.3.2.tgz",
"integrity": "sha512-OrOb32TeeambH6UrhtShmF7CRDqhL6/5XpPNp2DuRH6+9QLw/orhp72j87v8Qa1ScDkvrrBNpZcDejAirJmfXQ==",
"dev": true
}
}
@ -828,12 +822,12 @@
}
},
"eslint-plugin-jest": {
"version": "22.21.0",
"resolved": "https://registry.npmjs.org/eslint-plugin-jest/-/eslint-plugin-jest-22.21.0.tgz",
"integrity": "sha512-OaqnSS7uBgcGiqXUiEnjoqxPNKvR4JWG5mSRkzVoR6+vDwlqqp11beeql1hYs0HTbdhiwrxWLxbX0Vx7roG3Ew==",
"version": "23.20.0",
"resolved": "https://registry.npmjs.org/eslint-plugin-jest/-/eslint-plugin-jest-23.20.0.tgz",
"integrity": "sha512-+6BGQt85OREevBDWCvhqj1yYA4+BFK4XnRZSGJionuEYmcglMZYLNNBBemwzbqUAckURaHdJSBcjHPyrtypZOw==",
"dev": true,
"requires": {
"@typescript-eslint/experimental-utils": "^1.13.0"
"@typescript-eslint/experimental-utils": "^2.5.0"
}
},
"eslint-plugin-jsx-a11y": {
@ -1381,12 +1375,6 @@
"integrity": "sha512-JNvd8XER9GQX0v2qJgsaN/mzFCNA5BRe/j8JN9d+tWyGLSodKQHKFicdwNYzWwI3wjRnaKPsGj1XkBjx/F96DQ==",
"dev": true
},
"lodash.unescape": {
"version": "4.0.1",
"resolved": "https://registry.npmjs.org/lodash.unescape/-/lodash.unescape-4.0.1.tgz",
"integrity": "sha1-vyJJiGzlFM2hEvrpIYzcBlIR/Jw=",
"dev": true
},
"loose-envify": {
"version": "1.4.0",
"resolved": "https://registry.npmjs.org/loose-envify/-/loose-envify-1.4.0.tgz",
@ -1990,6 +1978,21 @@
"integrity": "sha1-3F5pjL0HkmW8c+A3doGk5Og/YW4=",
"dev": true
},
"tslib": {
"version": "1.13.0",
"resolved": "https://registry.npmjs.org/tslib/-/tslib-1.13.0.tgz",
"integrity": "sha512-i/6DQjL8Xf3be4K/E6Wgpekn5Qasl1usyw++dAA35Ue5orEn65VIxOA+YvNNl9HV3qv70T7CNwjODHZrLwvd1Q==",
"dev": true
},
"tsutils": {
"version": "3.17.1",
"resolved": "https://registry.npmjs.org/tsutils/-/tsutils-3.17.1.tgz",
"integrity": "sha512-kzeQ5B8H3w60nFY2g8cJIuH7JDpsALXySGtwGJ0p2LSjLgay3NdIpqq5SoOBe46bKDW2iq25irHCr8wjomUS2g==",
"dev": true,
"requires": {
"tslib": "^1.8.1"
}
},
"type-check": {
"version": "0.4.0",
"resolved": "https://registry.npmjs.org/type-check/-/type-check-0.4.0.tgz",

View File

@ -15,7 +15,7 @@
"eslint-plugin-flowtype": "4.6.0",
"eslint-plugin-html": "6.0.0",
"eslint-plugin-import": "2.20.1",
"eslint-plugin-jest": "22.21.0",
"eslint-plugin-jest": "23.20.0",
"eslint-plugin-jsx-a11y": "6.2.3",
"eslint-plugin-mozilla": "file:tools/lint/eslint/eslint-plugin-mozilla",
"eslint-plugin-no-unsanitized": "3.0.2",

View File

@ -4,7 +4,7 @@
"visibility": "public",
"filename": "eslint.tar.gz",
"unpack": true,
"digest": "4f85e360e26005c749cffbf1ce1eb42365a2d91ba0414e40031c4c73c7a24ae5517283c0146bbfb9919cbdcc950234164e1aec992143d13c8005970ff8d89f72",
"size": 8791199
"digest": "bfc97a84919e224c4b76a59bb1fe6b41c3466999b51070e2ec29f1dbb5ba3012139421ac199636c6dc43665c218472e1ba97c939af42746bef7f2c2571d87eb0",
"size": 8841756
}
]