Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Error when using the latest version of typescript and eslint

When I run eslint . I get an error:

Error: .eslintrc.js ยป eslint-config-standard-with-typescript:
    Configuration for rule "@typescript-eslint/restrict-plus-operands" is invalid:
    Value {"skipCompoundAssignments":false} should NOT have additional properties.

I disabled the "@typescript-eslint/restrict-plus-operands" rule in the configuration:

rules: {
  ...
  '@typescript-eslint/restrict-plus-operands': 'off',
}

but it doesn't work, I get the same error.

What's the problem?

packages versions:

"@typescript-eslint/eslint-plugin": "^5.62.0",
"@typescript-eslint/parser": "^6.4.1",
"eslint": "^8.48.0",
"eslint-config-prettier": "^9.0.0",
"eslint-config-standard-with-typescript": "^39.0.0",
"eslint-plugin-import": "^2.28.1",
"eslint-plugin-n": "^16.0.2",
"eslint-plugin-prettier": "^5.0.0",
"eslint-plugin-promise": "^6.1.1",
"typescript": "^5.2.2",

node v14.18.2

npm v6.14.15

UPD

After updating "@typescript-eslint/eslint-plugin" to version 6.4.1, a new error appeared:

/node_modules/@typescript-eslint/parser/node_modules/@typescript-eslint/scope-manager/dist/referencer/ClassVisitor.js:123
        withMethodDecorators ||=
                             ^^^
SyntaxError: Unexpected token '||='
like image 465
Jack Avatar asked Oct 12 '25 12:10

Jack


1 Answers

The support for the ||= operator has landed in node v15.

So this issue is expected in v14 and can be fixed with a later version (15+) ๐Ÿ‘

like image 55
Matthieu Riegler Avatar answered Oct 14 '25 08:10

Matthieu Riegler