.eslintignore not working in sibling directory

1.4k views Asked by At

I'm having trouble getting grunt-eslint to pick up an .eslintignore file.

My setup is rather atypical in that I'm running the task on files in sibling directories rather than in the working directory itself.

grunt.initConfig({
    eslint: {
       options: {
          configFile: '.eslintrc',
          extensions: ['.js', '.html', '.xhtml', '.htm']
     },
     one: ['../' + project],
     all: ['../*']
   },
});

My .eslintignore:

**/*.js
**/*.html

These patterns don't seem to match any files in the sibling directories. Any ideas?

1

There are 1 answers

0
Julian Laval On

This issue is tantamount to how minimatch (used by eslint) resolves file paths preceeded by **. Indeed, ** recursively traverses all subdirectories from the working directory only, which makes sense.

To properly match files in a sibling directory, it's a simple question of prepending the .eslintignore file paths with ../, e.g.

../**/*.js
../**/*.html

Hope this helps!