Patrick
Patrick

Reputation: 389

Invalid lint configuration, nothing to lint

I am currently migrating from tslint to eslint. I have configured a few folders in my .eslintignore, which i would like to completely ignore from linting. This does work but now i am getting the error:

"Invalid lint configuration. Nothing to lint."

The lint commands fails even though it would be ok if there are no files to lint.

Upvotes: 6

Views: 7539

Answers (4)

Raul Buffon
Raul Buffon

Reputation: 101

This problem probably is happening because you have any misconfiguration in your angular.json for the project lint. I had the same issue because my project was using a custom sourceRoot and the migration tool don't figured out it. You can see an example below before migrate:

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

After code migration:

"lint": {
  "builder": "@angular-eslint/builder:lint",
  "options": {
    "lintFilePatterns": [
      "src/**/*.ts",
      "src/**/*.html"
    ]
  }
}

Verify and if possible compare both lints to see if something like this is happening.

Upvotes: 5

Aymen
Aymen

Reputation: 133

I reached here after searching.

My issue was that I run lint not in the root directory of nx

Upvotes: 4

Mohsen
Mohsen

Reputation: 1118

I had the same problem. My problem was that in my angular.json file the urls were not correct for those projects that caused such an exception. For example, in the angular.json file each project has properties like root, sourceRoot, jestConfig and lintFilePatterns. These properties should correctly refer to their related folders.

Upvotes: 0

Natalia Cáceres
Natalia Cáceres

Reputation: 468

I just bumped into this today. I got it fixed by tracing back my eslint configurations and comparing it against working projects (my eslint.json project file had a typo in its name). double check eslint.json file names, and routes if it is extending any global or parent config file.

you can also try using the errorOnUnmatchedPattern flag if you still have nothing to lint but you don't want lint to fail because there is nothing to lint.

Upvotes: 1

Related Questions