Julian Laval
Julian Laval

Reputation: 1260

.eslintignore not working in sibling directory

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?

Upvotes: 2

Views: 1441

Answers (1)

Julian Laval
Julian Laval

Reputation: 1260

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!

Upvotes: 1

Related Questions