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

Implement a linting rule to discourage using waitForTimeout for new usages #17915

Merged
merged 1 commit into from
Apr 11, 2024

Conversation

timvandermeij
Copy link
Contributor

@timvandermeij timvandermeij commented Apr 9, 2024

The waitForTimeout function should not be used anymore and only exists for old usages that have to be rewritten, but there was nothing in place to signal this. This commit therefore implements a linting rule, specific to the integration tests, to make it clear that this function should no longer be used. We exclude the old usages from it because we are already tracking those in #17656 (so this patch is mostly to not make the scope of that issue bigger).

For completeness, if we now use waitForTimeout without an explicit ESLint disable line the following output is printed and linting fails:

### Linting JS/CSS/JSON files

test/integration/freetext_editor_spec.mjs
  61:9  error  `waitForTimeout` can cause intermittent failures and should not be used (see issue #17656 for replacements)  no-restricted-syntax

✖ 1 problem (1 error, 0 warnings)

… tests

The `waitForTimeout` function should not be used anymore and only exists
for old usages that have to be rewritten, but there was nothing in place
to signal this. This commit therefore implements a linting rule, specific
to the integration tests, to make it clear that this function should no
longer be used. We exclude the old usages from it because we are already
tracking those in mozilla#17656 (so this patch is mostly to not make the scope
of that issue bigger).
@timvandermeij timvandermeij changed the title Implement a linting rule to discourage using waitForTimeout for new… Implement a linting rule to discourage using waitForTimeout for new usages Apr 9, 2024
Copy link
Collaborator

@Snuffleupagus Snuffleupagus left a comment

Choose a reason for hiding this comment

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

r=me, thanks.

@timvandermeij timvandermeij merged commit d70caca into mozilla:master Apr 11, 2024
7 checks passed
@timvandermeij timvandermeij deleted the lint-waitfortimeout branch April 11, 2024 10:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants