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

JSCS reporter compatibility #113

Open
VWoeltjen opened this issue Jul 20, 2016 · 2 comments
Open

JSCS reporter compatibility #113

VWoeltjen opened this issue Jul 20, 2016 · 2 comments

Comments

@VWoeltjen
Copy link

VWoeltjen commented Jul 20, 2016

I'm having some compatibility issues when trying to use the jscs-html-reporter

This works fine:

$ jscs src/ --reporter jscs-html-reporter
>> jscs report written to /.../jscs-html-report.html
Too many errors... Increase `maxErrors` configuration option value to see more.

But this does not:

gulp.task('checkstyle', function () {
    return gulp.src(paths.scripts)
        .pipe(jscs())
        .pipe(jscs.reporter('jscs-html-reporter'));
});

When I run this task, I hit an error with that reporter:

$ gulp checkstyle
[13:03:42] Using gulpfile ~/.../gulpfile.js
[13:03:42] Starting 'checkstyle'...
/.../jscs-html-reporter.js:14
    var config = this.options || this,
                     ^

TypeError: Cannot read property 'options' of undefined
  at module.exports (/.../node_modules/jscs-html-reporter/jscs-html-reporter.js:14:22)
  at DestroyableTransform._transform (/.../node_modules/gulp-jscs/reporters/index.js:21:4)

(Full stack trace omitted for brevity.)

I'm guessing there is some difference between the way jscs normally invokes a reporter, and the way it's getting invoked from gulp-jscs. It would be useful to have sufficient compatibility with vanilla jscs to use this reporter.

I have found the gulp-jscs-with-reporter and gulp-jscs-html-reporter projects, which provide a workaround to this, but I would prefer not to switch to a fork of gulp-jscs for this one feature.

@VWoeltjen
Copy link
Author

Supporting a jshint-like syntax for reporter options would also be useful, e.g.:

gulp.task('checkstyle', function () {
    return gulp.src(paths.scripts)
        .pipe(jscs())
        .pipe(jscs.reporter('jscs-html-reporter', {
            reporterOutput: __dirname + "/jscs-report.html"
        }));
});

@aj-dev
Copy link

aj-dev commented Nov 7, 2016

@VWoeltjen just an FYI - I have added support for gulp-jscs to jscs-html-reporter.

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