snootforge

chee/detect-eslint-config

detect if a file is in a project that configure eslint

detect-eslint-config

detect if a file is in a project that has an eslint config

  1. npm i -D detect-eslint-config

use like:

  1. import detectEslintConfig from 'detect-eslint-config'
  2. const hasEslintConfig = !!detectEslintConfig('dog/face')
  3. if (hasEslintConfig) {
  4. console.log('we have found an eslint config for this project')
  5. }

it is synchronous and it does not check any further back than a package.json should it find one.

if it does not find one it will stop at the disk root.

it will not check for config at the root of the disk. i hope that is okay.

developing

  1. git clone git@github.com:chee/detect-eslint-config
  2. cd detect-eslint-config
  3. # edit source/index.js
  4. npm run build # me up buttercup
  5. npm run test
  6. git add -A
  7. git commit -m 'heHELLP'
  8. git push -f
  9. git rm -r *
  10. git commit -m 'pleas'
  11. git push -f
  12. git filter-branch --tree-filter 'git rm -rf * || echo um'
  13. git push -f

and a splendid time was guaranteed for all

TODO