Parsing error: "parserOptions.project" has been set for @typescript-eslint/parser. The file does not match your project config: jest.config.js

Parsing error: "parserOptions.project" has been set for @typescript-eslint/parser. The file does not match your project config: jest.config.js

我在 ts.config 中创建了路径模块化,但是,当我将 moduleNameMapper 添加到 jest.config.js 时,它返回了错误:

Parsing error: "parserOptions.project" has been set for @typescript-eslint/parser.
The file does not match your project config: jest.config.js.
The file must be included in at least one of the projects provided.

.tsconfig.js

{
  "compilerOptions": {
    ...
    "paths": {
      "@/*": ["*"]
    }
    ...
  }
}

jest.config.js

module.exports = {
    roots: ['<rootDir>/src'],
    collectCoverageFrom: [
      '<rootDir>/src/**/*.{ts, tsx}'
    ],
    coverageDirectory: 'coverage',
    testEnvironment: 'node',
    transform: {
      '.+\.tsx$': 'ts-jest',
      '.+\.ts?$': 'ts-jest'
    },
    moduleNameMapper: {
      '@/(.*)': '<rootDir>/src/'
    }
}

.eslintignore 文件中排除 jest.config.js