简体   繁体   English

Angular 2-在我的node_modules文件夹中收到TSLint错误

[英]Angular 2 - Receiving TSLint errors in my node_modules folder

I just installed this angular2-material-datepicker using NPM. 我刚刚使用NPM安装了angular2-material-datepicker It's installed in my node_modules folder, however I receive tslint errors which I shouldn't be getting. 它已安装在我的node_modules文件夹中,但是我收到了我不应该得到的tslint错误。

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

However in my tsconfig.json I clearly state that my node_modules folder should be excluded. 但是,在我的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" ]
}

I confirmed that the module is located in my node_module folder. 我确认该模块位于我的node_module文件夹中。 This is the first module which gives me these errors. 这是给我这些错误的第一个模块。

Any idea for possible solutions? 对可能的解决方案有什么想法?

thanks! 谢谢!

I found out the issue was with webpack. 我发现问题出在webpack。

I had to exclude node_modules over there aswell. 我也不得不在那排除node_modules

So in /config/base.js I excluded it from the rules like this. 因此,在/config/base.js我将其从此类规则中排除。

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

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM