typescript - react typescript eslint plugin - 文件的扩展名 (.svg) 是非标准的

标签 typescript eslint

我对 typescript 做出了 react 。

我正在尝试向我的项目添加一些 eslint,但在使用 yarn lint 期间出现此错误
(eslint src/** --ext .ts,.tsx")
我也在 css 上遇到了一些错误

  0:0  error  Parsing error: "parserOptions.project" has been set for @typescript-eslint/parser.
The file does not match your project config: src/logo.svg.
The extension for the file (.svg) is non-standard. You should add "parserOptions.extraFileExtensions" to your config

.css 相同

我的 eslint 基于这篇文章
https://gist.github.com/1natsu172/a65a4b45faed2bd3fa74b24163e4256e

最佳答案

使用 eslint src --ext .ts,.tsx为我修好了。

https://stackoverflow.com/a/43742235/691083了解更多背景信息。

关于typescript - react typescript eslint plugin - 文件的扩展名 (.svg) 是非标准的,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/60145171/

相关文章:

vue.js - Props 至少应该定义它们的类型

typescript - 如何使用 ESLint TypeScript Airbnb 配置?

visual-studio-code - 如何将 ESLInt 自定义规则目录添加到 VSCode

javascript - ESLint 一致返回和嵌套回调

visual-studio - ESLint 支持 Visual Studio 2017

TypeScript:仅从联合中排除精确的 {}

html - 如何设置 ion-datetime 的默认日期(今天的日期)?

javascript - 热修复 "Type ' 字符串'不可分配给类型 'T'“?

typescript - src 属性中的 VueJS 插值

reactjs - 使用 React.useImperativeHandle() 声明类型