gulp-eslint not linting .js files inside of a dot directory

229 Views Asked by At

I have .js files inside of a dot directory that are not being linted by gulp-eslint.

Example: .foo/file1.js

I've confirmed that the glob is picking up the files inside of the dot directory.

gulp-eslint is passing successfully for the files inside of a parent dot directory even when an intentional error is introduced inside these files.

I've confirmed that directories without a . in the name of the directory (e.g. src/file.js, etc.) are failing linting, when the same intentional error is introduced.

My project structure is something like this:

project/
│
├── .foo/
│   ├──file1.js
│   └──file2.js
│
├── src/
│   ├──file1.js
│   └──file2.js
│
├── gulpfile.js
└── .eslintrc

Contents of gulpfile.js

const gulp = require('gulp');
const eslint = require('gulp-eslint');

gulp.task('lint', () => {
    return gulp.src([ './src/**/*.js', './.foo/**/*.js' ])
        .pipe(eslint({
            configFile: './.eslintrc' 
        }))
        .pipe(eslint.format())
        .pipe(eslint.failAfterError());
});

Contents of .eslintrc

// Reducing down to a single, simple rule
{
    "env": {
        "es6": true
    },
    "rules": {
        "quotes": [
            "error",
            "single"
        ]
    }
}

Is there something incorrect in my config that is preventing the .js files inside of the dot directory .foo from being linted?

Thanks!

1

There are 1 best solutions below

0
On

It looks to be a known "quirk" of eslint (as of 6.8.0).

The workaround (until a PR is merged to fix this) is to use an .eslintignore file to unignore dot directories explicitly:

#.eslintignore
!.foo