'ESLint - Parse error: Unexpected token semicolon
I get Parsing error: Unexpected token :
For semicolon after config variable in the constructor
constructor(config: any) {
super(config)
}
And also for this variable declaration
let userData: any
And also for this one after userData
async createNewUser(userData: object) {
}
In order to clarify my configuration here are the configuration files. This is my 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"
}
This is my .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"
}
}
Can you please help? I tried looking for the solution but couldn't find anything on this ones.
Solution 1:[1]
I think the simplest fix may be to extend the default ESLint rules for TypeScript. Add this block to your .eslintrc:
"extends": [
"eslint:recommended",
"plugin:@typescript-eslint/recommended"
]
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | EvanM |
