{"id":13657095,"url":"https://github.com/lo1tuma/eslint-plugin-mocha","last_synced_at":"2025-05-14T07:10:44.687Z","repository":{"id":19083778,"uuid":"22311376","full_name":"lo1tuma/eslint-plugin-mocha","owner":"lo1tuma","description":"ESLint rules for mocha","archived":false,"fork":false,"pushed_at":"2025-04-26T16:39:08.000Z","size":1779,"stargazers_count":284,"open_issues_count":19,"forks_count":62,"subscribers_count":5,"default_branch":"main","last_synced_at":"2025-04-26T17:24:12.962Z","etag":null,"topics":["eslint","eslint-plugin","eslintplugin","hacktoberfest","mocha"],"latest_commit_sha":null,"homepage":"","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/lo1tuma.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2014-07-27T13:18:49.000Z","updated_at":"2025-04-26T16:39:11.000Z","dependencies_parsed_at":"2024-01-08T10:16:31.107Z","dependency_job_id":"d3842236-4548-4677-84b6-a21c9a90df04","html_url":"https://github.com/lo1tuma/eslint-plugin-mocha","commit_stats":{"total_commits":472,"total_committers":61,"mean_commits":7.737704918032787,"dds":0.548728813559322,"last_synced_commit":"4168ecab6cda70d1a22d9ecc8f8b76c3f1c22516"},"previous_names":[],"tags_count":63,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lo1tuma%2Feslint-plugin-mocha","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lo1tuma%2Feslint-plugin-mocha/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lo1tuma%2Feslint-plugin-mocha/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lo1tuma%2Feslint-plugin-mocha/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/lo1tuma","download_url":"https://codeload.github.com/lo1tuma/eslint-plugin-mocha/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":254092798,"owners_count":22013292,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["eslint","eslint-plugin","eslintplugin","hacktoberfest","mocha"],"created_at":"2024-08-02T05:00:36.800Z","updated_at":"2025-05-14T07:10:39.676Z","avatar_url":"https://github.com/lo1tuma.png","language":"TypeScript","funding_links":[],"categories":["JavaScript","Plugins"],"sub_categories":["Testing Tools"],"readme":"[![NPM Version](https://img.shields.io/npm/v/eslint-plugin-mocha.svg?style=flat)](https://www.npmjs.org/package/eslint-plugin-mocha)\n[![GitHub Actions status](https://github.com/lo1tuma/eslint-plugin-mocha/workflows/CI/badge.svg)](https://github.com/lo1tuma/eslint-plugin-mocha/actions)\n[![Coverage Status](https://img.shields.io/coveralls/lo1tuma/eslint-plugin-mocha/main.svg?style=flat)](https://coveralls.io/r/lo1tuma/eslint-plugin-mocha)\n[![NPM Downloads](https://img.shields.io/npm/dm/eslint-plugin-mocha.svg?style=flat)](https://www.npmjs.org/package/eslint-plugin-mocha)\n\n# eslint-plugin-mocha\n\nESLint rules for [mocha](http://mochajs.org/).\n\n## Install and configure\n\nThis plugin requires ESLint `9.0.0` or later.\n\n```bash\nnpm install --save-dev eslint-plugin-mocha\n```\n\n### Configuration via `eslint.config.js`\n\nTo use this plugin with [the new eslint configuration format (flat config)](https://eslint.org/docs/latest/use/configure/configuration-files-new):\n\n```js\nimport mochaPlugin from \"eslint-plugin-mocha\";\n\nexport default [\n    mochaPlugin.configs.flat.recommended, // or `mochaPlugin.configs.flat.all` to enable all\n    // ... Your configurations here\n];\n```\n\n### Plugin Settings\n\nThis plugin supports the following settings, which are used by multiple rules:\n\n- `additionalCustomNames`: This allows rules to check additional function names when looking for suites or test cases. This might be used with a custom Mocha extension, such as [`ember-mocha`](https://github.com/switchfly/ember-mocha) or [`mocha-each`](https://github.com/ryym/mocha-each).\n\n    **Example:**\n\n    ```json\n    {\n        \"rules\": {\n            \"mocha/no-pending-tests\": \"error\",\n            \"mocha/no-exclusive-tests\": \"error\"\n        },\n        \"settings\": {\n            \"mocha/additionalCustomNames\": [\n                {\n                    \"name\": \"describeModule\",\n                    \"type\": \"suite\",\n                    \"interface\": \"BDD\"\n                },\n                {\n                    \"name\": \"testModule\",\n                    \"type\": \"testCase\",\n                    \"interface\": \"TDD\"\n                }\n            ]\n        }\n    }\n    ```\n\n    The `name` property can be in any of the following forms:\n\n  - A plain name e.g. `describeModule`, which allows:\n\n    ```javascript\n    describeModule(\"example\", function() { ... });\n    ```\n\n  - A dotted name, e.g. `describe.modifier`, which allows:\n\n    ```javascript\n    describe.modifier(\"example\", function() { ... });\n    ```\n\n  - A name with parentheses, e.g. `forEach().describe`, which allows:\n\n    ```javascript\n    forEach([ 1, 2, 3 ])\n        .describe(\"example\", function(n) { ... });\n    ```\n\n  - Any combination of the above, e.g. `forEach().describeModule.modifier`, which allows:\n\n    ```javascript\n    forEach([ 1, 2, 3 ])\n        .describeModule.modifier(\"example\", function(n) { ... });\n    ```\n\n- `interface`: This allows to select either `TDD`, `BDD` (default) or `exports`. When using `exports` mocha variables are resolved from named `import` statements instead of global variables.\n\n## Configs\n\n### `recommended`\n\nThis plugin exports a recommended config that enforces good practices.\n\nEnable it with the extends option:\n\n```json\n{\n    \"extends\": [\"plugin:mocha/recommended\"]\n}\n```\n\n### `all`\n\nThere's also a configuration that enables all of our rules.\n\nSee [Configuring Eslint](http://eslint.org/docs/user-guide/configuring) on [eslint.org](http://eslint.org) for more info.\n\n## Rules\n\n\u003c!-- begin auto-generated rules list --\u003e\n\n💼 [Configurations](https://github.com/lo1tuma/eslint-plugin-mocha#configs) enabled in.\\\n⚠️ [Configurations](https://github.com/lo1tuma/eslint-plugin-mocha#configs) set to warn in.\\\n🚫 [Configurations](https://github.com/lo1tuma/eslint-plugin-mocha#configs) disabled in.\\\n✅ Set in the `recommended` [configuration](https://github.com/lo1tuma/eslint-plugin-mocha#configs).\\\n🔧 Automatically fixable by the [`--fix` CLI option](https://eslint.org/docs/user-guide/command-line-interface#--fix).\n\n| Name                                                                                 | Description                                                             | 💼 | ⚠️ | 🚫 | 🔧 |\n| :----------------------------------------------------------------------------------- | :---------------------------------------------------------------------- | :- | :- | :- | :- |\n| [consistent-interface](docs/rules/consistent-interface.md)                           | Enforces consistent use of mocha interfaces                             |    |    |    |    |\n| [consistent-spacing-between-blocks](docs/rules/consistent-spacing-between-blocks.md) | Require consistent spacing between blocks                               | ✅  |    |    | 🔧 |\n| [handle-done-callback](docs/rules/handle-done-callback.md)                           | Enforces handling of callbacks for async tests                          | ✅  |    |    |    |\n| [max-top-level-suites](docs/rules/max-top-level-suites.md)                           | Enforce the number of top-level suites in a single file                 | ✅  |    |    |    |\n| [no-async-suite](docs/rules/no-async-suite.md)                                       | Disallow async functions passed to a suite                              | ✅  |    |    | 🔧 |\n| [no-empty-title](docs/rules/no-empty-title.md)                                       | Disallow empty test descriptions                                        | ✅  |    |    |    |\n| [no-exclusive-tests](docs/rules/no-exclusive-tests.md)                               | Disallow exclusive tests                                                |    | ✅  |    |    |\n| [no-exports](docs/rules/no-exports.md)                                               | Disallow exports from test files                                        | ✅  |    |    |    |\n| [no-global-tests](docs/rules/no-global-tests.md)                                     | Disallow global tests                                                   | ✅  |    |    |    |\n| [no-hooks](docs/rules/no-hooks.md)                                                   | Disallow hooks                                                          |    |    | ✅  |    |\n| [no-hooks-for-single-case](docs/rules/no-hooks-for-single-case.md)                   | Disallow hooks for a single test or test suite                          |    |    | ✅  |    |\n| [no-identical-title](docs/rules/no-identical-title.md)                               | Disallow identical titles                                               | ✅  |    |    |    |\n| [no-mocha-arrows](docs/rules/no-mocha-arrows.md)                                     | Disallow arrow functions as arguments to mocha functions                | ✅  |    |    | 🔧 |\n| [no-nested-tests](docs/rules/no-nested-tests.md)                                     | Disallow tests to be nested within other tests                          | ✅  |    |    |    |\n| [no-pending-tests](docs/rules/no-pending-tests.md)                                   | Disallow pending tests                                                  |    | ✅  |    |    |\n| [no-return-and-callback](docs/rules/no-return-and-callback.md)                       | Disallow returning in a test or hook function that uses a callback      | ✅  |    |    |    |\n| [no-return-from-async](docs/rules/no-return-from-async.md)                           | Disallow returning from an async test or hook                           |    |    | ✅  |    |\n| [no-setup-in-describe](docs/rules/no-setup-in-describe.md)                           | Disallow setup in describe blocks                                       | ✅  |    |    |    |\n| [no-sibling-hooks](docs/rules/no-sibling-hooks.md)                                   | Disallow duplicate uses of a hook at the same level inside a suite      | ✅  |    |    |    |\n| [no-synchronous-tests](docs/rules/no-synchronous-tests.md)                           | Disallow synchronous tests                                              |    |    | ✅  |    |\n| [no-top-level-hooks](docs/rules/no-top-level-hooks.md)                               | Disallow top-level hooks                                                |    | ✅  |    |    |\n| [prefer-arrow-callback](docs/rules/prefer-arrow-callback.md)                         | Require using arrow functions for callbacks                             |    |    | ✅  | 🔧 |\n| [valid-suite-title](docs/rules/valid-suite-title.md)                                 | Require suite descriptions to match a pre-configured regular expression |    |    | ✅  |    |\n| [valid-test-title](docs/rules/valid-test-title.md)                                   | Require test descriptions to match a pre-configured regular expression  |    |    | ✅  |    |\n\n\u003c!-- end auto-generated rules list --\u003e\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flo1tuma%2Feslint-plugin-mocha","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Flo1tuma%2Feslint-plugin-mocha","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flo1tuma%2Feslint-plugin-mocha/lists"}