ruanyl / vim-fixmyjs

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

Add support for non-root level `.eslintrc`, `node_modules` #20

Closed woodb closed 6 years ago

woodb commented 6 years ago

This PR is to add support for two new features:

  1. Searching for the nearest .eslintrc (or whatever else configuration file as defined) of the file being edited
    • Turned off by default, enabled by let g:fixmyjs_rc_local = 1
    • This allows for projects that have multiple .eslintrc configuration files to be respected
    • Tested with a mono-repo that had multiple .eslintrc files in it
  2. Search for the nearest node_modules/.bin of the file being edited
    • This allows for projects that have multiple node_modules locally to use the one most likely to be used by the edited file
    • This resolves issues such as differences in versions of eslint b/t subdirectories, as well as differences in eslint plugin requirements
    • Additionally, this attempts to fall back to the system level if it can't find anything

Any feedback or additional testing would be greatly appreciated, cheers!

ruanyl commented 6 years ago

@woodb Great stuff! Thanks, I was also thinking to implement this. I guess this is how these linting tools work in nature to resolve rc file.