Search code examples
angulartypescripttslintlinter

TSLINT config : exclude external modules


I'm using angular2 webpack starter with tslint configured on it.

I also use ngx-datables (directory @swimlane directly in node_modules).

I have plenty of warnings like :

 @ ./~/@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

However, my configs are supposed to be well done :

tsconfig.json :

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

tsconfig.webpack.json :

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

tslint.json :

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

I've also tried with "**/node_modules/**". But nothing changed, i still have the warnings.


Solution

  • I'm using the same angular2-starter with webpack, the solution for me was add node_modules folder to exclude, it was inside the webpack.dev.js file, I have changed:

    exclude: [/\.(spec|e2e)\.ts$/]
    

    to

    exclude: [/\.(spec|e2e)\.ts$/, /node_modules/]
    

    And worked, the solution that provided from @Aravind not worked sadly.