2016-11-23 13 views
4

をobjectに未定義またはnull変換できません:ガルプJscs - 例外TypeError:それは<a href="https://github.com/jscs-dev/gulp-jscs" rel="nofollow noreferrer">documentation</a>に応じて、私は私のプロジェクトでがぶ飲み-jscsを使用していたので、私はインストールした

npm install --save-dev gulp-jscs 

しかし、私が実行しようとします一気ファイル、私はこのエラーを取得しています:

TypeError: Cannot convert undefined or null to object 
    at Function.keys (native) 
    at copyConfiguration (C:\Users\[User]\Desktop\[Project]\ 
    node_modules\jscs\lib\config\configuration.js:920:12) 

はまた、これに関連する他のエラーがあります

at NodeConfiguration.Configuration. 
_processConfig([location-path]\node_modules\jscs\lib\config\configuration.js:459:5) 
    at NodeConfiguration.Configuration.load 
([location-path]\node_modules\jscs\lib\config\configuration.js:211:10) 
    at null.StringChecker.configure 
([location-path]\node_modules\jscs\lib\string-checker.js:62:29) 
    at null.Checker.configure ([location-path]\node_modules\jscs\lib\checker.js:27:39) 
    at Object.module.exports ([location-path]\node_modules\gulp-jscs\index.js:35:10) 
    at Gulp.<anonymous> ([location-path]\Gulpfile.js:60:17) 
    at module.exports ([location-path]\node_modules\orchestrator\lib\runTask.js:34:7) 
    at Gulp.Orchestrator._runTask ([location-path]\node_modules\orchestrator\index.js:273:3) 
Process terminated with code 1. 

答えて

8

プロジェクトのルートに.jscsrcというファイルが存在する必要があります。そこにはoptions for JSCSと同様にthe code style rulesを提供することができます。

以下は.jscsrcです(used by node-jscs project itself)。これを使用して、自分の設定をベースにすることができます。

{ 
    "preset": "google", 
    "fileExtensions": [".js", "jscs"], 

    "requireSemicolons": true, 
    "requireParenthesesAroundIIFE": true, 
    "maximumLineLength": 120, 
    "validateLineBreaks": "LF", 
    "validateIndentation": 4, 
    "disallowTrailingComma": true, 
    "disallowUnusedParams": true, 

    "disallowSpacesInsideObjectBrackets": null, 
    "disallowImplicitTypeConversion": ["string"], 

    "safeContextKeyword": "_this", 

    "jsDoc": { 
     "checkAnnotations": "closurecompiler", 
     "checkParamNames": true, 
     "requireParamTypes": true, 
     "checkRedundantParams": true, 
     "checkReturnTypes": true, 
     "checkRedundantReturns": true, 
     "requireReturnTypes": true, 
     "checkTypes": "capitalizedNativeCase", 
     "checkRedundantAccess": true, 
     "requireNewlineAfterDescription": true 
    }, 

    "excludeFiles": [ 
     "test/data/**", 
     "patterns/*" 
    ] 
} 

あなた.jscsrc"preset"を持っているか、明示的に従うべきであるrulesを指定していない限り、jscsは、実際には何をチェックしないことに注意してください。

関連する問題

 関連する問題