找不到指定项目的“lint”目标或数据路径“”必须具有必需的属性“lintFilePatterns”

Posted

技术标签:

【中文标题】找不到指定项目的“lint”目标或数据路径“”必须具有必需的属性“lintFilePatterns”【英文标题】:Cannot find "lint" target for the specified project OR Data path "" must have required property 'lintFilePatterns' 【发布时间】:2021-11-17 13:01:43 【问题描述】:

根据this tutorial 将我的项目结构更改为 Angular 中的 monorepo 结构后,我遇到了许多配置错误,经过大量故障排除后我设法解决了这些错误。

完整的错误读取

Cannot find "lint" target for the specified project.

You should add a package that implements linting capabilities

这个错误的变体

Schema validation failed with the following errors:  
Data path "" must have required property 'lintFilePatterns'.

这两个错误都可以通过正确配置angular.json 来修复。

在下面找到修复的详细信息

【问题讨论】:

【参考方案1】:

可以使用以下命令自动添加所需的配置:

ng add @angular-eslint/schematics

来自Angular ESLint README

【讨论】:

【参考方案2】:

转到angular.json -> <your-projects-root-directory> -> <your-project-name> -> architect并添加或修改

"lint": 
          "builder": "@angular-eslint/builder:lint",
          "options": 
            "lintFilePatterns": [
              "<your-projects-root-directory>/<your-project-name>/src/**/*.ts",
              "<your-projects-root-directory>/<your-project-name>/src/**/*.html"
            ]
          
        ,

这告诉 ng lint 命令在各个项目(构建器)中使用哪个 linter 以及要 lint(lintFilePatterns)哪个文件。

您的项目根目录通常命名为projects。 例如,如果您使用 tslint,您可能必须用另一个 linter 替换 "builder" 属性。详情请见您的package.json

请记住为angular.json 中定义的所有项目设置此项。

【讨论】:

以上是关于找不到指定项目的“lint”目标或数据路径“”必须具有必需的属性“lintFilePatterns”的主要内容,如果未能解决你的问题,请参考以下文章

doma 提示META-INF下sql文件找不到

电脑删除文件,但是上面说(无法删除,找不到指定文件。请确定指定的路径及文件是不是正确)该怎么删除?

vs 2019无法启动程序,找不到指定文件,怎么解决?

React-native 项目构建失败:找不到 com.android.tools.lint:lint-gradle:26.1.0

pom.xml错误xxxx argetclassesMETA-INFMANIFEST.MF (系统找不到指定的路径。)

虚拟光驱运行可执行程序,出现指定路径找不到??