简体   繁体   English

如何在 NX 工作区 (nrwl) 中忽略来自 eslint 的特定文件/文件夹

[英]How to ignore specific files/folders from eslint within NX workspaces (nrwl)

I have a huge project that we want to convert from tslint to eslint.我有一个庞大的项目,我们想将其从 tslint 转换为 eslint。 Because its so big we want to do this in small chunks which is why we want to be able to ignore folders.因为它太大了,所以我们想以小块的方式执行此操作,这就是我们希望能够忽略文件夹的原因。 Does anyone know how to do this?有谁知道如何做到这一点?

I have tried to add "[exclude":["my main app here"]我试图添加"[exclude":["my main app here"]

However when I add this exclude to the workspace.json I get an error "exclude is not found in schema"?但是,当我将此排除添加到工作区时。json 出现错误“在架构中找不到排除”?

I am not sure if this is the correct way to ignore these files?我不确定这是否是忽略这些文件的正确方法?

any help is greatly appreciated:)任何帮助是极大的赞赏:)

The reason no answers have been accepted is that NX adds "ignorePatterns": ["**/*"] to the base monorepo.eslintrc and then "ignorePatterns": ["!**/*"] to the package.eslintrc files.未接受答案的原因是 NX 将"ignorePatterns": ["**/*"]添加到基础 monorepo.eslintrc 中,然后将"ignorePatterns": ["!**/*"]添加到 package.eslintrc 文件中. I presume this is to cause only files within the package to get linted.我认为这只会导致 package 中的文件被删除。

Unfortunately, I have not found any documentation on what "!"不幸的是,我还没有找到任何关于"!"的文档。 does in an eslintignore pattern.以 eslintignore 模式进行。 In a gitignore-like system, I could circumvent this by writing my own pattern after the !**/* or specifying folders at the top level.在类似 gitignore 的系统中,我可以通过在!**/*之后编写自己的模式或在顶层指定文件夹来规避这一点。

Unfortunately, eslint differs from observing gitignore rules in this case.不幸的是,在这种情况下,eslint 与遵守 gitignore 规则不同。 Someone with more insight into eslint would be able to either refer to documentation or file a bug.对 eslint 有更深入了解的人可以参考文档或提交错误。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM