Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to define exceptions for nx-lint?

Tags:

I have a readme file which has docs for the folder, the contained libs and how to use them.

The readme is not part of any lib and so nx-lint throws this error:

 NX   ERROR  The following file(s) do not belong to any projects:   
    - libs/global/README.md

How can we suppress this error?

Notes:

  • I don't want to move the file into a lib - the current location is correct
  • I don't want to add something to the readme that is visible
  • Ideally we only suppress this specific error for this file

I tried to use exclude in the top-level tslint.json like this:

{
  "exclude": [
    "libs/global/*.md"
  ]
}
like image 998
TmTron Avatar asked Apr 30 '20 14:04

TmTron


1 Answers

You can use the file .nxignore in the project root to fix this:

$ yarn lint
yarn run v1.22.4
$ nx workspace-lint && nx lint

>  NX   ERROR  The following file(s) do not belong to any projects:

  - libs/global/README.md

error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.

$ echo libs/global/README.md >> .nxignore

$ yarn lint
yarn run v1.22.4
$ nx workspace-lint && nx lint

Linting "server"...

All files pass linting.

✨  Done in 2.45s.
like image 159
beeman Avatar answered Oct 27 '22 11:10

beeman