Skip to content

feat(vitest): add toHaveLengthMatchers rule - #3650

Merged
michaelfaith merged 3 commits into
flint-fyi:mainfrom
amitreny:vitest-to-have-length-matchers
Oct 12, 2026
Merged

michaelfaith merged 3 commits into
flint-fyi:mainfrom
amitreny:vitest-to-have-length-matchers

Conversation

@amitreny

@amitreny amitreny commented Oct 9, 2026

Copy link
Copy Markdown
Contributor

PR Checklist

Overview

toHaveLengthMatchers rule for the Vitest plugin have been ported from vitest/prefer-to-have-length

matches: toBe, toEqual and toStrictEqual on an expect() argument ending in .length or ["length"], including through .not

skips: optional chains such as expect(files?.length), because toHaveLength() throws on undefined.
🫡

@changeset-bot

changeset-bot Bot commented Oct 9, 2026 •

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 5c5e16c

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 2 packages
Name Type
@flint.fyi/rule-data Patch
@flint.fyi/vitest Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@netlify

netlify Bot commented Oct 9, 2026 •

Copy link
Copy Markdown

✅ Deploy Preview for flint-fyi ready!

Name Link
🔨 Latest commit 5c5e16c
🔍 Latest deploy log https://app.netlify.com/projects/flint-fyi/deploys/6accebe08c91f71659569707
😎 Deploy Preview https://deploy-preview-3650--flint-fyi.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.
🤖 Make changes Run an agent on this branch

To edit notification comments on pull requests, go to your Netlify project configuration.

@pkg-pr-new

pkg-pr-new Bot commented Oct 9, 2026 •

Copy link
Copy Markdown

Open in StackBlitz

@flint.fyi/astro

pnpm add https://pkg.pr.new/@flint.fyi/astro@5c5e16c -D

@flint.fyi/astro-language

pnpm add https://pkg.pr.new/@flint.fyi/astro-language@5c5e16c -D

@flint.fyi/browser

pnpm add https://pkg.pr.new/@flint.fyi/browser@5c5e16c -D

@flint.fyi/changesets

pnpm add https://pkg.pr.new/@flint.fyi/changesets@5c5e16c -D

@flint.fyi/cli

pnpm add https://pkg.pr.new/@flint.fyi/cli@5c5e16c -D

@flint.fyi/core

pnpm add https://pkg.pr.new/@flint.fyi/core@5c5e16c -D

@flint.fyi/css

pnpm add https://pkg.pr.new/@flint.fyi/css@5c5e16c -D

@flint.fyi/css-language

pnpm add https://pkg.pr.new/@flint.fyi/css-language@5c5e16c -D

flint

pnpm add https://pkg.pr.new/flint@5c5e16c -D

@flint.fyi/json

pnpm add https://pkg.pr.new/@flint.fyi/json@5c5e16c -D

@flint.fyi/json-language

pnpm add https://pkg.pr.new/@flint.fyi/json-language@5c5e16c -D

@flint.fyi/jsx

pnpm add https://pkg.pr.new/@flint.fyi/jsx@5c5e16c -D

@flint.fyi/markdown-language

pnpm add https://pkg.pr.new/@flint.fyi/markdown-language@5c5e16c -D

@flint.fyi/md

pnpm add https://pkg.pr.new/@flint.fyi/md@5c5e16c -D

@flint.fyi/next

pnpm add https://pkg.pr.new/@flint.fyi/next@5c5e16c -D

@flint.fyi/node

pnpm add https://pkg.pr.new/@flint.fyi/node@5c5e16c -D

@flint.fyi/nuxt

pnpm add https://pkg.pr.new/@flint.fyi/nuxt@5c5e16c -D

@flint.fyi/package-json

pnpm add https://pkg.pr.new/@flint.fyi/package-json@5c5e16c -D

@flint.fyi/performance

pnpm add https://pkg.pr.new/@flint.fyi/performance@5c5e16c -D

@flint.fyi/plugin-flint

pnpm add https://pkg.pr.new/@flint.fyi/plugin-flint@5c5e16c -D

@flint.fyi/react

pnpm add https://pkg.pr.new/@flint.fyi/react@5c5e16c -D

@flint.fyi/rule-data

pnpm add https://pkg.pr.new/@flint.fyi/rule-data@5c5e16c -D

@flint.fyi/rule-tester

pnpm add https://pkg.pr.new/@flint.fyi/rule-tester@5c5e16c -D

@flint.fyi/solid

pnpm add https://pkg.pr.new/@flint.fyi/solid@5c5e16c -D

@flint.fyi/spelling

pnpm add https://pkg.pr.new/@flint.fyi/spelling@5c5e16c -D

@flint.fyi/svelte

pnpm add https://pkg.pr.new/@flint.fyi/svelte@5c5e16c -D

@flint.fyi/svelte-language

pnpm add https://pkg.pr.new/@flint.fyi/svelte-language@5c5e16c -D

@flint.fyi/text-language

pnpm add https://pkg.pr.new/@flint.fyi/text-language@5c5e16c -D

@flint.fyi/ts

pnpm add https://pkg.pr.new/@flint.fyi/ts@5c5e16c -D

@flint.fyi/ts-patch

pnpm add https://pkg.pr.new/@flint.fyi/ts-patch@5c5e16c -D

@flint.fyi/typescript-language

pnpm add https://pkg.pr.new/@flint.fyi/typescript-language@5c5e16c -D

@flint.fyi/utils

pnpm add https://pkg.pr.new/@flint.fyi/utils@5c5e16c -D

@flint.fyi/vitest

pnpm add https://pkg.pr.new/@flint.fyi/vitest@5c5e16c -D

@flint.fyi/volar-language

pnpm add https://pkg.pr.new/@flint.fyi/volar-language@5c5e16c -D

@flint.fyi/vue

pnpm add https://pkg.pr.new/@flint.fyi/vue@5c5e16c -D

@flint.fyi/vue-language

pnpm add https://pkg.pr.new/@flint.fyi/vue-language@5c5e16c -D

@flint.fyi/yaml

pnpm add https://pkg.pr.new/@flint.fyi/yaml@5c5e16c -D

@flint.fyi/yaml-language

pnpm add https://pkg.pr.new/@flint.fyi/yaml-language@5c5e16c -D

commit: 5c5e16c

@lishaduck lishaduck left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Great first contribution, thanks for the PR!

Comment thread packages/vitest/src/rules/toHaveLengthMatchers.test.ts
@lishaduck lishaduck added the 1 approval One team member approved; we're now waiting for a second approval or for 2 business days to pass. label Oct 9, 2026
@codecov

codecov Bot commented Oct 9, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

@michaelfaith michaelfaith left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Awesome first contribution! Nice work. Just a few nits from me. Let us know once you have those addressed, and one of us will merge.

Comment thread packages/site/src/content/docs/rules/vitest/toHaveLengthMatchers.mdx Outdated
Comment thread packages/vitest/src/rules/toHaveLengthMatchers.ts Outdated
@michaelfaith michaelfaith added status: waiting for author Needs an action taken by the original poster and removed 1 approval One team member approved; we're now waiting for a second approval or for 2 business days to pass. labels Oct 9, 2026
@amitreny

Copy link
Copy Markdown
Contributor Author

@michaelfaith @lishaduck nits addressed
Thank you for the feedback
Happy to contribute further

Thanks!

@michaelfaith michaelfaith left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Thanks again!

@michaelfaith
michaelfaith enabled auto-merge (squash) October 12, 2026 17:49
@michaelfaith michaelfaith added ready to merge 2+ team members approved; we're now waiting on the author to file followups and self-merge. and removed status: waiting for author Needs an action taken by the original poster labels Oct 12, 2026
@michaelfaith
michaelfaith merged commit 0079050 into flint-fyi:main Oct 12, 2026
25 checks passed
@github-actions

Copy link
Copy Markdown
Contributor

@all-contributors please add amitreny for code.

🤖 Beep boop! This comment was added automatically by all-contributors-auto-action.
Not all contributions can be detected from Git & GitHub alone. Please comment any missing contribution types this bot missed.
...and of course, thank you for contributing! 💙

@allcontributors

Copy link
Copy Markdown
Contributor

@github-actions[bot]

I've put up a pull request to add @amitreny! 🎉

@flint-tokens-bot flint-tokens-bot Bot mentioned this pull request Oct 12, 2026
michaelfaith pushed a commit that referenced this pull request Oct 12, 2026
Adds @amitreny as a contributor for code.

This was requested by github-actions[bot] [in this
comment](#3650 (comment))

---------

Co-authored-by: allcontributors[bot] <46447321+allcontributors[bot]@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ready to merge 2+ team members approved; we're now waiting on the author to file followups and self-merge.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

🚀 Feature: [vitest] Create toHaveLengthMatchers rule

3 participants