我尝试在我的React/TypeScript 项目之一中实现 eslint 。.eslintrc.js我使用 eslint 的 cliyarn eslint --init和 airbnb 配置创建了我的:
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": {
}
};
Run Code Online (Sandbox Code Playgroud)
但是当我运行 eslint 时,我的所有.tsx文件都会出现此错误:
0:0 错误解析错误:提供的 lib 值无效:es2021
我的所有文件都以 React 的导入开始:
import * as React from 'react';
...
Run Code Online (Sandbox Code Playgroud)
作为一个知道问题是什么的人?