Skip to content

Commit

Permalink
meta: disallow use of .only in tests (#4494)
Browse files Browse the repository at this point in the history
It is useful for local testing, but should never be committed. This lint
rule should help catch that during code reviews.
  • Loading branch information
aduh95 authored Jun 15, 2023
1 parent f07697e commit 71e3f06
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 1 deletion.
8 changes: 7 additions & 1 deletion .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ module.exports = {
// extra:
'compat',
'jsdoc',
'no-only-tests',
'unicorn',
],
parser: '@babel/eslint-parser',
Expand Down Expand Up @@ -496,7 +497,12 @@ module.exports = {
},
{
files: ['e2e/**/*.ts', 'e2e/**/*.js', 'e2e/**/*.jsx', 'e2e/**/*.mjs'],
rules: { 'import/no-extraneous-dependencies': 'off', 'no-unused-expressions': 'off', 'no-console': 'off' },
rules: {
'import/no-extraneous-dependencies': 'off',
'no-console': 'off',
'no-only-tests/no-only-tests': 'error',
'no-unused-expressions': 'off',
},
},
],
}
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@
"eslint-plugin-jsdoc": "^40.0.0",
"eslint-plugin-jsx-a11y": "^6.4.1",
"eslint-plugin-markdown": "^3.0.0",
"eslint-plugin-no-only-tests": "^3.1.0",
"eslint-plugin-node": "^11.1.0",
"eslint-plugin-prefer-import": "^0.0.1",
"eslint-plugin-promise": "^6.0.0",
Expand Down
8 changes: 8 additions & 0 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -8721,6 +8721,7 @@ __metadata:
eslint-plugin-jsdoc: ^40.0.0
eslint-plugin-jsx-a11y: ^6.4.1
eslint-plugin-markdown: ^3.0.0
eslint-plugin-no-only-tests: ^3.1.0
eslint-plugin-node: ^11.1.0
eslint-plugin-prefer-import: ^0.0.1
eslint-plugin-promise: ^6.0.0
Expand Down Expand Up @@ -16853,6 +16854,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-node@npm:^11.1.0":
version: 11.1.0
resolution: "eslint-plugin-node@npm:11.1.0"
Expand Down

0 comments on commit 71e3f06

Please sign in to comment.