如何为nx-lint定义例外?

问题描述 投票:0回答:1

我有一个自述文件,其中包含该文件夹的文档,所包含的库以及如何使用它们。

自述文件不属于任何库,因此nx-lint会引发此错误:

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

我们如何抑制此错误?

注意:

  • 我不想将文件移动到lib中-该文件位于当前位置。
  • 我不想在可见的自述文件中添加一些内容
  • 理想情况下,我们仅抑制此文件的特定错误

我试图在顶级tslint.json中使用exc这样:

{
   "exclude": [
      "libs/global/*.md"
    ],
lint nrwl-nx
1个回答
0
投票

您可以使用项目根目录中的文件.nxignore修复此问题:

$ 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/globals/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/globals/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.
© www.soinside.com 2019 - 2024. All rights reserved.