editorconfig / editorconfig-core-js

EditorConfig Core library and command line utility written in JavaScript
http://editorconfig.org
MIT License
272 stars 48 forks source link

Should * include binary files? #42

Closed fregante closed 7 years ago

fregante commented 7 years ago

EditorConfig's * applies to all files, but should it?

$ editorconfig image.png 
indent_style=tab
end_of_line=lf
charset=utf-8
trim_trailing_whitespace=true
insert_final_newline=true

Does this make sense or should it output nothing on binary files?

Should the editor/tool have to include this check instead?

jednano commented 7 years ago

Please open an issue on the main EditorConfig repo. Sorry for the confusion, but this doesn't just concern the js core. It concerns all EditorConfig plugins.

https://github.com/editorconfig/editorconfig/issues

xuhdev commented 7 years ago

It seems to me that editors themselves should ignore these settings for text files, no matter how they are set by the plugins. Which editor are you using? I would rather report the issue to the editor developers.

jednano commented 7 years ago

@xuhdev what do you mean "for text files"? The request here is to have EditorConfig ignore binary files. This would be relevant for all cores to somehow detect whether a file is a binary type or not.

fregante commented 7 years ago

@xuhdev The tool I'm using told me that EditorConfig itself should handle binary files : https://github.com/jedmao/eclint/issues/45#event-925881562

xuhdev commented 7 years ago

@jedmao What I meant was, an option such as indent_size is not meaningful for binary files. When the plugin sets the corresponding editor option, the editor itself should handle it well by ignoring it -- it ought not to be the responsibility of the plugins nor the cores, except perhaps a few exceptions. Does it make sense?

jednano commented 7 years ago

Ahh, @xuhdev I see what you mean now and I'm inclined to agree w/ you. Even better is that this is already how things work today; thus, there's nothing to do here.

That said, @bfred-it, one thing you can do to ignore binary files is this:

root = true;

[*]
indent_size = 4

[*.png]
indent_size = unset

See https://github.com/editorconfig/editorconfig/issues/285#issuecomment-267400370

fregante commented 7 years ago

this is already how things work today

Where? This issue is about excluding binary files automatically rather than manually via (potentially-lengthy and incomplete) config

xuhdev commented 7 years ago

I think this is really an issue of eclint... I tend to consider that eclint should automatically detect binary files. mime-types may be helpful for this job.