From fd1a1a86f21986f16344d2dbd6296a28088a1188 Mon Sep 17 00:00:00 2001 From: Alex Gherghisan Date: Mon, 23 Oct 2023 12:41:31 +0100 Subject: [PATCH] fix: add lint rule for focused tests (#2901) Please provide a paragraph or two giving a summary of the change, including relevant motivation and context. # Checklist: Remove the checklist to signal you've completed it. Enable auto-merge if the PR is ready to merge. - [ ] If the pull request requires a cryptography review (e.g. cryptographic algorithm implementations) I have added the 'crypto' tag. - [ ] I have reviewed my diff in github, line by line and removed unexpected formatting changes, testing logs, or commented-out code. - [ ] Every change is related to the PR description. - [ ] I have [linked](https://docs.github.com/en/issues/tracking-your-work-with-issues/linking-a-pull-request-to-an-issue) this pull request to relevant issues (if any exist). --- yarn-project/foundation/.eslintrc.cjs | 4 +++- yarn-project/foundation/package.json | 1 + yarn-project/yarn.lock | 8 ++++++++ 3 files changed, 12 insertions(+), 1 deletion(-) diff --git a/yarn-project/foundation/.eslintrc.cjs b/yarn-project/foundation/.eslintrc.cjs index a5ea3290ce9..76ca51878ba 100644 --- a/yarn-project/foundation/.eslintrc.cjs +++ b/yarn-project/foundation/.eslintrc.cjs @@ -52,7 +52,7 @@ module.exports = { }, root: true, parser: '@typescript-eslint/parser', - plugins: ['@typescript-eslint', 'eslint-plugin-tsdoc', 'jsdoc'], + plugins: ['@typescript-eslint', 'eslint-plugin-tsdoc', 'jsdoc', 'no-only-tests'], overrides: [ { files: ['*.ts', '*.tsx'], @@ -129,6 +129,8 @@ module.exports = { 'jsdoc/require-property-description': [JSDOC_RULES_LEVEL, { contexts }], 'jsdoc/require-property-name': [JSDOC_RULES_LEVEL, { contexts }], 'jsdoc/require-returns': 'off', + // this unfortunately doesn't block `fit` and `fdescribe` + 'no-only-tests/no-only-tests': ['error'], }, ignorePatterns: ['node_modules', 'dest*', 'dist', '*.js', '.eslintrc.cjs'], }; diff --git a/yarn-project/foundation/package.json b/yarn-project/foundation/package.json index 301d6507318..207c7d668a7 100644 --- a/yarn-project/foundation/package.json +++ b/yarn-project/foundation/package.json @@ -95,6 +95,7 @@ "eslint": "^8.21.0", "eslint-config-prettier": "^8.5.0", "eslint-plugin-jsdoc": "^40.1.0", + "eslint-plugin-no-only-tests": "^3.1.0", "eslint-plugin-tsdoc": "^0.2.17", "jest": "^29.5.0", "prettier": "^2.7.1", diff --git a/yarn-project/yarn.lock b/yarn-project/yarn.lock index 80cda3560f4..1da5a31e179 100644 --- a/yarn-project/yarn.lock +++ b/yarn-project/yarn.lock @@ -488,6 +488,7 @@ __metadata: eslint: ^8.21.0 eslint-config-prettier: ^8.5.0 eslint-plugin-jsdoc: ^40.1.0 + eslint-plugin-no-only-tests: ^3.1.0 eslint-plugin-tsdoc: ^0.2.17 hash.js: ^1.1.7 jest: ^29.5.0 @@ -9417,6 +9418,13 @@ __metadata: languageName: node linkType: hard +"eslint-plugin-no-only-tests@npm:^3.1.0": + version: 3.1.0 + resolution: "eslint-plugin-no-only-tests@npm:3.1.0" + checksum: 2a5de82f3a732dbd46792661dd0f8546cf819f76d8828968166dee35741e8039904ba473dafe1eed585f401a496d260c2c38354bb887c94bd4ced0ddca00fb62 + languageName: node + linkType: hard + "eslint-plugin-react-hooks@npm:^4.6.0": version: 4.6.0 resolution: "eslint-plugin-react-hooks@npm:4.6.0"