What does "No valid rules have been specified for JavaScript files" mean?
Asked Answered
S

1

5

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

Any ideas how to get rid of it?

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

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

Sapless answered 24/5, 2018 at 21:18 Comment(2)
github.com/palantir/tslint/issues/3735#issuecomment-383115457Microbicide
Thank you! That issue contains the answer. I'll answer my own question to make it easier to find.Sapless
S
9

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

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

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

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

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

Sapless answered 25/5, 2018 at 21:7 Comment(5)
@Evan and JulianG, I am getting this "ERROR: No valid rules have been specified" for Type Script during my Run Code Analysis task in TFS 2017 Build definition and I don't have "allowJs": true in my tsconfig.json, so in this case should i still add jsRules key in my tslint.json?Franklin
@Franklin Can you share your tsconfig.json and tslint.json?Sapless
I have shared the files at this link, can you please have a look - #53157195Franklin
request you to have a look at tsconfig.json and tslint.json files shared at the above link.Franklin
hi! I'm sorry I forgot to check your files before. I've never seen the "no valid rules" error for Typescript. Have you tried to isolate the problem? for instance re-creating it in a new repository that you can share?Sapless

© 2022 - 2024 — McMap. All rights reserved.