Version Packages - #62
Merged
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR was opened by the Changesets release GitHub action. When you're ready to do a release, you can merge this and the packages will be published to npm automatically. If you're not ready to do a release yet, that's fine, whenever you add more changesets to main, this PR will be updated.
Releases
@noctcore/eslint-plugin-code-quality@0.4.1
Patch Changes
#61
9f24ad7Thanks @Shironex! - Close four gaps in the test-discipline rules and fix a crash.A project that spreads
recommendedas-is sees no new errors. The only rule here that is inrecommended,no-vacuous-expect, reports less than before. The other three rules are opt-in, and a project that enabled them can see new errors:typed-mock-over-double-castnow sees a mock that was created first and put in the object by name:const fn = vi.fn(); const svc = { fn } as unknown as Service;, also as{ run: fn }, nested in an inner object, through a chain (jest.fn().mockResolvedValue(...)) and when the name is assigned its mock later (let get; beforeEach(() => { get = jest.fn(); })). A mock that arrives through a spread, an import, a parameter or a helper's return value is still not followed.no-message-only-throw-assertionnow reads a message held in a variable:const expected = /no access/; expect(run).toThrow(expected)is a message check, for a string, a template, a regex literal ornew RegExp(...), as long as the variable is initialised where it is declared and never assigned again. Such a variable no longer counts as a class pin for a later message check on the same subject either. An import, a parameter and a call result are still read as an error class.no-sleep-in-unit-testsno longer exempts a whole file because one test fakes its timers. AfakeTimerMethodscall now covers the test it is in, else thedescribeit is in (directly or in abeforeEach/beforeAll), else the whole file, so a file that installs fake timers at the top level behaves as before. A real sleep in a sibling test or suite is reported. A sleep helper defined in the file is judged by its callers: it stays silent when every call to it runs under fake timers.Reports less:
no-vacuous-expectno longer treats acontainer/baseElementfrom any call as a render root. A root from arender*call still counts for every presence check. A root from another call (setup(),docker.inspect(id)) counts only when the assertion is DOM-specific: it readsfirstChild,innerHTMLand the like off the root, or usestoBeInTheDocument,toBeVisibleornot.toBeEmptyDOMElement. Soconst { container } = await docker.inspect(id); expect(container).not.toBeNull();is accepted, and so is the same check on the root of a render helper whose name does not start withrender. A weak matcher there (toBeTruthy,toBeDefined) is still reported, assoleWeakExpect.Crash fixed:
no-sleep-in-unit-teststhrewCannot read properties of null (reading 'type')on asetTimeout(...)call at the top level of a unit test file.