Reactjs CRA未显示控制台中.ts和.tsx文件中的linting错误/警告
使用CRA引导项目,而不使用Reactjs CRA未显示控制台中.ts和.tsx文件中的linting错误/警告,reactjs,typescript,eslint,Reactjs,Typescript,Eslint,使用CRA引导项目,而不使用--typescript,然后在https://facebook.github.io/create-react-app/docs/adding-typescript eslintrc如下所示: { "extends": ["plugin:@typescript-eslint/recommended", "react-app"], "parser": "@typescript-eslint/parser", "parserOptions": { "e
--typescript
,然后在https://facebook.github.io/create-react-app/docs/adding-typescript
eslintrc
如下所示:
{
"extends": ["plugin:@typescript-eslint/recommended", "react-app"],
"parser": "@typescript-eslint/parser",
"parserOptions": {
"ecmaVersion": 6,
"sourceType": "module",
"ecmaFeatures": {
"jsx": true
}
},
"plugins": ["@typescript-eslint", "react"],
"rules": {}
}
tsconfig
是默认设置。我做了一个tslint--init
,它添加了一个默认的.json
配置
.js
文件中未使用的变量在控制台中显示为警告或错误,但是.ts
和.tsx
文件中的所有内容都将被忽略。有没有办法在控制台中也显示这些内容
如果不是,那么在不必每次键入
eslint
的情况下,让linting错误显示在某处的最佳方法是什么。您是否也更新了react脚本?他们已解决此问题,请检查此链接: