-
Notifications
You must be signed in to change notification settings - Fork 141
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
Move rules settings to ESLint shared config: refactor no-wait-for-side-effects rule #300
Conversation
@@ -96,6 +96,8 @@ export interface DetectionHelpers { | |||
isQuery: IsQueryFn; | |||
isCustomQuery: IsCustomQueryFn; | |||
isAsyncUtil: IsAsyncUtilFn; | |||
isFireEventUtil: (node: TSESTree.Identifier) => boolean; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I defined types inline here instead of extracting them. I'm not sure what was the advantage of that (not having to write it twice?) but both ways are pretty awful. I may refactor all types here to inline types.
* Reporting) | ||
* | ||
*/ | ||
function isTestingLibrarySimulateEventUtil( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Extracting generic logic from isFireEventMethod
so I can reuse it for isUserEventMethod
, which hasn't been implemented here yet but will be in the next PR. I thought I'd need it here but then I realized I wanted isUserEventUtil
instead of isUserEventMethod
.
|
||
// make sure that given node it's not fireEvent/userEvent object itself | ||
if ( | ||
[simulateEventUtilName, utilName].includes(node.name) || |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm pretty sure this could be simplified by using isTestingLibraryUtil
here but I don't want to start this refactor since it's working fine. I'll leave it for a future nice to have.
/** | ||
* Determines whether a given node is userEvent util itself or not. | ||
* | ||
* Not to be confused with {@link isUserEventMethod} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
isUserEventMethod
doesn't exist yet, but as I said it's coming in the next PR.
@@ -388,6 +394,10 @@ export function getPropertyIdentifierNode( | |||
return getPropertyIdentifierNode(node.callee); | |||
} | |||
|
|||
if (isExpressionStatement(node)) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Improving node checks here.
}); | ||
} | ||
|
||
function reportSideEffects(node: TSESTree.BlockStatement) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Seriously, I can't believe rules can be written so simple now. I want to check a beta of v4 against a real codebase as soon as possible because I can't stop thinking this can't be true and I'll find tons of edge cases which aren't covered by helpers, or everything will explode or something.
@@ -24,13 +22,6 @@ const LIBRARY_MODULES = [ | |||
'@testing-library/svelte', | |||
]; | |||
|
|||
// TODO: should be deleted after all rules are migrated to v4 | |||
const hasTestingLibraryImportModule = ( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Another one bites the dust 👋
@@ -121,7 +197,7 @@ ruleTester.run(RULE_NAME, rule, { | |||
fireEvent.keyDown(input, {key: 'ArrowDown'}) | |||
}) | |||
`, | |||
errors: [{ messageId: 'noSideEffectsWaitFor' }], | |||
errors: [{ line: 3, column: 15, messageId: 'noSideEffectsWaitFor' }], |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm thinking about making line
and column
required on our rule tester. Otherwise, just checking the messageId
can lead to brittle error reporting.
Pinging @renatoagds since he implemented the original rule for v4. |
Sorry guys. I need to merge it since there is only 1 rule to go and I'm planning to release first beta tomorrow. Anyway, don't hesitate to leave feedback so I can address it in a separate PR. |
🎉 This PR is included in version 4.0.0-beta.1 🎉 The release is available on: Your semantic-release bot 📦🚀 |
* feat: recommend prefer-screen-queries (#169) BREAKING CHANGE: `prefer-screen-queries` rule is automatically enabled if recommended, angular, react or vue config enabled. If you have any of those enabled, you could get new ESLint errors related to this rule after upgrading this plugin. * feat: recommend no-wait-for-empty-callback (#168) BREAKING CHANGE: `no-wait-for-empty-callback` rule is automatically enabled if recommended, angular, react or vue config enabled. If you have any of those enabled, you could get new ESLint errors related to this rule after upgrading this plugin. * feat(no-container): setup new rule on index * refactor(no-container): set rules * test(no-container): define scenarios * refactor(no-debug): extract auxiliary functions to node-utils, to be used by no-container * refactor(no-container): add conditional for containerIndex | clean up method declaration * docs(no-container): add new and update README * refactor(no-container): allow custom render functions * test(no-container): add custom render function * docs(no-container): update further reading topics * docs(no-container): update | add description about testing library frameworks | add link to container docs | remove recommended badge * test(no-container): add scenarios * refactor(no-container): adjust to new scenarios | update error message * docs(no-container): add incorrect use cases * refactor(no-container): remove wrong use case scenario * refactor(no-container): add scenario | destructure method from container * refactor(no-container): rename function and change its scope * refactor(no-container): remove condition * refactor(no-container): update error message and incorrect use case * feat(no-promise-in-fire-event): add new no-promise-in-fire-event rule (#180) * feat(no-promise-in-fire-event): add new no-promise-in-fire-event rule * test: 100% code coverage * docs: add rule to readme * chore: review changes * chore: add rule to recommended config * refactor: rename recommended config to dom (#184) BREAKING CHANGE: `recommended` config preset has been renamed to `dom`, so make sure to update it in your ESLint config file if you were using `recommended` preset. * feat: add rule no-multiple-assertions-wait-for (#189) * feat: add initial files for no-multiple-expect-wait-for rule * fix: add expect fields in test * feat: add no-multiple-assertion-wait-for logic * feat: add findClosestCalleName in node-utils * feat: add check for expect and rename file * docs: add no-multiple-assertions-wait-for rule doc * docs: add link for no-multiple-assertions-wait-for doc * docs: insert function example in no-multiple-assertions-wait-for * refactor: remove find closest call node from node-utils * fix: check expect based in total * docs: better english in no-multiple-assertions-wait-for rule details Co-authored-by: Tim Deschryver <28659384+timdeschryver@users.noreply.github.com> * fix: use correct rule name in no-multiple-assertions-wait-for Co-authored-by: Tim Deschryver <28659384+timdeschryver@users.noreply.github.com> * docs: improve docs for no-multiple-assertions-wait-for * fix: typo in no-multiple-assertions-wait-for * fix: better english in no-multiple-assertions-wait-for Co-authored-by: Tim Deschryver <28659384+timdeschryver@users.noreply.github.com> * feat: add no-node-access rule (#190) * refactor(utils): add properties and methods that returns another Node * test(no-node-access): add first scenarios * feat(no-node-access): add rule with few test cases * test(no-node-access): add scenarios * refactor(no-node-access): simplify conditions * refactor(no-node-access): add scenario when no variable is declared * refactor(no-node-access): remove conditional * refactor(utils): add DOM properties * refactor(no-node-access): add scenario for accessing document directly * docs(no-node-access): add readme * refactor(utils): export const containing all properties and methods that return a Node * docs(no-node-access): fix file location * docs(readme): add no-node-access * refactor(no-node-access): change highlight location * docs(no-node-access): fix typo * refactor(utils): add missing property that returns a Node * refactor(no-node-access): simplify checks triggering error for all methods with names matching the forbidden ones * test(no-node-access): add more scenarios with destructuring * docs(no-node-access): update examples * refactor(no-node-access): narrow error cases * refactor(no-node-access): check imports to validate whether is importing a testing-library package | update examples and testing scenarios * refactor(no-node-access): rename variable * feat: add prefer-user-event rule (#192) * feat: add render-result-naming-convention rule (#200) * feat: rule skeleton * test: first round * feat: rule implementation round 1 * refactor: move hasTestingLibraryImportModule * test: fix invalid lines * feat: check imported module * feat: check imported render renamed * feat: check custom render * test: add more valid tests for custom render functions * test: update tests for render wrapper functions * docs: add rule docs * test: increase coverage up to 100% * fix: add rule meta description * docs: update rule details to mention screen object * refactor: return as soon as conditions are not met * feat: check wildcard imports * refactor: rename default import * docs: include render result link * feat: add no-side-effects-wait-for rule (#196) * test: add scenarios for no-side-effects-wait-for * feat: add no-side-effects-wait-for rule * feat: add no-side-effects-wait-for in index * test: add more valid scenarios in no-side-effects-wait-for * docs: include no-side-effects-wait-for * fix: typo in no-side-effects-wait-for doc Co-authored-by: Gonzalo D'Elia <gonzalo.n.delia@gmail.com> * fix: remove extra code in examples * refactor: use some instead filter in no-side-effects-wait-for * feat: check if no-side-effects-wait-for is called inside tests * refactor: use util for import check at no-side-effects-wait-for * test: valid scenario for no TL wait for import at no-side-effects * refactor: usage of correct user event methods Co-authored-by: Gonzalo D'Elia <gonzalo.n.delia@gmail.com> * chore: lint and format on pre-commit and ci (#216) * chore: lint and format on pre-commit and ci * chore: changing stage name in travis ci conf * chore: merge master into v4 (#233) * feat(prefer-explicit-assert): add 'assertion' config option (#220) Closes #218 * docs: add skovy as a contributor (#221) * docs: update README.md [skip ci] * docs: update .all-contributorsrc [skip ci] Co-authored-by: allcontributors[bot] <46447321+allcontributors[bot]@users.noreply.github.com> * feat: new no-wait-for-snapshot rule (#223) Closes: #214 * docs: add Gpx as a contributor [skip ci] (#224) * docs: update README.md [skip ci] * docs: update .all-contributorsrc [skip ci] Co-authored-by: allcontributors[bot] <46447321+allcontributors[bot]@users.noreply.github.com> * docs(no-wait-for-snapshot): fix link to rule doc (#225) * docs: add jdanil as a contributor [skip ci] (#226) * docs: update README.md [skip ci] * docs: update .all-contributorsrc [skip ci] Co-authored-by: allcontributors[bot] <46447321+allcontributors[bot]@users.noreply.github.com> * Update .travis.yml * feat: support ESLint 7.x (#139) Closes #138 * docs: add MichaelDeBoey as a contributor [skip ci] (#231) * docs: update README.md [skip ci] * docs: update .all-contributorsrc [skip ci] Co-authored-by: allcontributors[bot] <46447321+allcontributors[bot]@users.noreply.github.com> * chore: update dependencies + run prettier on codebase (#232) * chore: update dependencies * chore: run Prettier on full codebase Co-authored-by: Spencer Miskoviak <5247455+skovy@users.noreply.github.com> Co-authored-by: allcontributors[bot] <46447321+allcontributors[bot]@users.noreply.github.com> Co-authored-by: Giorgio Polvara <polvara@gmail.com> Co-authored-by: Josh David <joshua.david@uqconnect.edu.au> Co-authored-by: Mario Beltrán Alarcón <belco90@gmail.com> * chore: update dependencies + run prettier on codebase (#234) BREAKING CHANGE: Minimum node version required is v10.22.1 BREAKING CHANGE: Minimum ESLint version required is 7.5.0. Support for ESLint between v5 and v7.4 has been dropped * style: apply prettier after merge * refactor(no-node-access): use new testing library rule maker (#237) * build: add npmrc file Adding .npmrc file to indicate we don't want to generate package-lock properly. * refactor: first approach for testing library detection * refactor: move testing library detection to high-order function * refactor: include create-testing-library-rule * refactor(no-node-access): use create-testing-library-rule * test: decrease coverage threshold for utils detection * test: decrease coverage threshold for utils detection branches * style: add missing return type on function * style: format with prettier properly Apparently the regexp for formatting the files within npm command must be passed with double quotes. More details here: https://dev.to/gruckion/comment/b665 * docs: copied types clarification * refactor: improve logic to detect if testing librar imported (#239) * refactor: check testing library imports automatically * feat: add new shared setting for testing library module * test: increase coverage for create testing library rule * refactor: extract common enhanced rule create types * docs: add jsdoc to detection helpers * docs: update old comments related to ImportDeclaration * test: check rule listener are combined properly * feat: new setting for reported filename pattern (#244) * feat: new setting for customizing file name pattern to report * test: add custom rule tester for testing library * refactor: use common rule tester config * refactor(no-dom-import): use createTestingLibraryRule (#247) * feat: new setting for customizing file name pattern to report * test: add custom rule tester for testing library * refactor: use common rule tester config * refactor(no-dom-import): use createTestingLibraryRule * feat(detection-helpers): check imports with require * test(no-dom-import): include test cases for custom module setting * test(no-dom-import): include test cases for custom module setting * chore: fix merge * refactor(no-dom-import): extract detection helpers for import nodes * test: increase coverage * refactor: rename setting for filename pattern * docs(consistent-data-testid): add clarification about rule creation (#248) * feat: new setting for customizing file name pattern to report * test: add custom rule tester for testing library * refactor: use common rule tester config * refactor(no-dom-import): use createTestingLibraryRule * feat(detection-helpers): check imports with require * test(no-dom-import): include test cases for custom module setting * test(no-dom-import): include test cases for custom module setting * chore: fix merge * refactor(no-dom-import): extract detection helpers for import nodes * test: increase coverage * refactor: rename setting for filename pattern * refactor: add new detection option to skip reporting checks * refactor(consistent-data-testid): use createTestingLibraryRule * revert: refactor consistent-data-testid * revert: detection options * docs(consistent-data-testid): add clarification about rule creation * refactor(no-manual-cleanup): use custom rule creator (#249) * refactor(no-manual-cleanup): use custom rule creator * refactor: extract detection utils for import module name * refactor(no-manual-cleanup): use detection helpers for imported modules * refactor(no-manual-cleanup): small improvements * test(no-manual-cleanup): include more variants * feat(no-manual-cleanup): report custom module * refactor: rename type for import module node * refactor: use node utils to know node type * refactor: remove unused imports * refactor: remove outdated comment line * refactor(prefer-user-event): use new custom rule creator (#251) * feat: add new settings for prefer-user-event pt1 * feat: part2 of refactoring user event. improved docs * test: improved coverage for prefer-user-event. applied feedback * refactor(prefer-presence-queries): use custom rule creator (#252) * test(prefer-presence-queries): improve existing invalid tests * refactor(prefer-presence-queries): use custom rule creator * feat(prefer-presence-queries): use aggressive query reporting * refactor(prefer-presence-queries): rename message ids * test: add fake rule tests for queries * refactor(extract helpers for detecting presence/absence assets): add fake rule tests for queries * refactor(prefer-presence-queries): use presence/absence helpers * refactor: simplify negated matcher condition * style: format files after rebase * refactor: detection helpers tweaks (#254) * refactor(extract helpers for detecting presence/absence assets): add fake rule tests for queries * refactor(prefer-presence-queries): use presence/absence helpers * refactor: rename boolean detection helpers * refactor: create helpers as separated functions * refactor(ast-utils): migrate custom node-utils to ASTUtils (#256) Closes #253 * refactor(ast-utils): remove isIdentifier * refactor(ast-utils): migrate isAwaitExpression * refactor(ast-utils): use optional chaining for consistency * chore: decrease node-utils coverage threshold * refactor(prefer-wait-for): use new custom rule creator (#255) * refactor: prefer-wait-for with the new settings * refactor: generalized util method * refactor: applied feedback from pr * test: improve coverage * refactor: use custom rule creator for promise-queries rules (#260) * refactor(no-await-sync-query): use custom rule creator * refactor(no-await-sync-query): improve error message * test(no-await-sync-query): check error location in invalid cases * refactor(no-await-sync-query): catch sync queries with detection helper * test(no-await-sync-query): use more realistic scenarios * test(no-await-sync-query): add more cases for custom queries and settings * refactor(await-async-query): use custom rule creator * refactor(await-async-query): improve error message * feat: new detection helpers for findBy queries * refactor(await-async-query): detection helpers + aggressive reporting * test(await-async-query): add cases for custom queries * test(await-async-query): add more cases for custom queries * test(await-async-query): check errors locations * test(await-async-query): mix built-in and custom queries * test(await-async-query): non-matching query case * feat(await-async-query): report query wrappers * refactor(await-async-query): extract ast utils for functions * test(await-async-query): cases for arrow functions * refactor(await-async-query): extract ast util for promise handled * test(await-async-query): increase coverage * refactor(await-async-query): rename isPromiseResolved to hasChainedThen * docs(await-async-query): update rule description and examples * docs(await-async-query): minor improvements * refactor: minor type fix * docs(await-async-query): more fixes * docs(await-async-query): wrong return type * refactor(await-async-query): check regex more efficiently * refactor(await-async-utils): use custom rule creator (#263) * refactor: extract utils for checking promise all methods * test(await-async-query): add cases for promise all and allSettled * docs(await-async-query): add cases for promise all and allSettled * refactor(await-async-utils): create rule with custom creator * refactor(await-async-utils): replace async utils regexp by method * refactor(await-async-utils): replace manual import checks by helper * refactor(await-async-utils): replace manual promise checks by util * refactor(await-async-utils): merge identifier and member expression nodes checks * test(await-async-query): check column on invalid cases * test(await-async-query): promise.allSettled cases * refactor(await-async-query): extract util to get innermost returning function name * feat(await-async-utils): report unhandled functions wrapping async utils * docs: minor improvements * test(await-async-utils): increase coverage * refactor: repurpose getInnermostReturningFunctionName to getInnermostReturningFunction * refactor(await-fire-event): use custom rule creator (#265) * refactor(await-async-utils): create rule with custom creator * docs(await-fire-event): update description * refactor(await-fire-event): create rule with custom creator * refactor(await-fire-event): replace manual promise checks by util * refactor: simplify isNodeComingFromTestingLibrary * fix: call findClosestCallExpressionNode recursively keeping args * refactor(prefer-user-event): extract fire event helpers * refactor(await-async-utils): remove unnecessary as expression * refactor(await-fire-event): reuse fire event detection helpers * feat(await-fire-event): detect functions wrapping fire event methods * fix(await-fire-event): detect more cases * test(await-fire-event): increase coverage * docs(await-fire-event): update rule details and examples * test(await-async-utils): remove outdated comment * docs(await-fire-event): update async note * style(await-fire-event): format rule doc * refactor(await-fire-event): remove unnecessary check * refactor(no-promise-in-fire-event): use custom rule creator (#266) * refactor(await-async-utils): create rule with custom creator * test(await-async-utils): remove outdated comment * docs(no-promise-in-fire-event): improve description and examples * docs(no-promise-in-fire-event): improve invalid errors checks * refactor(no-promise-in-fire-event): use custom rule creator and helpers * feat(no-promise-in-fire-event): detect promise in variable references * docs(no-promise-in-fire-event): update examples * test(no-promise-in-fire-event): increase coverage up to 100% * refactor(no-wait-for-snapshot) migrate to v4 (#271) * refactor: migrate no-wait-for-snapshot to v4 * refactor: apply pr suggestions * refactor(prefer-find-by) migrate to v4 (#270) * refactor: migrate prefer-find-by to v4 * refactor: applied pr suggestions * refactor(prefer-explicit-assert): use new utils and remove custom query option (#274) * refactor(prefer-explicit-assert): use new utils and remove custom query option * test: add custom query method * fix(no-await-sync-query): avoid reporting queries if not within callee (#278) Fixes #276 * refactor: remove duplicated param type * refactor: rename helpers for determining query variants * refactor(render-result-naming-convention): migrate to v4 (#280) * docs: add comments to main parts to be modified * refactor(render-result-naming-convention): first approach for new helper First implementation of isRenderUtil helper, and use it within this rule. * refactor(aggressive-render): update criteria to consider valid renders Before, it was checking if the name of the method started by "render". Now, it checks if the name of the method contains render. * feat(aggressive-render): keep aggressive module reporting in mind Depending on aggressive module reporting, isRenderUtil needs to check if node comes from valid Testing Library module or not. * test(render-result-naming-convention): move valid to invalid tests * docs(aggressive-reporting): improve jsdocs * test(create-testing-library-rule): cases for render * refactor: second round of tweaks (#281) * refactor(shared-settings): rename utils-module Rename testing-library/module to testing-library/utils-module * refactor(detection-helpers): improve fn type definitions * test(filename-pattern): simplify settings patterns * fix: check member expression properly within isRenderUtil helper * test: improve create-testing-library-rule test cases * refactor: check if coming from Testing Library within isAsyncUtil * refactor: extract common method for determining if node is TL util * refactor: improve TL util node detection from identifier * refactor: rename getIdentifierNode to clarify its behavior * fix: improve check for determining if node coming from TL * test: add async util test cases to fake rule * docs: format jsdoc * refactor(render-result-naming-convention): refine checks to decide if coming from Testing Library (#282) * feat(render-result-naming-convention): detect render calls from wrappers * fix: check imported node properly when specifiers are renamed ImportNamespaceSpecifier had to be checked properly in order to detect rename imports properly like: import { a as b } from 'foo' * refactor: split checks for import matching node name in different methods * test(render-result-naming-convention): add extra invalid case for wrapped function * fix(render-result-naming-convention): cover more renamed imports * ci: update pipeline with v4 changes (#289) * ci: migrate to GitHub Actions (#286) * ci: schedule github actions updates * ci: add github actions release workflow * ci: remove config related to travis * ci: split workflows * ci: use action for installing dependencies * ci: remove lint max warnings * ci: improve scripts * ci: remove format check * ci: install dependencies with npm * ci: revert - install dependencies with npm * ci: install dependencies manually on test step * ci: set ci env var on install step * ci: install peer deps in legacy mode * ci: revert manual deps install * ci: remove node 15 * ci: update badge in README.md Closes #275 * ci: github actions improvements (#288) * chore: fix scripts related to testing * ci: bump checkout action to v2 * ci: merge workflows files into single one * ci: add a step for canceling previous runs * ci: remove workflow run conditions * ci: rename workflow * ci: update github actions with v4 CI changes * chore: bump dependencies to last minor * chore: setting test environment to jest-environment-jsdom v25 I had to downgrade jsdom because of some errors jsdom v16 was causing when running tests in node v10. Apparently, jsdom v16 is compatible with node v10, so I'm not sure why is causing an issue. This can be removed when dropping support for node v10. * refactor(prefer-screen-queries): migrate to v4 (#285) * refactor(prefer-screen-queries): use new rule creator * refactor(prefer-screen-queries): detect render methods with helper * refactor(prefer-screen-queries): detect queries with helper * fix(prefer-screen-queries): detect queries coming from proper render * chore: update dependencies (#290) * refactor(no-wait-for-empty-callback): migrate to v4 (#284) * refactor(no-wait-for-empty-callback): use new rule creator and helpers * test(no-wait-for-empty-callback): improve invalid asserts * test(no-wait-for-empty-callback): increase rule coverage * refactor: improve valid names definition (PR suggestions) * refactor(refactor no-debug): migrate to v4 (#293) * refactor(no-debug): use new rule creator * test(no-debug): improve current invalid error assertions * docs(no-debug): fix typo * refactor(no-debug): report debug call expressions with detection helpers * refactor(no-debug): report debug from renders with detection helpers * refactor(no-debug): remove unnecessary checks * refactor(no-container): migrate to v4 (#295) * docs(no-container): remove custom render reference * test(no-container): improve errors asserts * refactor(no-container): use new rule creator * refactor(no-container): extract isRenderVariableDeclarator helper * refactor(no-container): improve node reported location * refactor(no-container): detect nodes coming from render wrapper * refactor(no-debug): detect nodes coming from render wrapper * refactor: remove mechanism to match files to be reported (#297) * refactor(no-render-in-setup): migrate to v4 (#299) * docs: update rule description - remove references "renderFunctions" rule option - improve examples * test: improve errors location asserts * refactor: use new rule creator * docs: update error message and description * refactor(no-debug): remove option schema leftover * refactor: remove custom render option in favor of helper * refactor: improve error reported location * feat: detect wrapper functions around render * refactor: improve utils types * refactor: remove unused node util * test: improve test cases * refacto(no-wait-for-side-effects): migrate to v4 (#300) * test: improve errors location asserts * refactor: use new rule creator * refactor: improve error reported location * refactor: use new helpers for detection * test: add more cases * feat: detect properly if fireEvent and userEvent should be reported * test: add cases for increasing coverage up to 100% * refactor: rename rule for consistency * docs: remove duplicated no-wait-for-snapshot row * fix: get identifier node simpler * refactor(no-wait-for-multiple-assertions): migrate to v4 (#301) * test: improve errors location asserts * refactor: use new rule creator * refactor: improve error reported location * refactor: use new helpers for detection * test: add more cases * feat: detect properly if fireEvent and userEvent should be reported * test: add cases for increasing coverage up to 100% * refactor: rename rule for consistency * docs: remove duplicated no-wait-for-snapshot row * refactor: rename rule * test: improve errors location asserts * refactor: use new rule creator * refactor: use new helpers for detection * refactor: improve error reported location * test: add more cases * refactor(no-await-sync-events): migrate to v4 (#302) * docs: update rule description * test: improve current cases * refactor: use new rule creator * feat: avoid reporting type and keyboard with 0 delay * refactor: use new helpers for detection * test: split fire and user events cases * test: improve errors location asserts * feat: detect user-event import properly * test: add cases for increasing coverage up to 100% * test: assert error message data * refactor: cleanup after migrating all rules to v4 (#303) * docs: update rule description * test: improve current cases * refactor: use new rule creator * feat: avoid reporting type and keyboard with 0 delay * refactor: use new helpers for detection * test: split fire and user events cases * test: improve errors location asserts * feat: detect user-event import properly * test: add cases for increasing coverage up to 100% * test: assert error message data * test: set final threshold for node-utils * chore: extract semantic release config to its own file * docs: including testing-library prefix in all rules * docs: including testing-library rule prefix in README * fix(await-async-utils): reference correct node name * fix(prefer-find-by): simplify error message * fix(no-await-sync-query): avoid false positive from parent func * test(no-await-sync-query): increase code coverage up to 100% * feat(no-wait-for-multiple-assertions): report assertions * test(no-wait-for-multiple-assertions): increase code coverage up to 100% * fix(no-wait-for-side-effects): report on each side effect node * test(no-await-sync-query): include extra case for disappearance * fix: guard against null deepest identifier node * fix: guard against null property identifier node * ci: decrease coverage threshold * fix: enable TS strict mode * fix: remove closing comment leftover * refactor: declare test cases typings as expected * fix: remove wrong boolean check for detection * fix(prefer-user-event): format list of userEvent methods correctly (#311) * fix(prefer-user-event): format list of userEvent methods correctly * test(prefer-user-event): check error data in all invalid cases Closes #310 * fix: second round of bugfixes for v4 (#314) * fix: handle require without assignment properly * fix: handle another require without assignment properly * fix: update rule levels on presets - remove prefer-user-event from presets - report no-debug as error on presets * docs: indicate prefer-user-event is not enabled in any preset Closes #313 * docs: add guide for migrating to v4 (#312) * docs: first steps for migrating to v4 guide * docs: extract Aggressive Reporting Query info to its own section * docs: explain Aggressive Reporting motivation and mechanism * docs: describe each aggressive reporting mechanism * docs: shared settings * docs: update info related to Shareable Configs updated * docs: fix typo * docs: fix more typos * docs: replace tho by though * docs: fix wrong new lines entered * ci: remove duplicated max-warnings param * docs: update README for v4 (#317) * docs: update README for v4 * docs: move detailed settings to migratuin guide * docs: format md files with prettier * chore: update dependencies (#319) * fix: third round of bug fixes (#320) * fix(prefer-screen-queries): improve error message * chore: update package keywords Closes #318 * docs: update contributing guidelines to v4 (#321) * docs: update contributing guidelines to v4 * docs: contributing guidelines PR suggestion Co-authored-by: Michaël De Boey <info@michaeldeboey.be> * docs: more contributing guidelines PR suggestions Co-authored-by: Michaël De Boey <info@michaeldeboey.be> Co-authored-by: Michaël De Boey <info@michaeldeboey.be> * ci: remove unnecessary quote marks for node versions Co-authored-by: Michaël De Boey <info@michaeldeboey.be> * Revert "ci: remove unnecessary quote marks for node versions" This reverts commit b150663 * chore: revert node 10.22.1 as minimum version Minimum node version required for using the plugin is still 10.12 but it was up to 10.22.1 because of a dev dependency. This won't affect usages of the plugin so I'm reverting it. More details here: #234 * ci: include 12.0 in node versions matrix * ci: wrap matrix values within quotes Co-authored-by: Nick McCurdy <nick@nickmccurdy.com> Co-authored-by: Mateus Felix <mateus.felix@c6bank.com> Co-authored-by: Mateus Felix <mateus.cfoliveira@gmail.com> Co-authored-by: Tim Deschryver <28659384+timdeschryver@users.noreply.github.com> Co-authored-by: Gonzalo D'Elia <gonzalo.n.delia@gmail.com> Co-authored-by: Renato Augusto Gama dos Santos <renato_0603@hotmail.com> Co-authored-by: Michaël De Boey <info@michaeldeboey.be> Co-authored-by: Spencer Miskoviak <5247455+skovy@users.noreply.github.com> Co-authored-by: allcontributors[bot] <46447321+allcontributors[bot]@users.noreply.github.com> Co-authored-by: Giorgio Polvara <polvara@gmail.com> Co-authored-by: Josh David <joshua.david@uqconnect.edu.au> Co-authored-by: Thomas Lombart <thomas.lombart@hey.com>
🎉 This PR is included in version 4.0.0 🎉 The release is available on: Your semantic-release bot 📦🚀 |
Relates to #198
This refactor for
no-wait-for-side-effects
includes:waitFor
ones follow the<prefix>-wait-for-<suffix>
patternwaitFor
,fireEvent
anduserEvent
are coming from Testing Library valid module