-
- diff -Nur ../../original/eslint/lib/cli.js ./lib/cli.js
- --- ../../original/eslint/lib/cli.js 2017-02-03 22:46:05.000000000 +0100
- +++ ./lib/cli.js 2017-02-04 23:56:32.219034572 +0100
- @@ -54,6 +54,7 @@
- cacheFile: cliOptions.cacheFile,
- cacheLocation: cliOptions.cacheLocation,
- fix: cliOptions.fix,
- + files: cliOptions._,
- allowInlineConfig: cliOptions.inlineConfig
- };
- }
- diff -Nur ../../original/eslint/lib/ignored-paths.js ./lib/ignored-paths.js
- --- ../../original/eslint/lib/ignored-paths.js 2017-02-03 22:46:05.000000000 +0100
- +++ ./lib/ignored-paths.js 2017-02-05 11:58:50.683550254 +0100
- @@ -49,12 +49,35 @@
- * @param {string} cwd Current working directory
- * @returns {string} Path of ignore file or an empty string.
- */
- -function findIgnoreFile(cwd) {
- - cwd = cwd || DEFAULT_OPTIONS.cwd;
- -
- - const ignoreFilePath = path.resolve(cwd, ESLINT_IGNORE_FILENAME);
- -
- - return shell.test("-f", ignoreFilePath) ? ignoreFilePath : "";
- +function findIgnoreFile(options) {
- + let cwd = options.cwd || DEFAULT_OPTIONS.cwd;
- + let ignoreFilePath = path.resolve(cwd, ESLINT_IGNORE_FILENAME);
- +
- + debug(`Looking for ignore file in ${ignoreFilePath}`);
- + if(shell.test("-f", ignoreFilePath)) {
- + return ignoreFilePath;
- + }
- +
- + let files = options.files;
- + for( let i = 0; i < files.length; i++ ) {
- + let dir = path.dirname(files[i]); // take the directory from the cli files parameter
- + dir = path.resolve(cwd, dir); // convert it to an absolute path
- + let dirArray = dir.split(path.sep);
- + let length = dirArray.length;
- + for( let k = 0; k < length; k++ ) {
- + // adding / so that we have /ESLINT_IGNORE_FILENAME
- + // when there is only the '' element in the array left
- + let baseDir = dirArray.join(path.sep)+"/";
- +
- + ignoreFilePath = path.resolve(baseDir, ESLINT_IGNORE_FILENAME);
- + debug(`Looking for ignore file in ${ignoreFilePath}`);
- + if(shell.test("-f", ignoreFilePath)) {
- + return ignoreFilePath;
- + }
- + dirArray.pop(); // change to parent directory
- + }
- + }
- + return "";
- }
-
- /**
- @@ -141,14 +164,13 @@
- throw e;
- }
- } else {
- - debug(`Looking for ignore file in ${options.cwd}`);
- - ignorePath = findIgnoreFile(options.cwd);
- + ignorePath = findIgnoreFile(options);
-
- try {
- fs.statSync(ignorePath);
- debug(`Loaded ignore file ${ignorePath}`);
- } catch (e) {
- - debug("Could not find ignore file in cwd");
- + debug("Could not find ignore file");
- this.options = options;
- }
- }
-