如上图,添加以上报错
添加了那段注释就可以了,但总不可能每次新增一个函数都添加这个注释吧,因此想问问有人知道如何统一处理的吗
"rules": {
// disable the rule for all files
"@typescript-eslint/explicit-module-boundary-types": "off"
},
10 回答11.1k 阅读
5 回答4.8k 阅读✓ 已解决
4 回答3.1k 阅读✓ 已解决
2 回答2.7k 阅读✓ 已解决
3 回答5.1k 阅读✓ 已解决
3 回答1.8k 阅读✓ 已解决
2 回答4.7k 阅读✓ 已解决
首先不太明白楼主为什么使用了typescript的规则校验,却没有在这个文件中使用typescript,这似乎失去了eslint对编码规范校验的意义,以下解决方法,楼主可以一试。
Configuring in a mixed JS/TS codebase
If you are working on a codebase within which you lint non-TypeScript code (i.e.
.js
/.jsx
), you should ensure that you should use ESLintoverrides
to only enable the rule on.ts
/.tsx
files. If you don't, then you will get unfixable lint errors reported within.js
/.jsx
files.