问题描述
我想开始在我的 .tsx 文件上使用 eslint。
我的配置如下:
module.exports = {
'env': {
'browser': true,'es2021': true
},'settings': {
'react': {
'version': 'detect'
}
},'extends': [
'eslint:recommended','plugin:react/recommended','plugin:@typescript-eslint/recommended'
],'parser': '@typescript-eslint/parser','parserOptions': {
'ecmaFeatures': {
'jsx': true
},'ecmaVersion': 12,'sourceType': 'module'
},'plugins': [
'react','@typescript-eslint'
],'rules': {
'indent': [
'error','tab'
],'linebreak-style': [
'error','unix'
],'quotes': [
'error','single'
],'semi': [
'error','never'
]
}
}
如果我有一个扩展名为 .ts 的文件并运行此命令:yarn eslint ./src/components/Frame.ts
...我可以有一个 linting 错误列表。
如果我将扩展名更改为 .tsx 并在其上运行此命令:yarn eslint ./src/components/Frame.tsx
......我没有任何消息。没有错误或警告或任何东西。就像文件一样
有效。
在我的 VSCode 中,我有 ESLint 扩展。这是工作。它突出了问题。据我所知,这个扩展使用相同的 .eslintrc 文件,所以配置应该很好。
你能说明为什么配置可以与扩展一起工作,为什么它不能在终端中工作吗?
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)