Skip to content
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

feat: Add --gitignore flag to read in .gitignore files #55

Merged
merged 5 commits into from
Jun 12, 2024

Conversation

nzakas
Copy link
Member

@nzakas nzakas commented Jun 10, 2024

Prerequisites checklist

What is the purpose of this pull request?

Updates @eslint/migrate-config to use the new gitignore API added in #47

What changes did you make? (Give an overview)

  • When --gitignore is passed as an argument, a code block is added to use includeIgnoreFile().
  • Updated README
  • Added tests

Related Issues

refs #44

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

Copy link
Member

@mdjermanovic mdjermanovic left a comment

Choose a reason for hiding this comment

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

I tried this with a simple .eslintrc.json example:

{
    "rules": {
        "no-unused-vars": 2
    }
}

eslint.config.cjs result:

const {
    includeIgnoreFile,
} = require("@eslint/compat");

const gitignorePath = path.resolve(__dirname, ".gitignore");

module.exports = [includeIgnoreFile(gitignorePath), {
    rules: {
        "no-unused-vars": 2,
    },
}];

eslint.config.mjs result:

import { includeIgnoreFile } from "@eslint/compat";
const gitignorePath = path.resolve(__dirname, ".gitignore");

export default [includeIgnoreFile(gitignorePath), {
    rules: {
        "no-unused-vars": 2,
    },
}];

In the cjs config, importing path is missing. In the mjs config, importing path and calculating __dirname are missing.

@nzakas
Copy link
Member Author

nzakas commented Jun 11, 2024

Ah good catch! I'll fix that.

Copy link
Member

@mdjermanovic mdjermanovic left a comment

Choose a reason for hiding this comment

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

LGTM, thanks!

@mdjermanovic mdjermanovic merged commit 3d9f7ce into main Jun 12, 2024
14 checks passed
@mdjermanovic mdjermanovic deleted the migrate-gitignore branch June 12, 2024 08:13
@github-actions github-actions bot mentioned this pull request Jun 11, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

2 participants