Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adding a note about react files. #5

Open
BerkeleyTrue opened this issue Sep 16, 2014 · 1 comment
Open

Adding a note about react files. #5

BerkeleyTrue opened this issue Sep 16, 2014 · 1 comment

Comments

@BerkeleyTrue
Copy link
Contributor

I am currently using this to lint some JSX/React files, as well as regular js files. I would pipe in the files into gulp-react and then pipe them into gulp-gjslint. These files are always transformed/compiled on the fly so there is no compiled destination files.

The current way this plugin works, it does not work on the pipped files directly, but uses the paths of those files to feed into closure-linter-wrapper. Because of this, files transformed are sourced again from the untransformed files and then fed to closure linter.

This is probably an edge case but it would be nice to add a note in the README stating that it does not work on streamed files, but on files located on disk. This also changes the file paths so if you have multiple files with same name you will not be able to tell which is which.

For those interested in a work around

gulp.task('lint', function() {
  return gulp.src('./**/*.js')
    .pipe(react())
    .pipe(gulp.dest('./tmp')) // Write to disk
    .pipe(gjslint({ flags: ['--nojsdoc'] }))
    .pipe(gjslint.reporter('console'))
    .pipe(clean()); //Deletes the generated files
});
@TomSeldonBoxUK
Copy link
Collaborator

Thanks for this.

When I get time, I'll look into seeing if there's a simple way of dealing with the file contents from the stream, rather than reading to contents from disk every time (which would also speed things up a fair bit).

Currently, I think the limitation lies with the closure-linter-wrapper dependency, as that just takes a list of source file locations and generates a command to run, using the file path(s).

e.g. when using closure-linter-wrapper, it expects to be passed an array of source file locations.

gjslint({
    src: ['./path/to/file.js']
}, callback);

Which runs:

python path/to/gjslint.py ./path/to/file.js

Your workaround would work... though I'd be interested to see if something similar could be built into this plugin.

For now though, happy to leave this issue open and will update the readme when I get a chance.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants