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

how to ignore node_modules using the cli API? #329

Closed
vvo opened this issue Jul 7, 2015 · 6 comments
Closed

how to ignore node_modules using the cli API? #329

vvo opened this issue Jul 7, 2015 · 6 comments

Comments

@vvo
Copy link

vvo commented Jul 7, 2015

Let's say I want to rewrite all the JavaScript files in my project BUT the node_modules, how to do that?

@vvo
Copy link
Author

vvo commented Jul 7, 2015

something like this:

esformatter '!(node_modules|build|dist){,/**/}*.js'

(rough!)

@vvo
Copy link
Author

vvo commented Jul 8, 2015

@millermedeiros this is not the best option since it emits an error when you do not have any subdirectory.. Maybe you have a better idea?

@vvo
Copy link
Author

vvo commented Jul 8, 2015

So that's because when you give a pattern to glob that results in no matches, you get back a similar pattern. Switching to non sync glob should solve the issue, but that's some work

@millermedeiros
Copy link
Owner

yes, we need a better way to do this and also to add it to the docs.

the error I did on purpose because I assumed it was better to display that it couldn't find any files with the glob than to fail silently.. (specially for cases like esformatter 'wrong_path.js') but maybe we should change this behavior and/or add a flag to toggle it.

@millermedeiros millermedeiros added this to the v0.8.0 milestone Aug 3, 2015
@millermedeiros
Copy link
Owner

I think we should probably add an --ignore-dir argument to the CLI.. so we can do:

esformatter --ignore-dir=node_modules --ignore-dir=build --ignore-dir=dist  './**/*.js'

and maybe ignore node_modules by default (if we ignore it by default we should add a --noignore-dir argument as well)

@millermedeiros
Copy link
Owner

sorry for the huuuuuuge delay, but in the next version (v0.10.0) we will be able to specify complex ignore rules like:

esformatter --diff --ignore 'node_modules/**' --ignore 'test/compare/**/*-in.js' --ignore 'test/compare/{jquery,custom,rc,error}/**/*.js' '**/*.js'

I'll probably do some follow up work on #449 to support .eslintignore, .gitignore, etc...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants