Skip to content

feat: Add new includeIgnoreFile() to config-helpers - #430

Merged
DMartens merged 37 commits into
eslint:mainfrom
kirkwaiblinger:include-gitignore-in-path
May 4, 2026
Merged

DMartens merged 37 commits into
eslint:mainfrom
kirkwaiblinger:include-gitignore-in-path

Conversation

@kirkwaiblinger

@kirkwaiblinger kirkwaiblinger commented Apr 8, 2026 •

Copy link
Copy Markdown
Contributor

Prerequisites checklist

AI acknowledgment

  • I did not use AI to generate this PR.
    • (for the most part; some AI use for the added documentation)
  • (If the above is not checked) I have reviewed the AI-generated content before submitting.

What is the purpose of this pull request?

fixes #329

What changes did you make? (Give an overview)

Deprecate includeIgnoreFile(),convertIgnorePatternToMinimatch() in @eslint/compat. Add and export new includeIgnoreFile() (documented),convertIgnorePatternToMinimatch() (undocumented) in @eslint/config-helpers.

The new convertIgnorePatternToMinimatch() is unaltered.
The new includeIgnoreFile():

  • adds a gitignoreResolution option which can be false (default; interprets patterns relative to config file) or true (interprets patterns relative to ignore file).
  • can accept an array of ignore file paths rather than only a single ignore file path.

Related Issues

#329

Is there anything you'd like reviewers to focus on?


There is a companion PR in eslint repo: eslint/eslint#20735

@github-project-automation github-project-automation Bot moved this to Needs Triage in Triage Apr 8, 2026
@kirkwaiblinger
kirkwaiblinger marked this pull request as ready for review April 8, 2026 19:30
@kirkwaiblinger kirkwaiblinger changed the title feat: Add new includeIgnoreFIle() to config-helpers feat: Add new includeIgnoreFile() to config-helpers Apr 8, 2026
});

it("should return an object with an `ignores` property", () => {
const ignoreFilePath = fileURLToPath(

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

I think we should simplify this and in other spots by using import.meta.resolve (requires Node v18+)

Suggested change
const ignoreFilePath = fileURLToPath(
const ignoreFilePath = import.meta.resolve("../tests/fixtures/ignore-files/gitignore1.txt")

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Huh... I never knew about import.meta.resolve. But in any case it looks like that still gets us a URL, which would need to be converted to a path with fileURLToPath(). So I'm not sure that that gains us anything? Unless I'm misunderstanding.

At the end of the day, this is really just the workaround for not having access to import.meta.dirname, which the linter complains about (due to supporting older versions of node)

Comment thread packages/config-helpers/tests/ignore-file.test.js
Comment thread packages/config-helpers/src/ignore-file.js Outdated
@kirkwaiblinger
kirkwaiblinger requested a review from DMartens April 8, 2026 23:41
@mdjermanovic mdjermanovic moved this from Needs Triage to Implementing in Triage Apr 9, 2026
Comment thread packages/compat/README.md Outdated
Co-authored-by: Milos Djermanovic <milos.djermanovic@gmail.com>
Comment thread packages/compat/tests/ignore-file.test.js Outdated
Comment thread packages/compat/README.md Outdated
Comment thread packages/config-helpers/README.md Outdated
Comment thread packages/migrate-config/package.json
mdjermanovic
mdjermanovic previously approved these changes Apr 25, 2026

@mdjermanovic mdjermanovic 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.

LGTM, thanks! Leaving open for others to verify their review comments.

@lumirlumir lumirlumir moved this from Implementing to Second Review Needed in Triage Apr 26, 2026
Comment thread packages/config-helpers/src/ignore-file.js Outdated
Comment thread packages/config-helpers/src/ignore-file.js Outdated
Comment thread packages/config-helpers/tests/ignore-file.test.js Outdated
Comment thread packages/config-helpers/tests/ignore-file.test.js Outdated
lumirlumir
lumirlumir previously approved these changes May 4, 2026

@lumirlumir lumirlumir 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.

LGTM. Thanks for your time and effort on this PR!

Would like @mdjermanovic to verify the changes before merging.

Comment thread packages/config-helpers/README.md Outdated
Co-authored-by: 루밀LuMir <rpfos@naver.com>
mdjermanovic
mdjermanovic previously approved these changes May 4, 2026

@mdjermanovic mdjermanovic 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.

LGTM, thanks! Leaving open for @fasttime and @DMartens to verify.

fasttime
fasttime previously approved these changes May 4, 2026

@fasttime fasttime 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.

LGTM.

]);
});

// convert above to for ... of loop

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

I think this is an unresolved TODO comment related to line 61 which uses Array#forEach to create a parameterised test case.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Gah! that was a prompt to copilot that I forgot to remove, yep 🫣. Thanks for pointing that out.

@DMartens

DMartens commented May 4, 2026

Copy link
Copy Markdown

Changes LGTM, thank you for the continued work on this.
Only found a seemingly unresolved TODO comment.

@kirkwaiblinger
kirkwaiblinger dismissed stale reviews from fasttime and mdjermanovic via 8f99a34 May 4, 2026 21:29
@kirkwaiblinger
kirkwaiblinger requested a review from DMartens May 4, 2026 21:31
@DMartens
DMartens merged commit 9b51352 into eslint:main May 4, 2026
59 checks passed
@github-project-automation github-project-automation Bot moved this from Second Review Needed to Complete in Triage May 4, 2026
@eslintbot eslintbot mentioned this pull request May 4, 2026
@kirkwaiblinger
kirkwaiblinger deleted the include-gitignore-in-path branch May 4, 2026 22:11
renovate Bot added a commit to gwennlbh/svelte-mathml that referenced this pull request Sep 7, 2026
##### [v2.1.0](https://github.com/eslint/rewrite/blob/HEAD/packages/compat/CHANGELOG.md#210-2026-05-08)

##### Features

- Add new `includeIgnoreFile()` to config-helpers ([#430](eslint/rewrite#430)) ([9b51352](eslint/rewrite@9b51352))
##### [v2.0.5](https://github.com/eslint/rewrite/blob/HEAD/packages/compat/CHANGELOG.md#205-2026-04-08)

##### Dependencies

- The following workspace dependencies were updated
  - dependencies
    - [@eslint/core](https://github.com/eslint/core) bumped from ^1.2.0 to ^1.2.1
##### [v2.0.4](https://github.com/eslint/rewrite/blob/HEAD/packages/compat/CHANGELOG.md#204-2026-04-03)

##### Dependencies

- The following workspace dependencies were updated
  - dependencies
    - [@eslint/core](https://github.com/eslint/core) bumped from ^1.1.1 to ^1.2.0
##### [v2.0.3](https://github.com/eslint/rewrite/blob/HEAD/packages/compat/CHANGELOG.md#203-2026-03-06)

##### Dependencies

- The following workspace dependencies were updated
  - dependencies
    - [@eslint/core](https://github.com/eslint/core) bumped from ^1.1.0 to ^1.1.1
##### [v2.0.2](https://github.com/eslint/rewrite/blob/HEAD/packages/compat/CHANGELOG.md#202-2026-01-29)

##### Bug Fixes

- add eslint 10 as peer dependency ([#361](eslint/rewrite#361)) ([ecb37dc](eslint/rewrite@ecb37dc))

##### Dependencies

- The following workspace dependencies were updated
  - dependencies
    - [@eslint/core](https://github.com/eslint/core) bumped from ^1.0.1 to ^1.1.0
renovate Bot added a commit to gwennlbh/svelte-mathml that referenced this pull request Sep 10, 2026
##### [v2.1.1](https://github.com/eslint/rewrite/blob/HEAD/packages/compat/CHANGELOG.md#211-2026-09-01)

##### Bug Fixes

- preserve markVariableAsUsed return value in compat context ([#503](eslint/rewrite#503)) ([66d9790](eslint/rewrite@66d9790))
##### [v2.1.0](https://github.com/eslint/rewrite/blob/HEAD/packages/compat/CHANGELOG.md#210-2026-05-08)

##### Features

- Add new `includeIgnoreFile()` to config-helpers ([#430](eslint/rewrite#430)) ([9b51352](eslint/rewrite@9b51352))
##### [v2.0.5](https://github.com/eslint/rewrite/blob/HEAD/packages/compat/CHANGELOG.md#205-2026-04-08)

##### Dependencies

- The following workspace dependencies were updated
  - dependencies
    - [@eslint/core](https://github.com/eslint/core) bumped from ^1.2.0 to ^1.2.1
##### [v2.0.4](https://github.com/eslint/rewrite/blob/HEAD/packages/compat/CHANGELOG.md#204-2026-04-03)

##### Dependencies

- The following workspace dependencies were updated
  - dependencies
    - [@eslint/core](https://github.com/eslint/core) bumped from ^1.1.1 to ^1.2.0
##### [v2.0.3](https://github.com/eslint/rewrite/blob/HEAD/packages/compat/CHANGELOG.md#203-2026-03-06)

##### Dependencies

- The following workspace dependencies were updated
  - dependencies
    - [@eslint/core](https://github.com/eslint/core) bumped from ^1.1.0 to ^1.1.1
##### [v2.0.2](https://github.com/eslint/rewrite/blob/HEAD/packages/compat/CHANGELOG.md#202-2026-01-29)

##### Bug Fixes

- add eslint 10 as peer dependency ([#361](eslint/rewrite#361)) ([ecb37dc](eslint/rewrite@ecb37dc))

##### Dependencies

- The following workspace dependencies were updated
  - dependencies
    - [@eslint/core](https://github.com/eslint/core) bumped from ^1.0.1 to ^1.1.0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

Status: Complete

Development

Successfully merging this pull request may close these issues.

Change Request: includeIgnoreFile should respect the path to the directory containing the .gitignore

6 participants