Reputation: 14844
I tried to implement eslint in one of my React/TypeScript project. I created my .eslintrc.js
using eslint's cli yarn eslint --init
with the airbnb config:
module.exports = {
"env": {
"browser": true,
"es2021": true
},
"extends": [
"plugin:react/recommended",
"airbnb"
],
"parser": "@typescript-eslint/parser",
"parserOptions": {
"ecmaFeatures": {
"jsx": true
},
"ecmaVersion": 12,
"sourceType": "module"
},
"plugins": [
"react",
"@typescript-eslint"
],
"rules": {
}
};
But when I run eslint, I get this error for all of my .tsx
files:
0:0 error Parsing error: Invalid value for lib provided: es2021
All my files start with the import of React:
import * as React from 'react';
...
As someone an idea of what the issue is?
Upvotes: 3
Views: 3672
Reputation: 61
In your archive .eslintrc.js, change the "parseOption" to:
"parserOptions": {
...,
"ecmaVersion": 2020
},
Upvotes: 5