Kim Merino
Kim Merino

Reputation: 286

Spec files are being linted after I included exclude in angular-cli.json

I have an angular 4 app and manually created 2 .spec files for a class. When I run nglint, it will lint the 2 spec files. The spec files that were included when I generated a component with the angular-cli are not being linted however (which is what I want)

I have added the following property to my .angular-cli.json file, but it still lints the files:

"lint": [
    {
      "project": "src/tsconfig.app.json",
      "exclude": "**/**/*.spec.ts"
    },
    {
      "project": "src/tsconfig.spec.json",
      "exclude": "**/**/*.spec.ts"
    },
    {
      "project": "e2e/tsconfig.e2e.json",
      "exclude": "**/**/*.spec.ts"
    }
],

My spec files are located within /src/app/folder/

Upvotes: 2

Views: 2679

Answers (1)

BogdanC
BogdanC

Reputation: 2784

Tried now, once you add "**/**/*.spec.ts" to angular-cli.json - lint - exclude, it will stop linting any .spec file down from the app folder, no mater how deep you nest the folders.

This is the angular-cli.json code I tested with:

"lint": [
    {
      "project": "src/tsconfig.app.json",
      "exclude": "**/node_modules/**"
    },
    {
      "project": "src/tsconfig.spec.json",
      "exclude": ["**/node_modules/**", "**/**/*.spec.ts"]
    },
    {
      "project": "e2e/tsconfig.e2e.json",
      "exclude": "**/node_modules/**"
    }
  ],

Upvotes: 2

Related Questions