ESLint - Parse error: Unexpected token semicolon

ESLint - Parse error: Unexpected token semicolon

我明白了
Parsing error: Unexpected token :
对于构造函数中配置变量后的分号

constructor(config: any) {
  super(config)
}

还有这个变量声明

let userData: any

还有 userData

之后的这个
async createNewUser(userData: object) {
}

为了阐明我的配置,这里是配置文件。 这是我的 package.json

  "dependencies": {
    "@codeceptjs/configure": "^0.8.0",
    "@codeceptjs/ui": "0.4.6",
    "codeceptjs": "3.3.2",
    "codeceptjs-expectwrapper": "^1.0.2",
    "codeceptjs-resemblehelper": "^1.9.6",
    "expect": "^26.6.2",
    "faker": "^4.1.0",
    "form-data": "^3.0.0",
    "fs-extra": "^10.1.0",
    "playwright": "^1.21.0",
    "prettier": "2.6.2",
    "ts-node": "^10.7.0",
    "typescript": "^4.6.3"
  },
  "devDependencies": {
    "@typescript-eslint/eslint-plugin": "^5.23.0",
    "@typescript-eslint/parser": "^5.23.0",
    "eslint": "^8.15.0",
    "eslint-plugin-codeceptjs": "^1.3.0"
  }

这是我的 .eslintrc:

{
  "plugins": [
    "codeceptjs",
    "@typescript-eslint"
  ],
  "parserOptions": {
    "sourceType": "module",
    "parser": "@typescript-eslint/parser"
  },
  "overrides": [
    {
      "files": [ "src/**/*.ts" ]
    }
  ],
  "env": {
    "codeceptjs/codeceptjs": true,
    "es2020": true,
    "node": true
  },

  "rules": {
//    "codeceptjs/no-actor-in-scenario": "warn",
    "codeceptjs/no-skipped-tests": "error"
  }
}

你能帮忙吗?我试着寻找解决方案,但在这个问题上找不到任何东西。

我认为最简单的修复可能是扩展 TypeScript 的默认 ESLint 规则。将此块添加到您的 .eslintrc:

"extends": [
    "eslint:recommended",
    "plugin:@typescript-eslint/recommended"
]