Skip to content

Conversation

@kovsu
Copy link
Member

@kovsu kovsu commented Jan 27, 2026

PR Checklist

Overview

@changeset-bot
Copy link

changeset-bot bot commented Jan 27, 2026

🦋 Changeset detected

Latest commit: 571dc60

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

This PR includes changesets to release 25 packages
Name Type
@flint.fyi/core Patch
@flint.fyi/astro Patch
@flint.fyi/browser Patch
@flint.fyi/cli Patch
@flint.fyi/json-language Patch
@flint.fyi/json Patch
@flint.fyi/jsx Patch
@flint.fyi/markdown-language Patch
@flint.fyi/md Patch
@flint.fyi/next Patch
@flint.fyi/node Patch
@flint.fyi/nuxt Patch
@flint.fyi/package-json Patch
@flint.fyi/performance Patch
@flint.fyi/plugin-flint Patch
@flint.fyi/react Patch
@flint.fyi/rule-tester Patch
@flint.fyi/solid Patch
@flint.fyi/spelling Patch
@flint.fyi/text-language Patch
@flint.fyi/ts Patch
@flint.fyi/typescript-language Patch
@flint.fyi/yaml-language Patch
@flint.fyi/yaml Patch
@flint.fyi/site 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

@vercel
Copy link

vercel bot commented Jan 27, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
flint Ready Ready Preview, Comment Jan 31, 2026 5:58am

Request Review

@kovsu kovsu marked this pull request as ready for review January 27, 2026 09:15
Copy link
Collaborator

Choose a reason for hiding this comment

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

[Question] This is a lot of added logic. Back in #1856 (comment) I'd found a couple of other packages: gitignore-to-glob, globify-gitignore. Regardless of what package we use, I think it would be nice to have to manage this logic ourselves. Did you try out those packages and/or others? Is there some reason they aren't workable?

Copy link
Member Author

Choose a reason for hiding this comment

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

I'd found a couple of other packages: gitignore-to-glob, globify-gitignore.

Both of them are no longer maintained. The logic also isn’t particularly complex — for example, gitignore-to-glob is only around 80 lines of code.

Regardless of what package we use, I think it would be nice to have to manage this logic ourselves.

100 percent agree.

Did you try out those packages and/or others? Is there some reason they aren't

I didn't try them

Copy link
Collaborator

Choose a reason for hiding this comment

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

globify-gitignore doesn't have any open issues or PRs, so I think it might just be "done" (working as expected) rather than not maintained? 3 years doesn't seem too long to me.

Copy link
Collaborator

@JoshuaKGoldberg JoshuaKGoldberg left a comment

Choose a reason for hiding this comment

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

Really cool work! I think long-term we'll need to migrate to the vfs (and I hope also adopt the globify-gitignore package) but short-term this is definitely a step forward from where we are now. Nicely done!

No blockers from me - just suggestions that we can do as followups IMO.

};
}

export const gitignoreFilter = createGitignoreFilter();
Copy link
Collaborator

Choose a reason for hiding this comment

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

[Refactor] There's no need for this to be module-level state, right? I think it could be moved to inside computeUseDefinitions. Then it'd be a little more resilient to things changing between calls in --watch / multi-run mode.

beforeEach(() => {
fs.rmSync(integrationRoot, { force: true, recursive: true });
fs.mkdirSync(integrationRoot, { recursive: true });
vi.stubGlobal("process", { ...process, cwd: () => integrationRoot });
Copy link
Collaborator

Choose a reason for hiding this comment

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

[Refactor] computeUseDefinitions already calls process.cwd() as well. Eventually we're likely to need to make all these functions work with a custom cwd / receive one from the calling host. How about changing createGitignoreFilter to take in a cwd: string?

Copy link
Member

Choose a reason for hiding this comment

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

Yeah, I don't think we need to mock it anymore.

@@ -0,0 +1,62 @@
import { makeAbsolute } from "@flint.fyi/utils";
import ignore from "ignore";
import fs from "node:fs";
Copy link
Collaborator

Choose a reason for hiding this comment

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

#1605 added a full linter host that we can use. It'll eventually be a must-have, to avoid node:fs access (e.g. for Flint running in a browser context). Do you have bandwidth to refactor this PR to have createGitignoreFilter take that in instead of calling to node:fs methods?

Copy link
Collaborator

Choose a reason for hiding this comment

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

globify-gitignore doesn't have any open issues or PRs, so I think it might just be "done" (working as expected) rather than not maintained? 3 years doesn't seem too long to me.

cspell.json Outdated
"tsgolint",
"twoslash",
"typelang",
"unstub",
Copy link
Collaborator

Choose a reason for hiding this comment

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

No longer needed?

Suggested change
"unstub",

I yearn for streetsidesoftware/cspell#2536...

Copy link
Member Author

Choose a reason for hiding this comment

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

Seems still need.

@JoshuaKGoldberg JoshuaKGoldberg added the 1 approval One team member approved; we're now waiting for a second approval or for 2 business days to pass. label Jan 29, 2026
Copy link
Member

@lishaduck lishaduck left a comment

Choose a reason for hiding this comment

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

I'd held off approving to see if we cared about LinterHost, but if we're happy to leave that for a followup, then it LGTM 👍🏻

@JoshuaKGoldberg
Copy link
Collaborator

@kovsu marking as ready to merge - whatever you want to do, it's up to you. Cheers!

@JoshuaKGoldberg JoshuaKGoldberg added the ready to merge 2+ team members approved; we're now waiting on the author to file followups and self-merge. label Jan 29, 2026
Copy link
Member

@lishaduck lishaduck left a comment

Choose a reason for hiding this comment

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

Loving it! 😍

log("Collecting files from %d use pattern(s)", configDefinition.use.length);

const allFilePaths = new Set<string>();
const gitignoreFilter = createGitignoreFilter(process.cwd(), host);
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
const gitignoreFilter = createGitignoreFilter(process.cwd(), host);
const gitignoreFilter = createGitignoreFilter(host.getCurrentWorkingDirectory(), host);

Copy link
Member Author

Choose a reason for hiding this comment

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

process.cwd() -> /User/xxx
linterhost.getCurrentDirectory() -> /user/xxx

when i use path.relative(), it throw an error.

Copy link
Member

Choose a reason for hiding this comment

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

Well, that's a bug... uh... can you take a look why? It definitely shouldn't be lowercase 🤔

CC @auvred in case I'm wrong

beforeEach(() => {
fs.rmSync(integrationRoot, { force: true, recursive: true });
fs.mkdirSync(integrationRoot, { recursive: true });
vi.stubGlobal("process", { ...process, cwd: () => integrationRoot });
Copy link
Member

Choose a reason for hiding this comment

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

Yeah, I don't think we need to mock it anymore.

const ig = ignore();
const visited = new Set();
const rootDir = process.cwd();
const rootDir = cwd;
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
const rootDir = cwd;

Copy link
Member

@lishaduck lishaduck left a comment

Choose a reason for hiding this comment

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

I'm happy to leave figuring out the cwd thing for a followup. LGTM 👍🏻

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

1 approval One team member approved; we're now waiting for a second approval or for 2 business days to pass. 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.

3 participants