6

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.

0

4 Answers 4

5

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.

4

I reached here after searching.

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

1

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.

0

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.

Not the answer you're looking for? Browse other questions tagged or ask your own question.