Angular 2 - 在我的node_modules文件夹中接收到TSLint错误
问题描述:
我刚刚使用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
文件夹中。这是第一个给我这些错误的模块。
任何想法可能的解决方案?
谢谢!
答
我发现问题是与webpack。我不得不在那边排除node_modules
。
所以在/config/base.js
我排除了这样的规则。
module: {
rules: [
{
enforce: 'pre',
test: /\.ts$/,
loader: 'tslint-loader',
options: {
emitErrors: true,
failOnHint: true
},
exclude: /node_modules/
},
不知道这是问题..但我认为它应该是' “LIB”: “ES2015”, “DOM”]' –
@suraj' “LIB”: “ES2015” “dom”]''''lib“:[”es2016“,”dom“]'和''lib”:[“es2015”,“dom”]'和其他许多字符一样都是有效的。 –
寻找在TSLINT网站上的忽略选项,我现在没有它的方便,但这就是你需要使用 –