Skip to content

Unclear error when .jscsrc is missing #103

@VWoeltjen

Description

@VWoeltjen

As a new jscs and current gulp user, I tried to get started by using gulp-jscs in my build. Ran into an error pretty quickly. Was able to reproduce in a simplified case and ultimately resolve.

My gulpfile.js:

var gulp = require('gulp'),
    jscs = require('gulp-jscs');

gulp.task('check', function () {
    return gulp.src('src')
        .pipe(jscs())
        .pipe(jscs.reporter());
});

With which I encounter the following error:

$ gulp check
[14:07:25] Using gulpfile /some/path/gulpfile.js
[14:07:25] Starting 'check'...
[14:07:25] 'check' errored after 147 ms
[14:07:25] TypeError: Object.keys called on non-object
    at Function.keys (native)
    at copyConfiguration (/some/path/node_modules/gulp-jscs/node_modules/jscs/lib/config/configuration.js:1187:12)
    at NodeConfiguration.Configuration._processConfig (/some/path/node_modules/gulp-jscs/node_modules/jscs/lib/config/configuration.js:474:5)
    at NodeConfiguration.Configuration.load (/some/path/node_modules/gulp-jscs/node_modules/jscs/lib/config/configuration.js:238:10)
    at StringChecker.configure (/some/path/node_modules/gulp-jscs/node_modules/jscs/lib/string-checker.js:67:29)
    at Checker.configure (/some/path/node_modules/gulp-jscs/node_modules/jscs/lib/checker.js:28:39)
    at module.exports (/some/path/node_modules/gulp-jscs/index.js:35:10)
    at Gulp.<anonymous> (/some/path/gulpfile.js:6:15)
    at module.exports (/some/path/node_modules/gulp/node_modules/orchestrator/lib/runTask.js:34:7)
    at Gulp.Orchestrator._runTask (/some/path/node_modules/gulp/node_modules/orchestrator/index.js:273:3)

To self-debug, I tried running the same under plain jscs:

$ jscs src
No configuration found. Add a .jscsrc file to your project root or use the -c option.

Creating a .jscsrc file resolved both problems. Expect it would be useful for other new users to see a similar error message from gulp-jscs in this case

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions