Skip to content

feat: add support for custom name parameter to includeIgnoreFile #211

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

Merged
merged 5 commits into from
Jun 3, 2025
Merged
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 5 additions & 3 deletions packages/compat/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,9 @@ module.exports = [

### Including Ignore Files

If you were using an alternate ignore file in ESLint v8.x, such as using `--ignore-path .gitignore` on the command line, you can include those patterns programmatically in your config file using the `includeIgnoreFile()` function. For example:
If you were using an alternate ignore file in ESLint v8.x, such as using `--ignore-path .gitignore` on the command line, you can include those patterns programmatically in your config file using the `includeIgnoreFile()` function.

The `includeIgnoreFile()` function also accepts a second optional `name` parameter that allows you to set a custom name for this configuration object. If not specified, it defaults to `"Imported .gitignore patterns"`. For example:

```js
// eslint.config.js - ESM example
Expand All @@ -158,7 +160,7 @@ const __dirname = path.dirname(__filename);
const gitignorePath = path.resolve(__dirname, ".gitignore");

export default [
includeIgnoreFile(gitignorePath),
includeIgnoreFile(gitignorePath, "Imported .gitignore patterns"), // `name` is optional.
{
// your overrides
},
Expand All @@ -174,7 +176,7 @@ const path = require("node:path");
const gitignorePath = path.resolve(__dirname, ".gitignore");

module.exports = [
includeIgnoreFile(gitignorePath),
includeIgnoreFile(gitignorePath, "Imported .gitignore patterns"), // `name` is optional.
{
// your overrides
},
Expand Down