2017-04-05 1 views
-2

を許可されていない私は、次のimport文TSLINT:への呼び出しが「_.isNull」

import * as _ from 'lodash'; 

経由lodashを使用して角度2プロジェクトを持っている私はlodashのIsNull関数

onClick(){ 
    var type = _.isNull(id) ? 'new' : 'update'; 

    this.modelChange.fire(this.modelName, type, { id: id, name: this.nameControl.value}); 
} 
にアクセスするいくつかのコードを持っています

TSLintがこの警告をスローし、解決方法がわかりません。

[39,20]: '_.isNull'への呼び出しは許可されません。ここで

は私tslint.jsonある

{ 
    "rulesDirectory": [ 
    "node_modules/codelyzer" 
    ], 
    "rules": { 
    "use-input-property-decorator": true, 
    "use-output-property-decorator": true, 
    "use-host-property-decorator": true, 
    "no-attribute-parameter-decorator": true, 
    "no-input-rename": true, 
    "no-output-rename": true, 
    "no-forward-ref" :true, 
    "no-trailing-whitespace": false, 
    "use-life-cycle-interface": true, 
    "use-pipe-transform-interface": true, 
    "pipe-naming": [true, "camelCase", "my"], 
    "component-class-suffix": true, 
    "directive-class-suffix": true, 
    "ban": [true, 
     ["_", "extend"], 
     ["_", "isNull"], 
     ["_", "isDefined"] 
    ], 
    "class-name": true, 
    "comment-format": [false, 
     "check-space", 
     "check-lowercase" 
    ], 
    "curly": true, 
    "eofline": true, 
    "forin": true, 
    "indent": [true, 2], 
    "interface-name": true, 
    "jsdoc-format": true, 
    "label-position": true, 
    "max-line-length": [false, 140], 
    "member-ordering": [true, 
     "public-before-private", 
     "static-before-instance", 
     "variables-before-functions" 
    ], 
    "no-arg": true, 
    "no-bitwise": true, 
    "no-console": [true, 
     "debug", 
     "info", 
     "time", 
     "timeEnd", 
     "trace" 
    ], 
    "no-construct": true, 
    "no-debugger": true, 
    "no-duplicate-variable": true, 
    "no-empty": true, 
    "no-eval": true, 
    "no-string-literal": false, 
    "no-switch-case-fall-through": true, 
    "trailing-comma": true, 
    "no-trailing-whitespace": true, 
    "no-unused-expression": true, 
    "no-use-before-declare": true, 
    "no-var-requires": true, 
    "one-line": [true, 
     "check-open-brace", 
     "check-catch", 
     "check-else", 
     "check-whitespace" 
    ], 
    "quotemark": [true, "single"], 
    "radix": true, 
    "semicolon": true, 
    "triple-equals": [true, "allow-null-check"], 
    "typedef": [true, 
     "callSignature", 
     "indexSignature", 
     "parameter", 
     "propertySignature", 
     "variableDeclarator" 
    ], 
    "typedef-whitespace": [true, 
     ["callSignature", "noSpace"], 
     ["catchClause", "noSpace"], 
     ["indexSignature", "space"] 
    ], 
    "variable-name": false, 
    "whitespace": [true, 
     "check-branch", 
     "check-decl", 
     "check-operator", 
     "check-separator", 
     "check-type" 
    ] 
    } 
} 

答えて

4

あなたtslint.json禁止ルールを確認してください。そこにはisNullの項目があります。これは、あなたが糸くずれの警告を持っている理由です。

関連する問題