typescript ESLint不检查Cypress文件

9rygscc1  于 2022-11-26  发布在  TypeScript
关注(0)|答案(1)|浏览(136)

我的项目是用Angular 13和Typescript编写的,使用eslint。后来我添加了Cypress。当我运行命令ng lint时,它不会检查/cypress文件夹中的文件。但当我使用Visual Studio代码时,它会正确地找到错误。

.eslintrc.json

{
    "root": true,
    "ignorePatterns": [
        "projects/**/*",
        "cypress/fixtures/**/*",
        "cypress/integration-original/**/*.js",
        "src/**/*.spec.ts",
        "src/**/*.mock.ts"
    ],
    "overrides": [
        {
            "files": [
                "*.ts"
            ],
            "parserOptions": {
                "project": [
                    "tsconfig.json",
                    "e2e/tsconfig.json"
                ],
                "createDefaultProgram": true
            },
            "extends": [
                "eslint:recommended",
                "plugin:@angular-eslint/recommended",
                "plugin:@typescript-eslint/eslint-recommended",
                "plugin:@typescript-eslint/recommended"
            ],
            "plugins": [
                "deprecation"
            ],
            "rules": { ...  }
        },
        {
            "files": [
                "*.html"
            ],
            "extends": [
                "plugin:@angular-eslint/template/recommended"
            ],
            "rules": {}
        }
    ]
}

在Angular项目中,文件夹结构为:

-cypress
-node_modules
-src
.eslintrc.json
tsconfig.json
...
rqqzpn5f

rqqzpn5f1#

我添加了angular.json

{
  "$schema": "./node_modules/@angular/cli/lib/config/schema.json",
  "version": 1,
  "projects": {
    "my-app": {
      "architect": {
        "lint": {
          "builder": "@angular-eslint/builder:lint",
          "options": {
            "lintFilePatterns": [
              "src/**/*.ts",
              "src/**/*.html",
              "cypress"
            ]
          }
        }
      }
    }
  },
}

相关问题