“没有为 JavaScript 文件指定有效规则"是什么意思?意思? [英] What does "No valid rules have been specified for JavaScript files" mean?

查看:41
本文介绍了“没有为 JavaScript 文件指定有效规则"是什么意思?意思?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个 React - Typescript 创建的:

I have a React - Typescript created with:

create-react-app my-app --scripts-version=react-scripts-ts

它编译得很好,但每次我看到这条消息或警告时:

It compiles fine, but every time I see this message or warning:

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 typescript@2.8.3 and /Users/julian/my-app/tsconfig.json
No valid rules have been specified for JavaScript files
Compiled successfully.

我的 tscongif.json 和 tslint.json 文件可以在这里找到:https://gist.github.com/JulianG/be82d9fa20f48f60ce10371fa5095230

My tscongif.json and tslint.json files can be found here: https://gist.github.com/JulianG/be82d9fa20f48f60ce10371fa5095230

推荐答案

阅读后 https://github.com/palantir/tslint/issues/3735#issuecomment-383115457 我发现了以下内容:

After reading https://github.com/palantir/tslint/issues/3735#issuecomment-383115457 I found the following:

因为我的 tsconfig.json 包含 "allowJs": true,所以在我的 tslint.json<中需要一个 jsRules 键/代码>.

Because my tsconfig.json contained "allowJs": true, a jsRules key was needed in my tslint.json.

解决方案是简单地向 tslint.json 添加一个规则,如下所示:

The solution was to simply add a rule to tslint.json like this:

    "jsRules": {
      "no-empty": true
    }

感谢@explosion-pills 指出答案.

Thanks to @explosion-pills for point to the answer.

这篇关于“没有为 JavaScript 文件指定有效规则"是什么意思?意思?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆