2017-03-06 62 views
0

我剛剛使用NPM安裝了此angular2-material-datepicker。它安裝在我的node_modules文件夾中,但我收到tslint錯誤,我不應該得到。Angular 2 - 在我的node_modules文件夾中接收到TSLint錯誤

ERROR in ./~/angular2-material-datepicker/index.ts 
[1, 15]: ' should be " 

但是在我tsconfig.json我明確指出,我node_modules文件夾應排除在外。

{ 
    "compilerOptions": { 
    "target": "es5", 
    "module": "commonjs", 
    "moduleResolution": "node", 
    "sourceMap": true, 
    "emitDecoratorMetadata": true, 
    "experimentalDecorators": true, 
    "lib": [ "es2016", "dom" ], 
    "noImplicitAny": true, 
    "noImplicitReturns": true, 
    "suppressImplicitAnyIndexErrors": true, 
    "skipLibCheck": true 
    }, 

    "include": [ 
    "client/**/*" 
    ], 

    "exclude": [ "node_modules", "dist" ] 
} 

我確認該模塊位於我的node_module文件夾中。這是第一個給我這些錯誤的模塊。

任何想法可能的解決方案?

謝謝!

+0

不知道這是問題..但我認爲它應該是' 「LIB」: 「ES2015」, 「DOM」]' –

+1

@suraj' 「LIB」: 「ES2015」 「dom」]''''lib「:[」es2016「,」dom「]'和''lib」:[「es2015」,「dom」]'和其他許多字符一樣都是有效的。 –

+0

尋找在TSLINT網站上的忽略選項,我現在沒有它的方便,但這就是你需要使用 –

回答

1

我發現問題是與webpack。我不得不在那邊排除node_modules

所以在/config/base.js我排除了這樣的規則。

module: { 
     rules: [ 
      { 
       enforce: 'pre', 
       test: /\.ts$/, 
       loader: 'tslint-loader', 
       options: { 
        emitErrors: true, 
        failOnHint: true 
       }, 
       exclude: /node_modules/ 
      }, 
相關問題