简体   繁体   English

gulp-eslint 不会对点目录内的 .js 文件进行 linting

[英]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 .我在一个点目录中有.js文件,这些文件没有被 gulp gulp-eslint

Example: .foo/file1.js示例: .foo/file1.js

I've confirmed that the glob is picking up the files inside of the dot directory .我已经确认glob 正在拾取 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.即使在这些文件中引入了故意错误, gulp-eslint也会成功传递父点目录中的文件。

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.当引入相同的故意错误时,目录名称(例如src/file.js等)的 linting 失败。

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 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 .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?我的配置中是否有一些不正确的东西阻止了点目录.foo内的.js文件被 linted?

Thanks!谢谢!

It looks to be a known "quirk" of eslint (as of 6.8.0 ).它看起来是 eslint 的一个已知“怪癖” (从6.8.0 )。

The workaround (until a PR is merged to fix this) is to use an .eslintignore file to unignore dot directories explicitly:解决方法(直到合并 PR 以解决此问题)是使用.eslintignore文件明确.eslintignore点目录:

#.eslintignore
!.foo

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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