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

Add require-assertion rule #336

Merged
merged 1 commit into from
Sep 13, 2023
Merged

Conversation

backspace
Copy link
Contributor

This is a possible solution to close #335, I made some editorial choices that I’m not attached to:

  1. It doesn’t validate that the assertion function called actually exists in the API, would this be a useful addition?
  2. For the name, I noticed some rule names in eslint-plugin-ember that started with require-, it seemed the best match.
  3. Autofix appends .exists() which I believe to be the assertion implied by a standalone call to assert.dom(…), but maybe autofix isn’t even advisable in this case?

The AST checks I used work for the test cases but I’m not that experienced in this realm so let me know if there are more assertions to add that would correct flaws in the selector or conditional.

@Turbo87 Turbo87 added the enhancement New feature or request label Aug 28, 2023
Copy link
Collaborator

@Turbo87 Turbo87 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  1. It doesn’t validate that the assertion function called actually exists in the API, would this be a useful addition?

I guess that should probably be implemented in a dedicated rule, if necessary

  1. Autofix appends .exists() which I believe to be the assertion implied by a standalone call to assert.dom(…), but maybe autofix isn’t even advisable in this case?

yeah, I was wondering the same thing, but I think I'm okay with using exists() as the default in this case.

@Turbo87
Copy link
Collaborator

Turbo87 commented Aug 28, 2023

looks like prettier is still a bit unhappy about the formatting... 😅

@backspace
Copy link
Contributor Author

looks like prettier is still a bit unhappy about the formatting... 😅

oh yes 😬 I’ve force-pushed the fixes there, thanks!

@backspace
Copy link
Contributor Author

Anything else needed? 🤞🏻

@Turbo87 Turbo87 merged commit 5c8d3d9 into mainmatter:main Sep 13, 2023
@Turbo87
Copy link
Collaborator

Turbo87 commented Sep 13, 2023

sorry, forgot about this

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Rule against assert.dom() with no assertions?
2 participants