Skip to content

Commit

Permalink
Turn off 2 rules (#12)
Browse files Browse the repository at this point in the history
* Turn off two rules

- jest/prefer-importing-jest-globals
- unicorn/prefer-string-raw

* Sort jest rules
  • Loading branch information
dcroote authored Jun 26, 2024
1 parent c658f4b commit 15a2623
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 5 deletions.
11 changes: 6 additions & 5 deletions src/jest.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,18 +18,19 @@ module.exports = {
plugins: ['jest'],
extends: ['plugin:jest/recommended', 'plugin:jest-formatting/recommended'],
rules: {
'jest/prefer-expect-assertions': 'off', // While useful, enforcing this can lead to verbose tests.
'jest/prefer-each': 'off', // We find traditional for-loops more readable in certain contexts.
'jest/require-top-level-describe': 'off', // Multiple top-level describe blocks or tests can be acceptable.
'jest/max-expects': 'off', // Limiting expect statements is beneficial, but enforcing a strict count can be restrictive.
'jest/valid-title': 'off', // This restriction can prevent using titles like "<function-name>.name".
'jest/no-hooks': [
'error', // We advocate for setup functions over beforeXXX hooks. However, afterXyz hooks are sometimes indispensable, like for resetting Jest timers. See: https://kentcdodds.com/blog/avoid-nesting-when-youre-testing#inline-it.
{
allow: ['afterEach', 'afterAll'],
},
],
'prefer-lowercase-title': 'off', // Sometimes we want to start the test with a capital letter and some words are all uppercase (e.g. AWS).
'jest/prefer-each': 'off', // We find traditional for-loops more readable in certain contexts.
'jest/prefer-expect-assertions': 'off', // While useful, enforcing this can lead to verbose tests.
'jest/prefer-importing-jest-globals': 'off', // This would be very bothersome for existing repos.
'jest/require-top-level-describe': 'off', // Multiple top-level describe blocks or tests can be acceptable.
'jest/valid-title': 'off', // This restriction can prevent using titles like "<function-name>.name".
'prefer-lowercase-title': 'off', // Sometimes we want to start the test with a capital letter and some words are all uppercase (e.g. AWS).,
},
},
],
Expand Down
1 change: 1 addition & 0 deletions src/universal.js
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,7 @@ module.exports = {
'unicorn/no-object-as-default-parameter': 'off', // Too restrictive. TypeScript can ensure that the default value matches the type.
'unicorn/no-useless-undefined': ['error', { checkArguments: false }], // We need to disable "checkArguments", because if a function expects a value of type "T | undefined" the undefined value needs to be passed explicitly.
'unicorn/prefer-module': 'off', // We use CJS for configuration files and tests. There is no rush to migrate to ESM and the configuration files are probably not yet ready for ESM yet.
'unicorn/prefer-string-raw': 'off', // We commonly escape \ in strings.
'unicorn/prevent-abbreviations': 'off', // This rule reports many false positives and leads to more verbose code.

/* Rule overrides for "import" plugin */
Expand Down

0 comments on commit 15a2623

Please sign in to comment.