Repository: lo1tuma/eslint-plugin-mocha (ts)

Issue:
Consitent rule naming
Currently we do have some rules related to test descriptions but sometimes we are using the term "description" and sometimes title:

* `no-empty-description`
* `no-identical-title`
* `valid-suite-description`
* `valid-test-description`

Pull request:
Rename *-description rules to *-title
Fixes #314

Patch:
diff --git a/README.md b/README.md
index eefbb96..126ff7f 100644
--- a/README.md
+++ b/README.md
@@ -126,7 +126,7 @@ See [Configuring Eslint](http://eslint.org/docs/user-guide/configuring) on [esli
 | [handle-done-callback](docs/rules/handle-done-callback.md)                           | Enforces handling of callbacks for async tests                          | ✅  |    |    |    |
 | [max-top-level-suites](docs/rules/max-top-level-suites.md)                           | Enforce the number of top-level suites in a single file                 | ✅  |    |    |    |
 | [no-async-suite](docs/rules/no-async-suite.md)                                       | Disallow async functions passed to a suite                              | ✅  |    |    | 🔧 |
-| [no-empty-description](docs/rules/no-empty-description.md)                           | Disallow empty test descriptions                                        | ✅  |    |    |    |
+| [no-empty-title](docs/rules/no-empty-title.md)                                       | Disallow empty test descriptions                                        | ✅  |    |    |    |
 | [no-exclusive-tests](docs/rules/no-exclusive-tests.md)                               | Disallow exclusive tests                                                |    | ✅  |    |    |
 | [no-exports](docs/rules/no-exports.md)                                               | Disallow exports from test files                                        | ✅  |    |    |    |
 | [no-global-tests](docs/rules/no-global-tests.md)                                     | Disallow global tests                                                   | ✅  |    |    |    |
@@ -143,7 +143,7 @@ See [Configuring Eslint](http://eslint.org/docs/user-guide/configuring) on [esli
 | [no-synchronous-tests](docs/rules/no-synchronous-tests.md)                           | Disallow synchronous tests                                              |    |    | ✅  |    |
 | [no-top-level-hooks](docs/rules/no-top-level-hooks.md)                               | Disallow top-level hooks                                                |    | ✅  |    |    |
 | [prefer-arrow-callback](docs/rules/prefer-arrow-callback.md)                         | Require using arrow functions for callbacks                             |    |    | ✅  | 🔧 |
-| [valid-suite-description](docs/rules/valid-suite-description.md)                     | Require suite descriptions to match a pre-configured regular expression |    |    | ✅  |    |
-| [valid-test-description](docs/rules/valid-test-description.md)                       | Require test descriptions to match a pre-configured regular expression  |    |    | ✅  |    |
+| [valid-suite-title](docs/rules/valid-suite-title.md)                                 | Require suite descriptions to match a pre-configured regular expression |    |    | ✅  |    |
+| [valid-test-title](docs/rules/valid-test-title.md)                                   | Require test descriptions to match a pre-configured regular expression  |    |    | ✅  |    |
 
 <!-- end auto-generated rules list -->
diff --git a/docs/rules/no-empty-description.md b/docs/rules/no-empty-title.md
similarity index 87%
rename from docs/rules/no-empty-description.md
rename to docs/rules/no-empty-title.md
index 6830a19..061b801 100644
--- a/docs/rules/no-empty-description.md
+++ b/docs/rules/no-empty-title.md
@@ -1,4 +1,4 @@
-# Disallow empty test descriptions (`mocha/no-empty-description`)
+# Disallow empty test descriptions (`mocha/no-empty-title`)
 
 💼 This rule is enabled in the ✅ `recommended` [config](https://github.com/lo1tuma/eslint-plugin-mocha#configs).
 
@@ -40,7 +40,7 @@ Example of a custom rule configuration:
 
 ```js
 rules: {
-    "mocha/no-empty-description": [ "warn", {
+    "mocha/no-empty-title": [ "warn", {
         testNames: ["it", "specify", "test", "mytestname"],
         message: 'custom error message'
     } ]
diff --git a/docs/rules/valid-suite-description.md b/docs/rules/valid-suite-title.md
similarity index 76%
rename from docs/rules/valid-suite-description.md
rename to docs/rules/valid-suite-title.md
index 9815d08..23309a8 100644
--- a/docs/rules/valid-suite-description.md
+++ b/docs/rules/valid-suite-title.md
@@ -1,4 +1,4 @@
-# Require suite descriptions to match a pre-configured regular expression (`mocha/valid-suite-description`)
+# Require suite descriptions to match a pre-configured regular expression (`mocha/valid-suite-title`)
 
 🚫 This rule is _disabled_ in the ✅ `recommended` [config](https://github.com/lo1tuma/eslint-plugin-mocha#configs).
 
@@ -14,7 +14,7 @@ Example of a custom rule configuration:
 
 ```js
 rules: {
-   "mocha/valid-suite-description": ["warn", { pattern: "^[A-Z]", message: 'custom error message' }]
+   "mocha/valid-suite-title": ["warn", { pattern: "^[A-Z]", message: 'custom error message' }]
 },
 ```
 
@@ -51,10 +51,10 @@ There is also possible to configure a custom list of suite names and a custom er
 
 ```js
 rules: {
-   "mocha/valid-suite-description": ["warn", "^[A-Z]", ["describe", "context", "suite", "mysuitename"], "custom error message"]
+   "mocha/valid-suite-title": ["warn", "^[A-Z]", ["describe", "context", "suite", "mysuitename"], "custom error message"]
 },
 // OR
 rules: {
-   "mocha/valid-suite-description": ["warn", { pattern: "^[A-Z]", suiteNames: ["describe", "context", "suite", "mysuitename"], message: "custom error message" }]
+   "mocha/valid-suite-title": ["warn", { pattern: "^[A-Z]", suiteNames: ["describe", "context", "suite", "mysuitename"], message: "custom error message" }]
 },
 ```
diff --git a/index.js b/index.js
index 8ba6483..09cbaf7 100644
--- a/index.js
+++ b/index.js
@@ -4,7 +4,7 @@ import { consistentSpacingBetweenBlocksRule } from './lib/rules/consistent-spaci
 import { handleDoneCallbackRule } from './lib/rules/handle-done-callback.js';
 import { maxTopLevelSuitesRule } from './lib/rules/max-top-level-suites.js';
 import { noAsyncSuiteRule } from './lib/rules/no-async-suite.js';
-import { noEmptyDescriptionRule } from './lib/rules/no-empty-description.js';
+import { noEmptyTitleRule } from './lib/rules/no-empty-title.js';
 import { noExclusiveTestsRule } from './lib/rules/no-exclusive-tests.js';
 import { noExportsRule } from './lib/rules/no-exports.js';
 import { noGlobalTestsRule } from './lib/rules/no-global-tests.js';
@@ -21,8 +21,8 @@ import { noSiblingHooksRule } from './lib/rules/no-sibling-hooks.js';
 import { noSynchronousTestsRule } from './lib/rules/no-synchronous-tests.js';
 import { noTopLevelHooksRule } from './lib/rules/no-top-level-hooks.js';
 import { preferArrowCallbackRule } from './lib/rules/prefer-arrow-callback.js';
-import { validSuiteDescriptionRule } from './lib/rules/valid-suite-description.js';
-import { validTestDescriptionRule } from './lib/rules/valid-test-description.js';
+import { validSuiteTitleRule } from './lib/rules/valid-suite-title.js';
+import { validTestTitleRule } from './lib/rules/valid-test-title.js';
 
 const allRules = {
     'mocha/handle-done-callback': 'error',
@@ -44,11 +44,11 @@ const allRules = {
     'mocha/no-synchronous-tests': 'error',
     'mocha/no-top-level-hooks': 'error',
     'mocha/prefer-arrow-callback': 'error',
-    'mocha/valid-suite-description': 'error',
-    'mocha/valid-test-description': 'error',
-    'mocha/no-empty-description': 'error',
     'mocha/consistent-spacing-between-blocks': 'error',
-    'mocha/consistent-interface': ['error', { interface: 'BDD' }]
+    'mocha/consistent-interface': ['error', { interface: 'BDD' }],
+    'mocha/valid-suite-title': 'error',
+    'mocha/valid-test-title': 'error',
+    'mocha/no-empty-title': 'error'
 };
 
 const recommendedRules = {
@@ -71,9 +71,9 @@ const recommendedRules = {
     'mocha/no-synchronous-tests': 'off',
     'mocha/no-top-level-hooks': 'warn',
     'mocha/prefer-arrow-callback': 'off',
-    'mocha/valid-suite-description': 'off',
-    'mocha/valid-test-description': 'off',
-    'mocha/no-empty-description': 'error',
+    'mocha/valid-suite-title': 'off',
+    'mocha/valid-test-title': 'off',
+    'mocha/no-empty-title': 'error',
     'mocha/consistent-spacing-between-blocks': 'error'
 };
 
@@ -98,11 +98,11 @@ const mochaPlugin = {
         'no-synchronous-tests': noSynchronousTestsRule,
         'no-top-level-hooks': noTopLevelHooksRule,
         'prefer-arrow-callback': preferArrowCallbackRule,
-        'valid-suite-description': validSuiteDescriptionRule,
-        'valid-test-description': validTestDescriptionRule,
-        'no-empty-description': noEmptyDescriptionRule,
         'consistent-spacing-between-blocks': consistentSpacingBetweenBlocksRule,
-        'consistent-interface': consistentInterfaceRule
+        'consistent-interface': consistentInterfaceRule,
+        'valid-suite-title': validSuiteTitleRule,
+        'valid-test-title': validTestTitleRule,
+        'no-empty-title': noEmptyTitleRule
     },
     configs: {
         all: {
diff --git a/lib/rules/no-empty-description.js b/lib/rules/no-empty-title.js
similarity index 96%
rename from lib/rules/no-empty-description.js
rename to lib/rules/no-empty-title.js
index 1163ca8..99beba8 100644
--- a/lib/rules/no-empty-description.js
+++ b/lib/rules/no-empty-title.js
@@ -39,12 +39,12 @@ function isValidDescriptionArgumentNode(node) {
         .includes(node.type);
 }
 
-export const noEmptyDescriptionRule = {
+export const noEmptyTitleRule = {
     meta: {
         type: 'suggestion',
         docs: {
             description: 'Disallow empty test descriptions',
-            url: 'https://github.com/lo1tuma/eslint-plugin-mocha/blob/main/docs/rules/no-empty-description.md'
+            url: 'https://github.com/lo1tuma/eslint-plugin-mocha/blob/main/docs/rules/no-empty-title.md'
         },
         schema: [
             {
diff --git a/lib/rules/valid-suite-description.js b/lib/rules/valid-suite-title.js
similarity index 96%
rename from lib/rules/valid-suite-description.js
rename to lib/rules/valid-suite-title.js
index 2d58109..75c765c 100644
--- a/lib/rules/valid-suite-description.js
+++ b/lib/rules/valid-suite-title.js
@@ -19,12 +19,12 @@ const messageSchema = {
     type: 'string'
 };
 
-export const validSuiteDescriptionRule = {
+export const validSuiteTitleRule = {
     meta: {
         type: 'suggestion',
         docs: {
             description: 'Require suite descriptions to match a pre-configured regular expression',
-            url: 'https://github.com/lo1tuma/eslint-plugin-mocha/blob/main/docs/rules/valid-suite-description.md'
+            url: 'https://github.com/lo1tuma/eslint-plugin-mocha/blob/main/docs/rules/valid-suite-title.md'
         },
         schema: [
             {


Test patch:
diff --git a/docs/rules/valid-test-description.md b/docs/rules/valid-test-title.md
similarity index 90%
rename from docs/rules/valid-test-description.md
rename to docs/rules/valid-test-title.md
index 1dabddb..9f1dd3a 100644
--- a/docs/rules/valid-test-description.md
+++ b/docs/rules/valid-test-title.md
@@ -1,4 +1,4 @@
-# Require test descriptions to match a pre-configured regular expression (`mocha/valid-test-description`)
+# Require test descriptions to match a pre-configured regular expression (`mocha/valid-test-title`)
 
 🚫 This rule is _disabled_ in the ✅ `recommended` [config](https://github.com/lo1tuma/eslint-plugin-mocha#configs).
 
@@ -16,7 +16,7 @@ Example of a custom rule configuration:
 
 ```js
 rules: {
-    "mocha/valid-test-description": ["warn", { pattern: "mypattern$", message: 'custom error message' }]
+    "mocha/valid-test-title": ["warn", { pattern: "mypattern$", message: 'custom error message' }]
 },
 ```
 
diff --git a/lib/rules/valid-test-description.js b/lib/rules/valid-test-title.js
similarity index 96%
rename from lib/rules/valid-test-description.js
rename to lib/rules/valid-test-title.js
index b2b4a94..88234af 100644
--- a/lib/rules/valid-test-description.js
+++ b/lib/rules/valid-test-title.js
@@ -18,12 +18,12 @@ const messageSchema = {
     type: 'string'
 };
 
-export const validTestDescriptionRule = {
+export const validTestTitleRule = {
     meta: {
         type: 'suggestion',
         docs: {
             description: 'Require test descriptions to match a pre-configured regular expression',
-            url: 'https://github.com/lo1tuma/eslint-plugin-mocha/blob/main/docs/rules/valid-test-description.md'
+            url: 'https://github.com/lo1tuma/eslint-plugin-mocha/blob/main/docs/rules/valid-test-title.md'
         },
         schema: [
             {
diff --git a/test/rules/no-empty-description.js b/test/rules/no-empty-title.js
similarity index 98%
rename from test/rules/no-empty-description.js
rename to test/rules/no-empty-title.js
index 73b273c..950b183 100644
--- a/test/rules/no-empty-description.js
+++ b/test/rules/no-empty-title.js
@@ -6,7 +6,7 @@ const ruleTester = new RuleTester({ languageOptions: { sourceType: 'script' } })
 const defaultErrorMessage = 'Unexpected empty test description.';
 const firstLine = { column: 1, line: 1 };
 
-ruleTester.run('no-empty-description', plugin.rules['no-empty-description'], {
+ruleTester.run('no-empty-title', plugin.rules['no-empty-title'], {
     valid: [
         'describe("some text")',
         'describe.only("some text")',
diff --git a/test/rules/valid-suite-description.js b/test/rules/valid-suite-title.js
similarity index 97%
rename from test/rules/valid-suite-description.js
rename to test/rules/valid-suite-title.js
index 4b7dbfb..694792e 100644
--- a/test/rules/valid-suite-description.js
+++ b/test/rules/valid-suite-title.js
@@ -3,7 +3,7 @@ import plugin from '../../index.js';
 
 const ruleTester = new RuleTester({ languageOptions: { sourceType: 'script' } });
 
-ruleTester.run('valid-suite-description', plugin.rules['valid-suite-description'], {
+ruleTester.run('valid-suite-title', plugin.rules['valid-suite-title'], {
     valid: [
         {
             options: [{ pattern: '^[A-Z]' }],
diff --git a/test/rules/valid-test-description.js b/test/rules/valid-test-title.js
similarity index 98%
rename from test/rules/valid-test-description.js
rename to test/rules/valid-test-title.js
index 92cfb48..90ce285 100644
--- a/test/rules/valid-test-description.js
+++ b/test/rules/valid-test-title.js
@@ -3,7 +3,7 @@ import plugin from '../../index.js';
 
 const ruleTester = new RuleTester({ languageOptions: { sourceType: 'script' } });
 
-ruleTester.run('valid-test-description', plugin.rules['valid-test-description'], {
+ruleTester.run('valid-test-title', plugin.rules['valid-test-title'], {
     valid: [
         'it("should respond to GET", function() { });',
         'it("should do something");',