diff --git a/.changeset/eslint-no-async-describe.md b/.changeset/eslint-no-async-describe.md new file mode 100644 index 00000000000..ec380ec43f2 --- /dev/null +++ b/.changeset/eslint-no-async-describe.md @@ -0,0 +1,3 @@ +--- +--- + diff --git a/eslint.config.mjs b/eslint.config.mjs index 6fd8caffd2e..948a841428d 100644 --- a/eslint.config.mjs +++ b/eslint.config.mjs @@ -1,6 +1,7 @@ import js from '@eslint/js'; import { includeIgnoreFile } from '@eslint/compat'; import prettier from 'eslint-config-prettier'; +import mocha from 'eslint-plugin-mocha'; import globals from 'globals'; import path from 'path'; import { fileURLToPath } from 'node:url'; @@ -11,6 +12,7 @@ export default [ js.configs.recommended, prettier, { + plugins: { mocha }, languageOptions: { ecmaVersion: 2022, globals: { @@ -24,6 +26,9 @@ export default [ expect: 'readonly', }, }, + rules: { + 'mocha/no-async-suite': 'error', + }, }, includeIgnoreFile(path.resolve(__dirname, '.gitignore')), ]; diff --git a/package-lock.json b/package-lock.json index 8d054fa1718..992d785b692 100644 --- a/package-lock.json +++ b/package-lock.json @@ -26,6 +26,7 @@ "chai": "^4.2.0", "eslint": "^9.0.0", "eslint-config-prettier": "^10.0.0", + "eslint-plugin-mocha": "^11.2.0", "ethers": "^6.16.0", "glob": "^13.0.0", "globals": "^17.0.0", @@ -4418,6 +4419,33 @@ "eslint": ">=7.0.0" } }, + "node_modules/eslint-plugin-mocha": { + "version": "11.2.0", + "resolved": "https://registry.npmjs.org/eslint-plugin-mocha/-/eslint-plugin-mocha-11.2.0.tgz", + "integrity": "sha512-nMdy3tEXZac8AH5Z/9hwUkSfWu8xHf4XqwB5UEQzyTQGKcNlgFeciRAjLjliIKC3dR1Ex/a2/5sqgQzvYRkkkA==", + "dev": true, + "license": "MIT", + "dependencies": { + "@eslint-community/eslint-utils": "^4.4.1", + "globals": "^15.14.0" + }, + "peerDependencies": { + "eslint": ">=9.0.0" + } + }, + "node_modules/eslint-plugin-mocha/node_modules/globals": { + "version": "15.15.0", + "resolved": "https://registry.npmjs.org/globals/-/globals-15.15.0.tgz", + "integrity": "sha512-7ACyT3wmyp3I61S4fG682L0VA2RGD9otkqGJIwNUMF1SWUombIIk+af1unuDYgMm082aHYwD+mzJvv9Iu8dsgg==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=18" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, "node_modules/eslint-scope": { "version": "8.4.0", "resolved": "https://registry.npmjs.org/eslint-scope/-/eslint-scope-8.4.0.tgz", diff --git a/package.json b/package.json index 8297ca42594..590fc9a6588 100644 --- a/package.json +++ b/package.json @@ -69,6 +69,7 @@ "chai": "^4.2.0", "eslint": "^9.0.0", "eslint-config-prettier": "^10.0.0", + "eslint-plugin-mocha": "^11.2.0", "ethers": "^6.16.0", "glob": "^13.0.0", "globals": "^17.0.0", diff --git a/test/access/manager/AccessManager.test.js b/test/access/manager/AccessManager.test.js index 79536d69a2a..d13bb741b4b 100644 --- a/test/access/manager/AccessManager.test.js +++ b/test/access/manager/AccessManager.test.js @@ -1108,7 +1108,7 @@ describe('AccessManager', function () { expect(await this.manager.isTargetClosed(this.target)).to.be.false; }); - describe('when the target is the manager', async function () { + describe('when the target is the manager', function () { it('closes and opens the manager', async function () { await expect(this.manager.connect(this.admin).setTargetClosed(this.manager, true)) .to.emit(this.manager, 'TargetClosed') diff --git a/test/crosschain/BridgeERC1155.behavior.js b/test/crosschain/BridgeERC1155.behavior.js index a36d6a38ab2..c138e353e99 100644 --- a/test/crosschain/BridgeERC1155.behavior.js +++ b/test/crosschain/BridgeERC1155.behavior.js @@ -27,7 +27,7 @@ function shouldBehaveLikeBridgeERC1155({ chainAIsCustodial = false, chainBIsCust ]); }); - describe('crosschain send (both direction)', async function () { + describe('crosschain send (both direction)', function () { it('single', async function () { const [alice, bruce, chris] = this.accounts; diff --git a/test/token/ERC6909/ERC6909.behavior.js b/test/token/ERC6909/ERC6909.behavior.js index adfe15a32e6..57b00d2e398 100644 --- a/test/token/ERC6909/ERC6909.behavior.js +++ b/test/token/ERC6909/ERC6909.behavior.js @@ -142,7 +142,7 @@ function shouldBehaveLikeERC6909() { await expect(this.token.balanceOf(this.recipient, firstTokenId)).to.eventually.equal(amount); }); - describe('with approval', async function () { + describe('with approval', function () { beforeEach(async function () { await this.token.connect(this.holder).approve(this.operator, firstTokenId, amount); });