Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[prefer-hooks-on-top]: allow enforcing order of hooks #992

Closed
dkMorlok opened this issue Nov 29, 2021 · 4 comments · Fixed by #1098
Closed

[prefer-hooks-on-top]: allow enforcing order of hooks #992

dkMorlok opened this issue Nov 29, 2021 · 4 comments · Fixed by #1098

Comments

@dkMorlok
Copy link

I using this rule https://github.com/jest-community/eslint-plugin-jest/blob/main/docs/rules/prefer-hooks-on-top.md

Would be nice have possibility to specify exact order for hooks, for example:
order: ['beforeAll', 'beforeEach', 'afterEach', 'afterAll']

@G-Rath G-Rath changed the title Future request: hooks on top with specified order [prefer-hooks-on-top]: allow enforcing order of hooks Nov 29, 2021
@G-Rath
Copy link
Collaborator

G-Rath commented Jan 1, 2022

I'm thinking this might be better as it's own rule... 🤔

@aaron012
Copy link
Contributor

aaron012 commented May 3, 2022

Hi @G-Rath, I am interested in having this as a separate rule as well. Would you accept a pull request to add this? I have made a basic version locally and I can continue my work on it to create a pull request.

@G-Rath
Copy link
Collaborator

G-Rath commented May 3, 2022

@aaron012 go for it! I made a start implementing this as prefer-hooks-in-order but didn't get around to finishing it - the branch is here if you want to use it (it's already got the documentation written, and the tests could be useful)

@github-actions
Copy link

🎉 This issue has been resolved in version 26.3.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants