我有一个使用以下命令创建的 React - Typescript:
create-react-app my-app --scripts-version=react-scripts-ts
它编译得很好,但每次我看到此消息或警告时:
No valid rules have been specified for JavaScript files
有什么想法如何摆脱它吗?
> react-scripts-ts build
Creating an optimized production build...
Starting type checking and linting service...
Using 1 worker with 2048MB memory limit
ts-loader: Using [email protected] /cdn-cgi/l/email-protection and /Users/julian/my-app/tsconfig.json
No valid rules have been specified for JavaScript files
Compiled successfully.
我的 tsconfig.json 和 tslint.json 文件可以在这里找到:https://gist.github.com/JulianG/be82d9fa20f48f60ce10371fa5095230 https://gist.github.com/JulianG/be82d9fa20f48f60ce10371fa5095230
看完之后https://github.com/palantir/tslint/issues/3735#issuecomment-383115457 https://github.com/palantir/tslint/issues/3735#issuecomment-383115457我发现了以下内容:
因为我的tsconfig.json
包含"allowJs": true
, a jsRules
我需要钥匙tslint.json
.
解决方案是简单地添加一条规则tslint.json
像这样:
"jsRules": {
"no-empty": true
}
感谢@explosion-pills 指出答案。
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)