Scans a repository directory, searching for configured linters.
$ npm install detect-repo-linters
detectRepoLinters(dir, [callback]) -> Promise
You may consume the result using promises or callbacks, it's up to you.
const detectRepoLinters = require('detect-repo-linters');
detectRepoLinters('./some-repository-directory')
.then((linters) => {
// linters is an array of linter names that looks like:
// ['editorconfig', 'eslint', 'stylelint']
});
Note that this package will attempt to read the package.json
file from the specified directory and will throw a JSONError
if a JSON parsing error occurs.
At the moment the following linters are detected:
- editorconfig
- eslint
- jscs
- jshint
- stylelint
- csslint
- htmlhint
- htmllint
- coffeelint
- tslint
- prettier
- standard
- xo
Feel free to a PR to include other linters as part of the detection!
$ npm test
$ npm test-cov
to get coverage report
Released under the MIT License.