jscs-dev/gulp-jscs

TypeError: Cannot convert undefined or null to object at Function.keys

michtio opened this issue ยท 4 comments

I'm trying creating a task to check my js, but every time I call the function it fails:

my code (just stripped it down to the essentials):

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

gulp.task('lintjs', function(){
  gulp.src(['./app/js/**/*.js','./.tmp/js/**/*.js','./gulpfile.js','./tools/**/*.js'])
    .pipe(jscs())
    .pipe(jscs.reporter())
});

the error:

[11:25:13] Starting 'lintjs'...
[11:25:14] 'lintjs' errored after 305 ms
[11:25:14] TypeError: Cannot convert undefined or null to object
  at Function.keys (native)
  at copyConfiguration (/Users/mike/Development/lighthouse-    workflow/node_modules/jscs/lib/config/configuration.js:1181:12)
  at NodeConfiguration.Configuration._processConfig (/Users/mike/Development/lighthouse-workflow/node_modules/jscs/lib/config/configuration.js:474:5)
  at NodeConfiguration.Configuration.load (/Users/mike/Development/lighthouse-workflow/node_modules/jscs/lib/config/configuration.js:238:10)
  at [object Object].StringChecker.configure (/Users/mike/Development/lighthouse-workflow/node_modules/jscs/lib/string-checker.js:67:29)
  at [object Object].Checker.configure (/Users/mike/Development/lighthouse-workflow/node_modules/jscs/lib/checker.js:28:39)
  at module.exports (/Users/mike/Development/lighthouse-workflow/node_modules/gulp-jscs/index.js:35:10)
  at Gulp.<anonymous> (/Users/mike/Development/lighthouse-workflow/tools/devtasks/linting.js:90:13)
  at module.exports (/Users/mike/Development/lighthouse-workflow/node_modules/orchestrator/lib/runTask.js:34:7)
  at Gulp.Orchestrator._runTask (/Users/mike/Development/lighthouse-workflow/node_modules/orchestrator/index.js:273:3)
  at Gulp.Orchestrator._runStep (/Users/mike/Development/lighthouse-workflow/node_modules/orchestrator/index.js:214:10)
  at Gulp.Orchestrator.start (/Users/mike/Development/lighthouse-workflow/node_modules/orchestrator/index.js:134:8)
  at /usr/local/lib/node_modules/gulp/bin/gulp.js:129:20
  at doNTCallback0 (node.js:430:9)
  at process._tickCallback (node.js:359:13)
  at Function.Module.runMain (module.js:459:11)
  at startup (node.js:138:18)
  at node.js:974:3

apparently a .jscsrc file is required. Maybe write that down in your docs, it's obligatory to create such a file? With a .jscsrc file I don't get any errors.

Hey @mike-lighthouse,
I have exactly the same issue it doesn't seems working even with the .jscsrc file.
Where did you put your file?

put the .jscsrc file where the gulpfile.js is (or I think where gulp can find it)

I have same eror pls help !!!!!!!!! i have .jscrc file