0

これが私のlint仕事です:

gulp.task('lint', function(){
  gulp.src(fileString)
    .pipe(eslint())
    .pipe(eslint.format());
});

の場合fileString'js/**/*.js'、.js ファイルだけを完全にリントします。の場合'js/components/**.jsx'は、.jsx をまったく問題なくリントします。しかし、'js/**/*.jsx'または'js/**/*/.*{js,jsx}'、すべて正しいファイルが表示されますが、それらに対して何もしません。

これが私の/jsディレクトリです(反応プロジェクトの場合):

├── stores
│   └── heyStore.jsx
├── models.js
├── mixins.js
├── data
│   └── states.js
├── config.js
├── components
│   ├── firstThing.jsx
│   ├── aThing.jsx
│   ├── whoaWhat.jsx
│   └── nahYo.jsx
├── app.jsx
└── api
    ├── prod.js
    └── mock.js

念のため、私の.eslintrcファイルは次のとおりです。

{
  "parser": "babel-eslint",
  "plugins": [
    "react"
  ],
  "ecmaFeatures": {
    "jsx": true,
    "arrowFunctions": true,
    "blockBindings": true,
    "generators": true
  },
  "rules": {
    "strict": 0,
    "no-underscore-dangle": 0,
    "no-unused-vars": 0,
    "curly": 0,
    "no-multi-spaces": 0,
    "key-spacing": 0,
    "no-return-assign": 0,
    "consistent-return": 0,
    "no-shadow": 0,
    "no-comma-dangle": 0,
    "no-use-before-define": 0,
    "no-empty": 0,
    "new-parens": 0,
    "no-cond-assign": 0,
    "quotes": [2, "single", "avoid-escape"],
    "camelcase": 0,
    "semi": [2, "always"],
    "new-cap": [1, { "capIsNew": false }],
    "no-undef": 2
  },
  "env": {
    "browser": true,
    "node": true
  },
  "globals": {
  }
}
4

2 に答える 2

2

ここで修正を見つけました。

基本的に私のgulpタスクは次のようになります:

gulp.task('lint', function(){
  gulp.src('js/**/*.{js,jsx}')
    .pipe(eslint())
    .pipe(eslint.format())
    .on('data', function(file) {
      if(file.eslint.messages && file.eslint.messages.length){
        gulp.fail = true;
      }
    });

});

process.on('exit', function() {
  if (gulp.fail) {
    process.exit(1);
  }
});

なぜこれが必要なのか、なぜそれが修正されたのかはわかりません。

于 2015-09-05T21:35:47.380 に答える