From 9fd482177762d88169a65a86d7975686b2fe1728 Mon Sep 17 00:00:00 2001 From: cartogram Date: Wed, 15 May 2019 00:03:54 -0400 Subject: [PATCH 1/2] adds necessary to vague terms --- CHANGELOG.md | 5 ++ lib/rules/jest/no-vague-titles.js | 1 + tests/lib/rules/jest/no-vague-titles.js | 72 ++++++++++++++++++++++++- 3 files changed, 77 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 31a630d2..edbbe55c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,10 @@ +### Changed + +- added "necessary" to `shopify/jest/no-vague-titles` + ### Added - New Rules: @@ -10,6 +14,7 @@ - `react/state-in-constructor` Enforce state initialization to be in a class property. ([256](https://github.com/Shopify/eslint-plugin-shopify/pull/246)) ### Fixed + - `react-prefer-private-members` from incorrectly reporting the members of a parent class if a React class is defined within its constructor. ([258](https://github.com/Shopify/eslint-plugin-shopify/pull/258)) ## [28.0.0] - 2019-04-26 diff --git a/lib/rules/jest/no-vague-titles.js b/lib/rules/jest/no-vague-titles.js index 599f1f2c..6c61be6a 100644 --- a/lib/rules/jest/no-vague-titles.js +++ b/lib/rules/jest/no-vague-titles.js @@ -13,6 +13,7 @@ const VAGUE_TERMS = { properly: /properly/i, every: /every/i, descriptive: /descriptive/i, + necessary: /necessary/i, }; module.exports = { diff --git a/tests/lib/rules/jest/no-vague-titles.js b/tests/lib/rules/jest/no-vague-titles.js index 440af9b7..8fa45b4f 100644 --- a/tests/lib/rules/jest/no-vague-titles.js +++ b/tests/lib/rules/jest/no-vague-titles.js @@ -142,7 +142,53 @@ ruleTester.run('no-vague-titles', rule, { ], invalid: [ { - code: "it('properly should correcly appropriate all')", + code: + "it('properly should correcly appropriate all descriptive necessary')", + parser, + errors: [ + { + messageId: 'containsVagueWord', + }, + ], + }, + { + code: "it('necessary')", + parser, + errors: [ + { + messageId: 'containsVagueWord', + }, + ], + }, + { + code: "describe('necessary')", + parser, + errors: [ + { + messageId: 'containsVagueWord', + }, + ], + }, + { + code: "test('necessary')", + parser, + errors: [ + { + messageId: 'containsVagueWord', + }, + ], + }, + { + code: "fit('necessary')", + parser, + errors: [ + { + messageId: 'containsVagueWord', + }, + ], + }, + { + code: "xdescribe('necessary')", parser, errors: [ { @@ -1454,3 +1500,27 @@ ruleTester.run('no-vague-titles with allow=descriptive', rule, { }, ], }); + +ruleTester.run('no-vague-titles with allow=necessary', rule, { + valid: [ + { + code: "it('necessary')", + options: [{allow: ['necessary']}], + }, + { + code: "it('necessary all should')", + options: [{allow: ['necessary', 'should', 'all']}], + }, + ], + invalid: [ + { + code: "it('properly all should')", + options: [{allow: ['necessary', 'should']}], + errors: [ + { + messageId: 'containsVagueWord', + }, + ], + }, + ], +}); From dffa815810c5f0fc377cdcc64f9f7170f18aba17 Mon Sep 17 00:00:00 2001 From: Matt Seccafien Date: Wed, 15 May 2019 00:11:48 -0400 Subject: [PATCH 2/2] Update CHANGELOG.md --- CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index edbbe55c..aa461250 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,7 +4,7 @@ ### Changed -- added "necessary" to `shopify/jest/no-vague-titles` +- added "necessary" to `shopify/jest/no-vague-titles` ([265](https://github.com/Shopify/eslint-plugin-shopify/pull/265)) ### Added