Skip to content

Commit

Permalink
Rename *-description rules to *-title
Browse files Browse the repository at this point in the history
  • Loading branch information
lo1tuma committed Jan 23, 2025
1 parent 71c8de5 commit fbb8cfe
Show file tree
Hide file tree
Showing 11 changed files with 34 additions and 34 deletions.
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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 || | | |
Expand All @@ -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 -->
Original file line number Diff line number Diff line change
@@ -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).

Expand Down Expand Up @@ -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'
} ]
Expand Down
Original file line number Diff line number Diff line change
@@ -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).

Expand All @@ -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' }]
},
```

Expand Down Expand Up @@ -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" }]
},
```
Original file line number Diff line number Diff line change
@@ -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).

Expand All @@ -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' }]
},
```

Expand Down
28 changes: 14 additions & 14 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand All @@ -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',
Expand All @@ -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 = {
Expand All @@ -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'
};

Expand All @@ -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: {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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: [
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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: [
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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: [
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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")',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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]' }],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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");',
Expand Down

0 comments on commit fbb8cfe

Please sign in to comment.