Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
411 views
in Technique[技术] by (71.8m points)

How to ignore/exclude some files/directory from linting in angular cli

Similar to this question

I am running the following command to linting my angular2 typeScript code.

ng lint

It is proving all the linting error nicely.

But I want my vendor folder (let say "src/app/quote/services/generated/**/*") should not get included at the time of lining.

I know this can be done with tslint command as follows (Reference Here)

tslint "src/**/*.ts" -e "**/__test__/**"

But in angular cli what will be the parameter? How to exclude some files from tslint?

Note: My Angular Cli version is : @angular/cli: 1.0.0-rc.0

question from:https://stackoverflow.com/questions/42507838/how-to-ignore-exclude-some-files-directory-from-linting-in-angular-cli

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

From Angular6+, .angular-cli.json has been replaced by angular.json, but you can still add the exclude path in its lint part.

"lint": {
      "builder": "@angular-devkit/build-angular:tslint",
      "options": {
        "tsConfig": [
          "src/tsconfig.app.json",
          "src/tsconfig.spec.json"
        ],
        "exclude": [
          "**/node_modules/**"      // excluded directories
        ]
      }
    }

According to the angular-cli issue#5063, you can add the exclude path in .angular-cli.json like this:

"lint": [
{
  "project": "src/tsconfig.app.json",
  "exclude": "**/node_modules/**/*"   // the node_modules for example
}]

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...