diff --git a/lib/ignored-paths.js b/lib/ignored-paths.js index 20040209c6ca..140beb7f2d54 100644 --- a/lib/ignored-paths.js +++ b/lib/ignored-paths.js @@ -175,18 +175,22 @@ class IgnoredPaths { addIgnoreFile(this.ig.custom, ignorePath); addIgnoreFile(this.ig.default, ignorePath); } else { - try { - // if the ignoreFile does not exist, check package.json for eslintIgnore - packageJSONPath = findPackageJSONFile(options.cwd) - if (packageJSONPath) { - const configOptions = config.load(packageJSONPath, configContext); - if (configOptions.eslintIgnore) { - const filesToIgnore = configOptions.eslintIgnore; - } - } - } catch (e) { - debug("Could not find eslintIgnore in package.json"); - } + try { + + // if the ignoreFile does not exist, check package.json for eslintIgnore + packageJSONPath = findPackageJSONFile(options.cwd); + if (packageJSONPath) { + const configOptions = config.load(packageJSONPath, configContext); + + if (configOptions.eslintIgnore) { + const filesToIgnore = configOptions.eslintIgnore; + + debug(filesToIgnore); + } + } + } catch (e) { + debug("Could not find eslintIgnore in package.json"); + } } if (options.ignorePattern) {