Skip to content

Commit 436319a

Browse files
authored
Merge pull request #369 from lo1tuma/description-to-title
Rename *-description rules to *-title
2 parents 71c8de5 + fbb8cfe commit 436319a

11 files changed

+34
-34
lines changed

README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,7 @@ See [Configuring Eslint](http://eslint.org/docs/user-guide/configuring) on [esli
126126
| [handle-done-callback](docs/rules/handle-done-callback.md) | Enforces handling of callbacks for async tests || | | |
127127
| [max-top-level-suites](docs/rules/max-top-level-suites.md) | Enforce the number of top-level suites in a single file || | | |
128128
| [no-async-suite](docs/rules/no-async-suite.md) | Disallow async functions passed to a suite || | | 🔧 |
129-
| [no-empty-description](docs/rules/no-empty-description.md) | Disallow empty test descriptions || | | |
129+
| [no-empty-title](docs/rules/no-empty-title.md) | Disallow empty test descriptions || | | |
130130
| [no-exclusive-tests](docs/rules/no-exclusive-tests.md) | Disallow exclusive tests | || | |
131131
| [no-exports](docs/rules/no-exports.md) | Disallow exports from test files || | | |
132132
| [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
143143
| [no-synchronous-tests](docs/rules/no-synchronous-tests.md) | Disallow synchronous tests | | || |
144144
| [no-top-level-hooks](docs/rules/no-top-level-hooks.md) | Disallow top-level hooks | || | |
145145
| [prefer-arrow-callback](docs/rules/prefer-arrow-callback.md) | Require using arrow functions for callbacks | | || 🔧 |
146-
| [valid-suite-description](docs/rules/valid-suite-description.md) | Require suite descriptions to match a pre-configured regular expression | | || |
147-
| [valid-test-description](docs/rules/valid-test-description.md) | Require test descriptions to match a pre-configured regular expression | | || |
146+
| [valid-suite-title](docs/rules/valid-suite-title.md) | Require suite descriptions to match a pre-configured regular expression | | || |
147+
| [valid-test-title](docs/rules/valid-test-title.md) | Require test descriptions to match a pre-configured regular expression | | || |
148148

149149
<!-- end auto-generated rules list -->

docs/rules/no-empty-description.md renamed to docs/rules/no-empty-title.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Disallow empty test descriptions (`mocha/no-empty-description`)
1+
# Disallow empty test descriptions (`mocha/no-empty-title`)
22

33
💼 This rule is enabled in the ✅ `recommended` [config](https://github.com/lo1tuma/eslint-plugin-mocha#configs).
44

@@ -40,7 +40,7 @@ Example of a custom rule configuration:
4040

4141
```js
4242
rules: {
43-
"mocha/no-empty-description": [ "warn", {
43+
"mocha/no-empty-title": [ "warn", {
4444
testNames: ["it", "specify", "test", "mytestname"],
4545
message: 'custom error message'
4646
} ]

docs/rules/valid-suite-description.md renamed to docs/rules/valid-suite-title.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Require suite descriptions to match a pre-configured regular expression (`mocha/valid-suite-description`)
1+
# Require suite descriptions to match a pre-configured regular expression (`mocha/valid-suite-title`)
22

33
🚫 This rule is _disabled_ in the ✅ `recommended` [config](https://github.com/lo1tuma/eslint-plugin-mocha#configs).
44

@@ -14,7 +14,7 @@ Example of a custom rule configuration:
1414

1515
```js
1616
rules: {
17-
"mocha/valid-suite-description": ["warn", { pattern: "^[A-Z]", message: 'custom error message' }]
17+
"mocha/valid-suite-title": ["warn", { pattern: "^[A-Z]", message: 'custom error message' }]
1818
},
1919
```
2020

@@ -51,10 +51,10 @@ There is also possible to configure a custom list of suite names and a custom er
5151

5252
```js
5353
rules: {
54-
"mocha/valid-suite-description": ["warn", "^[A-Z]", ["describe", "context", "suite", "mysuitename"], "custom error message"]
54+
"mocha/valid-suite-title": ["warn", "^[A-Z]", ["describe", "context", "suite", "mysuitename"], "custom error message"]
5555
},
5656
// OR
5757
rules: {
58-
"mocha/valid-suite-description": ["warn", { pattern: "^[A-Z]", suiteNames: ["describe", "context", "suite", "mysuitename"], message: "custom error message" }]
58+
"mocha/valid-suite-title": ["warn", { pattern: "^[A-Z]", suiteNames: ["describe", "context", "suite", "mysuitename"], message: "custom error message" }]
5959
},
6060
```

docs/rules/valid-test-description.md renamed to docs/rules/valid-test-title.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Require test descriptions to match a pre-configured regular expression (`mocha/valid-test-description`)
1+
# Require test descriptions to match a pre-configured regular expression (`mocha/valid-test-title`)
22

33
🚫 This rule is _disabled_ in the ✅ `recommended` [config](https://github.com/lo1tuma/eslint-plugin-mocha#configs).
44

@@ -16,7 +16,7 @@ Example of a custom rule configuration:
1616

1717
```js
1818
rules: {
19-
"mocha/valid-test-description": ["warn", { pattern: "mypattern$", message: 'custom error message' }]
19+
"mocha/valid-test-title": ["warn", { pattern: "mypattern$", message: 'custom error message' }]
2020
},
2121
```
2222

index.js

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import { consistentSpacingBetweenBlocksRule } from './lib/rules/consistent-spaci
44
import { handleDoneCallbackRule } from './lib/rules/handle-done-callback.js';
55
import { maxTopLevelSuitesRule } from './lib/rules/max-top-level-suites.js';
66
import { noAsyncSuiteRule } from './lib/rules/no-async-suite.js';
7-
import { noEmptyDescriptionRule } from './lib/rules/no-empty-description.js';
7+
import { noEmptyTitleRule } from './lib/rules/no-empty-title.js';
88
import { noExclusiveTestsRule } from './lib/rules/no-exclusive-tests.js';
99
import { noExportsRule } from './lib/rules/no-exports.js';
1010
import { noGlobalTestsRule } from './lib/rules/no-global-tests.js';
@@ -21,8 +21,8 @@ import { noSiblingHooksRule } from './lib/rules/no-sibling-hooks.js';
2121
import { noSynchronousTestsRule } from './lib/rules/no-synchronous-tests.js';
2222
import { noTopLevelHooksRule } from './lib/rules/no-top-level-hooks.js';
2323
import { preferArrowCallbackRule } from './lib/rules/prefer-arrow-callback.js';
24-
import { validSuiteDescriptionRule } from './lib/rules/valid-suite-description.js';
25-
import { validTestDescriptionRule } from './lib/rules/valid-test-description.js';
24+
import { validSuiteTitleRule } from './lib/rules/valid-suite-title.js';
25+
import { validTestTitleRule } from './lib/rules/valid-test-title.js';
2626

2727
const allRules = {
2828
'mocha/handle-done-callback': 'error',
@@ -44,11 +44,11 @@ const allRules = {
4444
'mocha/no-synchronous-tests': 'error',
4545
'mocha/no-top-level-hooks': 'error',
4646
'mocha/prefer-arrow-callback': 'error',
47-
'mocha/valid-suite-description': 'error',
48-
'mocha/valid-test-description': 'error',
49-
'mocha/no-empty-description': 'error',
5047
'mocha/consistent-spacing-between-blocks': 'error',
51-
'mocha/consistent-interface': ['error', { interface: 'BDD' }]
48+
'mocha/consistent-interface': ['error', { interface: 'BDD' }],
49+
'mocha/valid-suite-title': 'error',
50+
'mocha/valid-test-title': 'error',
51+
'mocha/no-empty-title': 'error'
5252
};
5353

5454
const recommendedRules = {
@@ -71,9 +71,9 @@ const recommendedRules = {
7171
'mocha/no-synchronous-tests': 'off',
7272
'mocha/no-top-level-hooks': 'warn',
7373
'mocha/prefer-arrow-callback': 'off',
74-
'mocha/valid-suite-description': 'off',
75-
'mocha/valid-test-description': 'off',
76-
'mocha/no-empty-description': 'error',
74+
'mocha/valid-suite-title': 'off',
75+
'mocha/valid-test-title': 'off',
76+
'mocha/no-empty-title': 'error',
7777
'mocha/consistent-spacing-between-blocks': 'error'
7878
};
7979

@@ -98,11 +98,11 @@ const mochaPlugin = {
9898
'no-synchronous-tests': noSynchronousTestsRule,
9999
'no-top-level-hooks': noTopLevelHooksRule,
100100
'prefer-arrow-callback': preferArrowCallbackRule,
101-
'valid-suite-description': validSuiteDescriptionRule,
102-
'valid-test-description': validTestDescriptionRule,
103-
'no-empty-description': noEmptyDescriptionRule,
104101
'consistent-spacing-between-blocks': consistentSpacingBetweenBlocksRule,
105-
'consistent-interface': consistentInterfaceRule
102+
'consistent-interface': consistentInterfaceRule,
103+
'valid-suite-title': validSuiteTitleRule,
104+
'valid-test-title': validTestTitleRule,
105+
'no-empty-title': noEmptyTitleRule
106106
},
107107
configs: {
108108
all: {

lib/rules/no-empty-description.js renamed to lib/rules/no-empty-title.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,12 +39,12 @@ function isValidDescriptionArgumentNode(node) {
3939
.includes(node.type);
4040
}
4141

42-
export const noEmptyDescriptionRule = {
42+
export const noEmptyTitleRule = {
4343
meta: {
4444
type: 'suggestion',
4545
docs: {
4646
description: 'Disallow empty test descriptions',
47-
url: 'https://github.com/lo1tuma/eslint-plugin-mocha/blob/main/docs/rules/no-empty-description.md'
47+
url: 'https://github.com/lo1tuma/eslint-plugin-mocha/blob/main/docs/rules/no-empty-title.md'
4848
},
4949
schema: [
5050
{

lib/rules/valid-suite-description.js renamed to lib/rules/valid-suite-title.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,12 +19,12 @@ const messageSchema = {
1919
type: 'string'
2020
};
2121

22-
export const validSuiteDescriptionRule = {
22+
export const validSuiteTitleRule = {
2323
meta: {
2424
type: 'suggestion',
2525
docs: {
2626
description: 'Require suite descriptions to match a pre-configured regular expression',
27-
url: 'https://github.com/lo1tuma/eslint-plugin-mocha/blob/main/docs/rules/valid-suite-description.md'
27+
url: 'https://github.com/lo1tuma/eslint-plugin-mocha/blob/main/docs/rules/valid-suite-title.md'
2828
},
2929
schema: [
3030
{

lib/rules/valid-test-description.js renamed to lib/rules/valid-test-title.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,12 +18,12 @@ const messageSchema = {
1818
type: 'string'
1919
};
2020

21-
export const validTestDescriptionRule = {
21+
export const validTestTitleRule = {
2222
meta: {
2323
type: 'suggestion',
2424
docs: {
2525
description: 'Require test descriptions to match a pre-configured regular expression',
26-
url: 'https://github.com/lo1tuma/eslint-plugin-mocha/blob/main/docs/rules/valid-test-description.md'
26+
url: 'https://github.com/lo1tuma/eslint-plugin-mocha/blob/main/docs/rules/valid-test-title.md'
2727
},
2828
schema: [
2929
{

test/rules/no-empty-description.js renamed to test/rules/no-empty-title.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ const ruleTester = new RuleTester({ languageOptions: { sourceType: 'script' } })
66
const defaultErrorMessage = 'Unexpected empty test description.';
77
const firstLine = { column: 1, line: 1 };
88

9-
ruleTester.run('no-empty-description', plugin.rules['no-empty-description'], {
9+
ruleTester.run('no-empty-title', plugin.rules['no-empty-title'], {
1010
valid: [
1111
'describe("some text")',
1212
'describe.only("some text")',

test/rules/valid-suite-description.js renamed to test/rules/valid-suite-title.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import plugin from '../../index.js';
33

44
const ruleTester = new RuleTester({ languageOptions: { sourceType: 'script' } });
55

6-
ruleTester.run('valid-suite-description', plugin.rules['valid-suite-description'], {
6+
ruleTester.run('valid-suite-title', plugin.rules['valid-suite-title'], {
77
valid: [
88
{
99
options: [{ pattern: '^[A-Z]' }],

test/rules/valid-test-description.js renamed to test/rules/valid-test-title.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import plugin from '../../index.js';
33

44
const ruleTester = new RuleTester({ languageOptions: { sourceType: 'script' } });
55

6-
ruleTester.run('valid-test-description', plugin.rules['valid-test-description'], {
6+
ruleTester.run('valid-test-title', plugin.rules['valid-test-title'], {
77
valid: [
88
'it("should respond to GET", function() { });',
99
'it("should do something");',

0 commit comments

Comments
 (0)