UNPKG

790 BJavaScriptView Raw
1"use strict";
2
3const path = require(`path`);
4
5const glob = require(`glob`);
6
7const debug = require(`debug`)(`gatsby:webpack-eslint-config`);
8
9const report = require(`gatsby-cli/lib/reporter`);
10
11module.exports = directory => {
12 try {
13 debug(`Attempting to load package.json for eslint config check`);
14
15 const pkg = require(path.resolve(directory, `package.json`));
16
17 if (pkg.eslintConfig) {
18 return true;
19 }
20 } catch (err) {
21 report.error(`There was a problem processing the package.json file`, err);
22 }
23
24 debug(`Checking for eslint config file`);
25 const eslintFiles = glob.sync(`.eslintrc?(.js|.json|.yaml|.yml)`, {
26 cwd: directory
27 });
28
29 if (eslintFiles.length) {
30 return true;
31 }
32
33 return false;
34};
35//# sourceMappingURL=local-eslint-config-finder.js.map
\No newline at end of file