es-analysis / plato

JavaScript source code visualization, static analysis, and complexity tool
MIT License
4.56k stars 322 forks source link

Plato is listing LintErrors not found with ESLint #211

Open matteozambon89 opened 7 years ago

matteozambon89 commented 7 years ago

My gulpfile.js

/**
 * @Author: Matteo Zambon <Matteo>
 * @Date:   2017-07-29 03:24:19
 * @Last modified by:   Matteo
 * @Last modified time: 2017-07-29 09:41:36
 */

const gulp = require('gulp')
const $ = require('gulp-load-plugins')()
const plato = require('plato')
const _ = require('lodash')

const paths = {
  'platoInput': [
    'index.js',
    'gulpfile.js',
    'config/*.js',
    'config/**/*.js',
    'api/*.js',
    'api/**/*.js'
  ],
  'platoOutput': './plato'
}

gulp.task('plato', () => {
  const asyncPipeOpts = {
    'oneTimeRun': true,
    'passThrough': true
  }

  function asyncPipeTask(opts, chunk, cb) {
    const platoOpts = {
      'jshint': null,
      'eslint': require('./.eslintrc.json')
    }
    function callback(report) {
      $.util.log('Report created!')

      cb()
    }

    plato.inspect(paths.platoInput, paths.platoOutput, platoOpts, callback)
  }

  function asyncPipeDone(errs, data) {
    _.each(errs, (err) => {
      if (err.message) {
        $.util.log('Error! ' + err.message)
      }
      else {
        $.util.log('Error!')
      }

      $.util.log(err)
    })
  }

  return gulp.src('./index.js')
    .pipe($.asyncFuncRunner(asyncPipeOpts, asyncPipeTask, asyncPipeDone))
})

This my .eslintrc.json

{
  "extends": "trails",
  "plugins": [
    "markdown",
    "json",
    "mocha"
  ],
  "globals": {
    "test": true
  },
  "rules": {
    "brace-style": [
      "warn",
      "stroustrup",
      {
        "allowSingleLine": true
      }
    ],
    "linebreak-style": [
      "error",
      "unix"
    ]
  }
}

some of the files are shows with 1 lint error but I don't understand which error is since ESLint doesn't show any

unshame commented 7 years ago

I'm using JSHint and had a similar issue (all files showed up with 1 linting error) which I found out was caused by having my .jshintrc extend another one. It seems like plato doesn't support linting config extending since the rules from the parent config weren't being applied to the code. Or maybe it can't find the parent config since it has a different working directory.

andywillis commented 6 years ago

@matteozambon89 @unshame I've found better success with https://github.com/the-simian/es6-plato.

the-simian commented 5 years ago

@matteozambon89 @unshame yeah I fixed this on my fork a while back... I was experiencing the same issue.