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

Add ignoreFiles option #172

Closed
wants to merge 4 commits into from
Closed

Conversation

jridgewell
Copy link
Contributor

This is very similar to the gitignore option, except it allows globing for any compatible ignore file (eg, .prettierignore or .eslintignore). AMP had a recent need for this with our prettier integration, because it doesn't respect its ignore file when using the API directly.

index.js Outdated Show resolved Hide resolved
index.d.ts Outdated Show resolved Hide resolved
index.d.ts Outdated Show resolved Hide resolved
@sindresorhus
Copy link
Owner

You need to update package.json when renaming a file.

index.js Outdated Show resolved Hide resolved
index.d.ts Outdated Show resolved Hide resolved
readme.md Outdated Show resolved Hide resolved
index.d.ts Outdated Show resolved Hide resolved
@sindresorhus sindresorhus changed the title Add ignoreFiles option Add ignoreFiles option Apr 18, 2021
readme.md Outdated Show resolved Hide resolved
Copy link
Contributor Author

@jridgewell jridgewell left a comment

Choose a reason for hiding this comment

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

Addressed all comments, and made sure to undo any autoformatting (sorry about that).

index.js Outdated Show resolved Hide resolved
index.d.ts Outdated Show resolved Hide resolved
readme.md Outdated Show resolved Hide resolved
readme.md Outdated Show resolved Hide resolved
@jridgewell jridgewell force-pushed the ignorefiles branch 2 times, most recently from 5cdec2e to 08212ee Compare April 29, 2021 03:33
@sindresorhus sindresorhus force-pushed the main branch 2 times, most recently from 48605e7 to 662cafc Compare July 22, 2021 01:39
@weyert
Copy link

weyert commented Jan 24, 2022

How can I help getting this PR merged into the project?

This is very similar to the `gitignore` option, except it allows globing for any compatible ignore file (eg, `.prettierignore` or `.eslintignore`).
@jridgewell
Copy link
Contributor Author

I've rebased, this just requires a review.

index.d.ts Outdated Show resolved Hide resolved
const {cwd} = normalizeOptions(options);

const paths = fastGlob.sync('**/.gitignore', {cwd, ...gitignoreGlobOptions});
const paths = fastGlob.sync(pattern, {cwd, ...gitignoreGlobOptions});
Copy link
Collaborator

Choose a reason for hiding this comment

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

Maybe we should add dot: true to the option, when pattern is *ignore, not sure, need test.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Maybe we should add dot: true to the option, when pattern is *ignore

Sorry, I don't understand the suggestion.

need test.

Added.

Copy link
Collaborator

Choose a reason for hiding this comment

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

I mean, if user use {ignoreFiles: '*ignore'}, can this glob files starts with .? See https://github.com/mrmlnc/fast-glob#dot

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I personally don't find that necessary, and it makes the configuration a little complicated (what if the user didn't want to use dotfiles?). But I'll leave the decision to you.

Copy link
Collaborator

Choose a reason for hiding this comment

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

I'm not a maintainer :)

index.d.ts Outdated
@@ -42,11 +42,20 @@ export interface Options extends FastGlobOptionsWithoutCwd {

/**
Respect ignore patterns in `.gitignore` files that apply to the globbed files.
This option takes precedence over the `ignoreFiles` option.
Copy link
Collaborator

Choose a reason for hiding this comment

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

This don't have to "takes precedence", we can concat **/.gitignore with ignoreFiles, so they can use together.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done.

Copy link
Collaborator

Choose a reason for hiding this comment

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

The content in readme.md file didn't fix.

index.js Outdated Show resolved Hide resolved
index.js Outdated Show resolved Hide resolved
isGitIgnored,
isGitIgnoredSync,
} from './gitignore.js';
export {isIgnored, isIgnoredSync} from './ignore.js';
Copy link
Collaborator

Choose a reason for hiding this comment

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

I'm not sure if we want to expose these, if we do, maybe we need a better name, isIgnoredByIgnoreFiles?

@jridgewell
Copy link
Contributor Author

This has gotten another merge conflict. I'm not interested in doing more rounds. If you want to take this up, I release my changes as public domain.

@jridgewell jridgewell closed this Jan 25, 2022
@fisker
Copy link
Collaborator

fisker commented Jan 25, 2022

I can continue work on this.

@fisker fisker mentioned this pull request Jan 25, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants