Skip to content

Commit

Permalink
feat(eslint): enable additional Jest style rules
Browse files Browse the repository at this point in the history
Resolves #29
  • Loading branch information
mrmckeb committed Sep 21, 2022
1 parent 65f2cc9 commit db9e8ab
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 0 deletions.
1 change: 1 addition & 0 deletions eslint/jest.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ module.exports = {
// We may want to separate this out in future, as it's only needed when
// using React with Testing Library.
'plugin:testing-library/react',
require.resolve('./rules/jest'),
],
rules: {
// Prefer the Jest version of this rule.
Expand Down
22 changes: 22 additions & 0 deletions eslint/rules/jest.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
module.exports = {
rules: {
/**
* Disallow duplicate setup and teardown hooks.
*
* 🚫 Not fixable - https://github.com/jest-community/eslint-plugin-jest/blob/main/docs/rules/no-duplicate-hooks.md
*/
'jest/no-duplicate-hooks': 'error',
/**
* Require lowercase test names.
*
* 🔧 Fixable - https://github.com/jest-community/eslint-plugin-jest/blob/main/docs/rules/prefer-lowercase-title.md
*/
'jest/prefer-lowercase-title': 'warn',
/**
* Require test cases and hooks to be inside a `describe` block.
*
* 🚫 Not fixable - https://github.com/jest-community/eslint-plugin-jest/blob/main/docs/rules/require-top-level-describe.md
*/
'jest/require-top-level-describe': 'error',
},
};

0 comments on commit db9e8ab

Please sign in to comment.