简体   繁体   中英

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

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 (eg 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!

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM