angular - TSLINT 配置 : exclude external modules

标签 angular typescript tslint linter

我正在使用配置了 tslint 的 angular2 webpack starter。

我也使用ngx-datables(直接在node_modules中的目录@swimlane)。

我有很多警告,例如:

 @ ./~/@swimlane/ngx-datatable/src/utils/index.ts 14:0-32
 @ ./~/@swimlane/ngx-datatable/src/components/datatable.component.ts
 @ ./~/@swimlane/ngx-datatable/src/components/index.ts
 @ ./~/@swimlane/ngx-datatable/src/index.ts
 @ ./src/app/adherent/list/adherent-list.component.ts
 @ ./src/app/adherent/list/index.ts
 @ ./src/app/adherent/index.ts
 @ ./src/app/app.module.ts
 @ ./src/app/index.ts
 @ ./src/main.browser.ts
 @ multi (webpack)-dev-server/client?http://localhost:3000 ./src/main.browser.ts

但是,我的配置应该做得很好:

tsconfig.json :

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

tsconfig.webpack.json :

...
"exclude": [
    "node_modules",
    "dist",
    "src/**/*.spec.ts",
    "src/**/*.e2e.ts"
  ],
...

tslint.json :

...
"exclude": [
     "node_modules"
  ],
...

我也试过 "**/node_modules/**"。但是什么都没有改变,我仍然有警告。

最佳答案

您应该对其中的所有文件夹使用/**

"exclude": [
     "node_modules/**"
  ],
...

关于angular - TSLINT 配置 : exclude external modules,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/43273171/

相关文章:

javascript - 为什么启用了 strictNullChecks 的 Typescript 会忽略对 React 状态的 null 检查?

tslint 如何禁用错误 "someVariable is declared but its value is never read"

typescript - 为 TypeScript 文件禁用 ESLint

javascript - 替换 `' react '` with ` "react"` eslint(prettier/prettier)

Angular 自定义错误处理程序未从 promise 中获取错误类型

angular - Angular 7 中名称错误的表单控件没有值访问器

angular - 访问不是组件或 html 标签的组件标签的内部文本?

postgresql - TypeORM:[364] 错误:表 "userorganisation"在字符 401 缺少 FROM 子句条目

css - 如何使用 css 更改 kendo UI angular 中开关的高度和宽度?

typescript 用户定义的类型保护检查对象具有数组中的所有属性