Ionic-app-scripts: Exclude files from tslint

Created on 28 Nov 2016  路  3Comments  路  Source: ionic-team/ionic-app-scripts

Tslint shows errors even for external typescript libraries inside the node_modules folder. I think it would be a good idea to exclude the node_modules folder from tslint or (even better) to create a configuration option for excluding file patterns

Most helpful comment

I still see vendor code from node_modules being linted

In my case it is the ng2-img-cropper module that gets linted.
tslint: node_modules/ng2-img-cropper/src/model/point.ts

my tsconfig.json is

{
  "compilerOptions": {
    "allowSyntheticDefaultImports": true,
    "declaration": false,
    "emitDecoratorMetadata": true,
    "experimentalDecorators": true,
    "lib": [
      "dom",
      "es2015"
    ],
    "module": "es2015",
    "moduleResolution": "node",
    "sourceMap": true,
    "target": "es5"
  },
  "exclude": [
    "node_modules"
  ],
  "include": [
    "src/**/*.ts"
  ],
 "compileOnSave": false,
  "atom": {
    "rewriteTsconfig": false
  }
}

All 3 comments

This should be resolved now. In our tsconfig.json we exclude node_modules.

Thanks,
Dan

I still see vendor code from node_modules being linted

In my case it is the ng2-img-cropper module that gets linted.
tslint: node_modules/ng2-img-cropper/src/model/point.ts

my tsconfig.json is

{
  "compilerOptions": {
    "allowSyntheticDefaultImports": true,
    "declaration": false,
    "emitDecoratorMetadata": true,
    "experimentalDecorators": true,
    "lib": [
      "dom",
      "es2015"
    ],
    "module": "es2015",
    "moduleResolution": "node",
    "sourceMap": true,
    "target": "es5"
  },
  "exclude": [
    "node_modules"
  ],
  "include": [
    "src/**/*.ts"
  ],
 "compileOnSave": false,
  "atom": {
    "rewriteTsconfig": false
  }
}

@danbucholtz How? e.g. exclude src/models does not work for the linter. He still scans this folder.
I expected a property in tslint.json exclude and / or include. I use ionic app scripts.
It's right that tsconfig.ts exclude should also work for the linter. But what's wrong in my case?
I also tried src/models/**

Background src/models are auto-generated files. I do not want to lint them.

Update (a second later 馃槃 )
Ok, nevermind: "**/src/models/**" works.

Update
This does not work for the build. Only for the linter.
Error: File specification cannot contain multiple recursive directory wildcards ('**'): **/src/models/**
Ok, I can try some other variations and read the specification of this syntax. 馃槃 Any suggestions?

Only **/src/models/** works. Same in settings.json of VS Code.
Btw. in include is src/**/*.ts

Was this page helpful?
0 / 5 - 0 ratings