gulp-flowtype icon indicating copy to clipboard operation
gulp-flowtype copied to clipboard

gulp-flowtype is not working for me. Not finding errors. Long running time.

Open saginadir opened this issue 8 years ago • 10 comments

I am not sure why, when I use gulp-typeflow it takes 12s to run the code and it finds 0 erros, while running "flow" command finds errors missed by gulp-typeflow.

I've replaced gulp meanwhile to work with regular 'flow' cmd command which works with the .flowconfig settings

Previous flow task ( with gulp-flowtype )

gulp.task('flowtypeSrc', () =>
  gulp.src(paths.srcJs)
    .pipe(flow({
      all: true,
      weak: false,
      declarations: './flow-typed/npm',
      killFlow: false,
      beep: true,
      abort: true,
    })) // Add Flow here
);

Output: ... ✔ Flow has found 0 errors [12:22:05] Finished 'flowtypeSrc' after 11 s ...

Actually fails to find erros... and runs 11 seconds.

My current flow task:

gulp.task('flowtypeSrc', () => {
  try {
    execSync('./node_modules/.bin/flow', { stdio: 'inherit' });
  } catch (e) {
    gulp.stop();
  }
});

Output: ... Found 1 error [12:14:17] Finished 'flowtypeSrc' after 308 ms ...

I hope to contribute when I get the time, meanwhile this is a valid solution for others with the same problem.

saginadir avatar Nov 22 '16 10:11 saginadir

+1

faceyspacey avatar Jan 20 '17 12:01 faceyspacey

@saginadir what does your replacement gulp task look like?

faceyspacey avatar Jan 20 '17 13:01 faceyspacey

@faceyspacey Here it is:

gulp.task('flowtypeSrc', () => {
  try {
    execSync('./node_modules/.bin/flow', { stdio: 'inherit' });
  } catch (e) {
    if (!e.message.match(new RegExp('Command failed','i'))) {
      console.log(e);
    }
    gulp.stop();
  }
});

It's es6

Notice I am running ./node_modules/.bin/flow command Just make sure flow-bin npm package is installed.

saginadir avatar Jan 20 '17 13:01 saginadir

@saginadir thanks brother!

faceyspacey avatar Jan 20 '17 13:01 faceyspacey

The same is happening to me, I have the setup from this tutorial

alexxmde-zz avatar Nov 25 '17 14:11 alexxmde-zz

It's my first time using gulp and flow, but I will try to find the issue, as this weekend my wife is out, so I'll bring the party home 🍺 👊 🍻

alexxmde-zz avatar Nov 25 '17 14:11 alexxmde-zz

I have opened a PR to solve that. Basically the application was ignoring all stderr outputs and understanding no outputs as a no errors check.

alexxmde-zz avatar Nov 25 '17 17:11 alexxmde-zz

@alexxmde Gotcha Alex :) nice find.

This library seems unmaintained for several years, and it has it's reasons

  1. Gulp is not as used anymore - webpack does a lot of the work these days with the -w flag that watches for changes and recompiles
  2. Most tools come with -w flag that reruns on file change and makes gulp further obsolete
  3. npm can have custom scripts which you can run like "npm run install" or "npm run build" and it further obsoletes gulp
  4. I was just using flow in my JetBrains IDE which gives you the errors in the IDE

But still nice catch :) brings me peace to know it's solved.

saginadir avatar Nov 26 '17 13:11 saginadir

Hi all,

@saginadir lists the exact reasons for why I stopped maintaining this project along with being unable to keep up with Flow API changes (I hacked this module together the night that Flow was released 😅, a lot has changed).

I appreciate the contribution @alexxmde, I'll check out your PR.

Cheers, Charlie

charliedowler avatar Nov 29 '17 18:11 charliedowler

Seems to be a problem in the executable flow file that is located in node_modules/gulp-flowtype/node_modules/flow-bin/vendor/flow. Solved this problem by installing flow-bin yarn add --dev flow-bin and pointing the path to flow process.env.FLOW_BIN = path.resolve(__dirname, 'node_modules/.bin/flow'). Now everything works like a charm.

alexei-bykovski avatar Mar 07 '18 09:03 alexei-bykovski