2017-03-22 11 views
1

sails-eslintフックは( `帆-eslint`)

追加をインストールすることで投影する同じ エラー

"npm": "5.0.2" 
"sails": "~0.12.13", 
"sails-disk": "~0.10.9", 
"sails-eslint": "^1.0.9", 
"sails-hook-eslint": "^1.0.3", 
"sails-mysql": "^0.11.5" 

sails-hook-eslint is not helpful to resolve the error mentioned below: 

設定された糸くずを投げ最新sails-eslint版としてこれを再オープンロードに失敗しましたeslint.jsconfigフォルダ:

module.exports.eslint = { 
    active: true, 
    usePolling: false, 
    formatter: 'stylish', 
    dirs: [ 
    "api", 
    "config" 
    ], 
    ignored: [ 
    "api/policies" 
    ] 
}; 

しかし、アプリケーションを実行しようとしたとき、それは以下のようなエラーがスローされます。

info: ESlint watching... 
error: A hook (`sails-eslint`) failed to load! 
Code did not pass lint rules 
c:\Projects\test\api\controllers\UsersController.js 
    10:4 error 'Users' is not defined  no-undef 
    10:22 error Expected error to be handled handle-callback-err 
    15:4 error 'Users' is not defined  no-undef 
    15:50 error Expected error to be handled handle-callback-err 

c:\Projects\test\api\policies\sessionAuth.js 
    10:25 error Missing space before function parentheses space-before-function-parentheses 
    12:50 error Trailing spaces not allowed    no-trailing-spaces 

c:\Projects\test\api\responses\badRequest.js 
    29:2 error Expected { after 'else'              curly 
    30:64 error A space is required after ','             comma-spacing 
    53:38 error Expected literal to be on the right side of ==        yoda 
    57:4 error Closing curly brace does not appear on the same line as the subsequent block brace-style 
    65:2 error Expected { after 'else'              curly 
    71:96 error Unexpected space before function parentheses         space-before-function-parentheses 

c:\Projects\test\api\responses\created.js 
    14:33 error Unexpected space before function parentheses         space-before-function-parentheses 
    38:38 error Expected literal to be on the right side of ==        yoda 
    42:4 error Closing curly brace does not appear on the same line as the subsequent block brace-style 
    50:2 error Expected { after 'else'              curly 
    56:92 error Unexpected space before function parentheses         space-before-function-parentheses 

c:\Projects\test\api\responses\forbidden.js 
    15:35 error Unexpected space before function parentheses         space-before-function-parentheses 
    26:2 error Expected { after 'else'              curly 
    27:62 error A space is required after ','             comma-spacing 
    50:38 error Expected literal to be on the right side of ==        yoda 
    54:4 error Closing curly brace does not appear on the same line as the subsequent block brace-style 
    62:2 error Expected { after 'else'              curly 
    76:118 error A space is required after ','             comma-spacing 
    79:11 error Closing curly brace does not appear on the same line as the subsequent block brace-style 

c:\Projects\test\api\responses\notFound.js 
    20:34 error Unexpected space before function parentheses         space-before-function-parentheses 
    31:2 error Expected { after 'else'              curly 
    32:62 error A space is required after ','             comma-spacing 
    55:38 error Expected literal to be on the right side of ==        yoda 
    59:4 error Closing curly brace does not appear on the same line as the subsequent block brace-style 
    67:2 error Expected { after 'else'              curly 
    81:117 error A space is required after ','             comma-spacing 
    84:11 error Closing curly brace does not appear on the same line as the subsequent block brace-style 

c:\Projects\test\api\responses\ok.js 
    14:32 error Unexpected space before function parentheses         space-before-function-parentheses 
    38:38 error Expected literal to be on the right side of ==        yoda 
    42:4 error Closing curly brace does not appear on the same line as the subsequent block brace-style 
    50:2 error Expected { after 'else'              curly 
    56:87 error Unexpected space before function parentheses         space-before-function-parentheses 

c:\Projects\test\api\responses\serverError.js 
    15:37 error Unexpected space before function parentheses         space-before-function-parentheses 
    26:2 error Expected { after 'else'              curly 
    27:63 error A space is required after ','             comma-spacing 
    50:38 error Expected literal to be on the right side of ==        yoda 
    54:4 error Closing curly brace does not appear on the same line as the subsequent block brace-style 
    62:2 error Expected { after 'else'              curly 
    76:120 error A space is required after ','             comma-spacing 
    79:11 error Closing curly brace does not appear on the same line as the subsequent block brace-style 

✖ 46 problems (46 errors, 0 warnings) 

Code did not pass lint rules 
c:\Projects\test\config\bootstrap.js 
    12:35 error Missing space before function parentheses space-before-function-parentheses 

c:\Projects\test\config\connections.js 
    47:18 error Expected exception block, space or tab after // in comment spaced-line-comment 
    48:23 error Expected exception block, space or tab after // in comment spaced-line-comment 
    52:3 error Unexpected trailing comma         comma-dangle 

c:\Projects\test\config\eslint.js 
    6:4 error Strings must use singlequote quotes 
    7:4 error Strings must use singlequote quotes 
    10:4 error Strings must use singlequote quotes 

c:\Projects\test\config\http.js 
    80:3 error Unexpected trailing comma comma-dangle 

c:\Projects\test\config\session.js 
    24:44 error Unexpected trailing comma comma-dangle 

c:\Projects\test\config\sockets.js 
    54:0 error Multiple blank lines not allowed no-multiple-empty-lines 
    71:0 error Multiple blank lines not allowed no-multiple-empty-lines 

c:\Projects\test\config\views.js 
    95:1 error Newline required at end of file but not found eol-last 

✖ 12 problems (12 errors, 0 warnings) 

error: TypeError: Expected `input` to be a `string`, got `number` 
    at module.exports (c:\Projects\test\node_modules\repeating\index.js:6:9) 
    at c:\Projects\test\node_modules\sails-eslint\pretty-formatter.js:95:17 
    at Array.map (native) 
    at module.exports (c:\Projects\test\node_modules\sails-eslint\pretty-formatter.js:84:21) 
    at runLint (c:\Projects\test\node_modules\sails-eslint\index.js:28:7) 
    at c:\Projects\test\node_modules\sails-eslint\index.js:52:7 
    at Array.forEach (native) 
    at processingQueue (c:\Projects\test\node_modules\sails-eslint\index.js:46:8) 
    at Hook.initialize (c:\Projects\test\node_modules\sails-eslint\index.js:140:9) 
    at Hook.wrapper [as initialize] (c:\Projects\test\node_modules\@sailshq\lodash\lib\index.js:3250:19) 
    at c:\Projects\test\node_modules\sails\lib\hooks\index.js:88:16 
    at c:\Projects\test\node_modules\sails\node_modules\async\lib\async.js:52:16 
    at c:\Projects\test\node_modules\sails\node_modules\async\lib\async.js:548:17 
    at c:\Projects\test\node_modules\sails\node_modules\async\lib\async.js:542:17 
    at _arrayEach (c:\Projects\test\node_modules\sails\node_modules\async\lib\async.js:85:13) 
    at Immediate.taskComplete (c:\Projects\test\node_modules\sails\node_modules\async\lib\async.js:541:13) 
    at runCallback (timers.js:672:20) 
    at tryOnImmediate (timers.js:645:5) 
    at processImmediate [as _immediateCallback] (timers.js:617:5) 

いただきましたコードが間違っていますか?

また、babel-eslintを使用する可能性はありますか?

答えて

0

sails-hook-eslintプラグインを使用できます。 sails-eslintは私にとってもうまくいきません。その後

https://github.com/Globegitter/sails-hook-eslint

npm install sails-hook-eslint 

帆のルートに.eslintrcファイルを追加します。

セーリングリフトを開始すると、糸くずれ作業が実行されます。 また、新しいeslintを使用したい場合。私はそのためにPRをしました。 https://github.com/Globegitter/sails-hook-eslint/pull/8