From 06d4290cf11c9ada663122bdf99874664260c876 Mon Sep 17 00:00:00 2001 From: Baptiste Mathus Date: Tue, 16 Oct 2018 23:51:58 +0200 Subject: [PATCH] Add and enable eslint-plugin-jest ESLint rules for Jest. Stumbled into it from https://github.com/facebook/jest/issues/6633#issuecomment-402929281 --- distribution/client/.eslintrc.json | 6 ++++- distribution/client/package-lock.json | 34 +++++++++++++++++++++------ distribution/client/package.json | 3 ++- services/.eslintrc.json | 6 ++++- services/package-lock.json | 34 +++++++++++++++++++++------ services/package.json | 3 ++- 6 files changed, 68 insertions(+), 18 deletions(-) diff --git a/distribution/client/.eslintrc.json b/distribution/client/.eslintrc.json index 398c738c..ae9576b9 100644 --- a/distribution/client/.eslintrc.json +++ b/distribution/client/.eslintrc.json @@ -7,7 +7,11 @@ "parserOptions": { "ecmaVersion": 2017 }, - "extends": "eslint:recommended", + "extends": [ + "eslint:recommended", + "plugin:jest/recommended" + ], + "plugins": ["jest"], "rules": { "indent": [ "error", diff --git a/distribution/client/package-lock.json b/distribution/client/package-lock.json index 91ac1677..1c7340a0 100644 --- a/distribution/client/package-lock.json +++ b/distribution/client/package-lock.json @@ -3100,6 +3100,12 @@ } } }, + "eslint-plugin-jest": { + "version": "21.25.1", + "resolved": "https://registry.npmjs.org/eslint-plugin-jest/-/eslint-plugin-jest-21.25.1.tgz", + "integrity": "sha512-mmphmAD/WihjFGq1IUHLSZWQPcd8U9w/SeFCHf3p0V3Q3MBxmj1ZKnh41hID44guIACLuwos/LhVWIr4phN4yg==", + "dev": true + }, "eslint-scope": { "version": "3.7.3", "resolved": "https://registry.npmjs.org/eslint-scope/-/eslint-scope-3.7.3.tgz", @@ -3733,12 +3739,14 @@ "balanced-match": { "version": "1.0.0", "bundled": true, - "dev": true + "dev": true, + "optional": true }, "brace-expansion": { "version": "1.1.11", "bundled": true, "dev": true, + "optional": true, "requires": { "balanced-match": "^1.0.0", "concat-map": "0.0.1" @@ -3753,17 +3761,20 @@ "code-point-at": { "version": "1.1.0", "bundled": true, - "dev": true + "dev": true, + "optional": true }, "concat-map": { "version": "0.0.1", "bundled": true, - "dev": true + "dev": true, + "optional": true }, "console-control-strings": { "version": "1.1.0", "bundled": true, - "dev": true + "dev": true, + "optional": true }, "core-util-is": { "version": "1.0.2", @@ -3880,7 +3891,8 @@ "inherits": { "version": "2.0.3", "bundled": true, - "dev": true + "dev": true, + "optional": true }, "ini": { "version": "1.3.5", @@ -3892,6 +3904,7 @@ "version": "1.0.0", "bundled": true, "dev": true, + "optional": true, "requires": { "number-is-nan": "^1.0.0" } @@ -3906,6 +3919,7 @@ "version": "3.0.4", "bundled": true, "dev": true, + "optional": true, "requires": { "brace-expansion": "^1.1.7" } @@ -3913,12 +3927,14 @@ "minimist": { "version": "0.0.8", "bundled": true, - "dev": true + "dev": true, + "optional": true }, "minipass": { "version": "2.2.4", "bundled": true, "dev": true, + "optional": true, "requires": { "safe-buffer": "^5.1.1", "yallist": "^3.0.0" @@ -3937,6 +3953,7 @@ "version": "0.5.1", "bundled": true, "dev": true, + "optional": true, "requires": { "minimist": "0.0.8" } @@ -4017,7 +4034,8 @@ "number-is-nan": { "version": "1.0.1", "bundled": true, - "dev": true + "dev": true, + "optional": true }, "object-assign": { "version": "4.1.1", @@ -4029,6 +4047,7 @@ "version": "1.4.0", "bundled": true, "dev": true, + "optional": true, "requires": { "wrappy": "1" } @@ -4150,6 +4169,7 @@ "version": "1.0.2", "bundled": true, "dev": true, + "optional": true, "requires": { "code-point-at": "^1.0.0", "is-fullwidth-code-point": "^1.0.0", diff --git a/distribution/client/package.json b/distribution/client/package.json index b702c1b3..5e53a0a9 100644 --- a/distribution/client/package.json +++ b/distribution/client/package.json @@ -29,7 +29,8 @@ "ts-jest": "^23.10.3", "typescript": "^3.1.1", "webpack": "^4.17.1", - "webpack-cli": "^3.1.0" + "webpack-cli": "^3.1.0", + "eslint-plugin-jest": "^21.25.1" }, "dependencies": { "@feathersjs/authentication-client": "^1.0.4", diff --git a/services/.eslintrc.json b/services/.eslintrc.json index 398c738c..ae9576b9 100644 --- a/services/.eslintrc.json +++ b/services/.eslintrc.json @@ -7,7 +7,11 @@ "parserOptions": { "ecmaVersion": 2017 }, - "extends": "eslint:recommended", + "extends": [ + "eslint:recommended", + "plugin:jest/recommended" + ], + "plugins": ["jest"], "rules": { "indent": [ "error", diff --git a/services/package-lock.json b/services/package-lock.json index d6341dd3..67bf5f96 100644 --- a/services/package-lock.json +++ b/services/package-lock.json @@ -3716,6 +3716,12 @@ } } }, + "eslint-plugin-jest": { + "version": "21.25.1", + "resolved": "https://registry.npmjs.org/eslint-plugin-jest/-/eslint-plugin-jest-21.25.1.tgz", + "integrity": "sha512-mmphmAD/WihjFGq1IUHLSZWQPcd8U9w/SeFCHf3p0V3Q3MBxmj1ZKnh41hID44guIACLuwos/LhVWIr4phN4yg==", + "dev": true + }, "eslint-scope": { "version": "3.7.3", "resolved": "https://registry.npmjs.org/eslint-scope/-/eslint-scope-3.7.3.tgz", @@ -4752,11 +4758,13 @@ }, "balanced-match": { "version": "1.0.0", - "bundled": true + "bundled": true, + "optional": true }, "brace-expansion": { "version": "1.1.11", "bundled": true, + "optional": true, "requires": { "balanced-match": "^1.0.0", "concat-map": "0.0.1" @@ -4769,15 +4777,18 @@ }, "code-point-at": { "version": "1.1.0", - "bundled": true + "bundled": true, + "optional": true }, "concat-map": { "version": "0.0.1", - "bundled": true + "bundled": true, + "optional": true }, "console-control-strings": { "version": "1.1.0", - "bundled": true + "bundled": true, + "optional": true }, "core-util-is": { "version": "1.0.2", @@ -4880,7 +4891,8 @@ }, "inherits": { "version": "2.0.3", - "bundled": true + "bundled": true, + "optional": true }, "ini": { "version": "1.3.5", @@ -4890,6 +4902,7 @@ "is-fullwidth-code-point": { "version": "1.0.0", "bundled": true, + "optional": true, "requires": { "number-is-nan": "^1.0.0" } @@ -4902,17 +4915,20 @@ "minimatch": { "version": "3.0.4", "bundled": true, + "optional": true, "requires": { "brace-expansion": "^1.1.7" } }, "minimist": { "version": "0.0.8", - "bundled": true + "bundled": true, + "optional": true }, "minipass": { "version": "2.2.4", "bundled": true, + "optional": true, "requires": { "safe-buffer": "^5.1.1", "yallist": "^3.0.0" @@ -4929,6 +4945,7 @@ "mkdirp": { "version": "0.5.1", "bundled": true, + "optional": true, "requires": { "minimist": "0.0.8" } @@ -5001,7 +5018,8 @@ }, "number-is-nan": { "version": "1.0.1", - "bundled": true + "bundled": true, + "optional": true }, "object-assign": { "version": "4.1.1", @@ -5011,6 +5029,7 @@ "once": { "version": "1.4.0", "bundled": true, + "optional": true, "requires": { "wrappy": "1" } @@ -5116,6 +5135,7 @@ "string-width": { "version": "1.0.2", "bundled": true, + "optional": true, "requires": { "code-point-at": "^1.0.0", "is-fullwidth-code-point": "^1.0.0", diff --git a/services/package.json b/services/package.json index 5bb5f6b4..fb91950a 100644 --- a/services/package.json +++ b/services/package.json @@ -68,7 +68,8 @@ "request": "^2.88.0", "request-promise": "^4.2.2", "socket.io-client": "^2.1.1", - "yargs": "^12.0.1" + "yargs": "^12.0.1", + "eslint-plugin-jest": "^21.25.1" }, "jest": { "collectCoverage": true,