ruanyl / vim-fixmyjs

vim fixmyjs - auto fix your javascript using fixmyjs/eslint/tslint/jscs
MIT License
69 stars 11 forks source link

Would it be possible to allow different file types for eslint config? #15

Closed natealcedo closed 7 years ago

natealcedo commented 7 years ago

Currently there isn't a standard config file format for eslint. You can either use .eslintrc.js or .eslintrc.json. Is there a way to allow for the use of both? Currently my work flow is to init an eslint config and rename the file that eslint gives from ".eslintrc.json/.eslintrc.js" into ".eslintrc". Either that or make a soft link of ".eslintrc.json/.eslintrc.js" to ".eslintrc". Would doing something like this be viable? I'm not sure if vim recognizes this. What do you think?

let g:fixmyjs_rc_filename = '.eslintrc.*'

ruanyl commented 7 years ago

@ndaljr Thanks for the suggestion :) To make it simple(bacause it requires one specific config file supplied to eslint when running under command line), I think we could give g:fixmyjs_rc_filename a list, for example: [".eslintrc.json", ".eslintrc.js"]. Then we could take the first filename appears in the list which exists in current working directory.

natealcedo commented 7 years ago

@ruanyl I actually forgot that .yaml is also accepted as a config file format. Anyways I think that your suggestions is great. On my end do I have to do anything to achieve this behaviour? I'm not exactly familiar with vim script.

ruanyl commented 7 years ago

@ndaljr I will have to update vim-fixmyjs so that g:fixmyjs_rc_filename accepts a list. Currently it only expects a string. I will add it soon.

natealcedo commented 7 years ago

Alright! I'll close the issue when the update has been patched! Thanks for the great work you've been doing. The community appreciates it. :)

fvictorio commented 7 years ago

Hey @ruanyl, do you want help on this? It doesn't seem too hard. You probably can do it in five minutes, but let me know if you'd prefer someone else to do it. I can send you a PR today or tomorrow.

ruanyl commented 7 years ago

@fvictorio PR is welcome 👍

natealcedo commented 7 years ago

Hi sorry if this is opening an old issue. Is there any update to this? I mean its not really a bother anymore to me. Shall I close this instead? I've gotten used to just renaming my rc files.

ruanyl commented 7 years ago

@ndaljr Hi, there is a PR for this: https://github.com/ruanyl/vim-fixmyjs/pull/16 , but it might have potential issues, maybe let's keep this open until it's solved because I do think this is a quite common requirement :)

fvictorio commented 7 years ago

Oh, sorry! I completely forgot about this. I'll try to improve the PR with @ruanyl suggestions ASAP.

ruanyl commented 7 years ago

@ndaljr Hi, with the help of @fvictorio , this plugin is able to accept different config files now 🎉 , checkout README for details!

natealcedo commented 7 years ago

Thanks @fvictorio and @ruanyl! Great work! Your efforts are much appreciated