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

Support --ignore-pattern as a command line option #14223

Closed
wants to merge 1 commit into from

Conversation

Standard8
Copy link

Description

This adds --ignore-pattern as a command line option, allowing multiple patterns for ignoring files to be specified on the command line. This echos the ESLint command line option

This is part of the work for #3460. Related work and discussion is in #12672, however that PR appears to have stalled out.

I'm planning to also add an ignores to the configuration, but I'm still figuring out how the structure fits together, as this appears to the first time that option of this type would be added.

I'm happy to do the configuration addition in either this PR or a follow-up, whatever makes most sense - but I thought I'd post this as this part works fine on its own.

Checklist

  • I’ve added tests to confirm my change works.
  • (If changing the API or CLI) I’ve documented the changes I’ve made (in the docs/ directory).
  • (If the change is user-facing) I’ve added my changes to changelog_unreleased/*/XXXX.md file following changelog_unreleased/TEMPLATE.md.
  • I’ve read the contributing guidelines.

Try the playground for this PR

@kachkaev
Copy link
Member

kachkaev commented Jan 23, 2023

Are ignorePatterns / --ignore-pattern in ESLint compatible with Flat Config? It’s not very clear from the docs, at least after a quick scan. If that’s not the case, I wonder if we should step back and focus on specing a new config file instead, similar to Flat Config in ESLint. Looking at #7073 may be a good start, but this predates Flat Config, so might need further thinking.

@Standard8
Copy link
Author

Are ignorePatterns in ESLint compatible with Flat Config? It’s not very clear from the docs. If that’s not the case, I wonder if we should step back and focus on specing a new config file instead, similar to Flat Config in ESLint. Looking at #7073 may be a good start, but this predates Flat Config, so might need further thinking.

For the command line option, I can't see any signs of it being removed.

In the configuration itself, they are moving from ignorePatterns in the current to config, to individual ignores sections in the Flat Config. It looks like the format of those are the same.

If we're concerned about the ignore pattern future, we could skip adding the command line options and only add an ignores option into the existing configuration. I did the command line option first as that happened to be the simpler case.

I think adding an ignores option to the existing configuration format wouldn't cause any significant migration issues if Prettier migrated later.

@Standard8
Copy link
Author

I've just figured out what it would take to add this as a configuration option. There's a very minimal diff here.

One thing that isn't so nice is that we have to work around the configuration being loaded each time - as the configuration is loaded depending on where the files being processed are. Maybe there's a simpler way around that, or that could be tidied up later with flat config.

To expand a bit more my previous comment, I'm not fussed about the command line arguments - they seemed the easier option and added consistency with ESLint. I would really like the option in the configuration as this would make it a lot simpler for something I'm working on.

My concern with waiting for a configuration rewrite would be how long that would take, I could possibly help a bit, but not significantly. If we really can't find something that would fit in the interim, then I would understand that.

@Standard8
Copy link
Author

Abandoning, since this doesn't seem to be wanted and #14332 landed.

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.

None yet

2 participants