Skip to content
Advertisement

NPM: No valid rules have been specified for TypeScript files

I am writing small project in React.JS. Every time I run : npm run start, it logs this:

Starting type checking and linting service...
Using 1 worker with 2048MB memory limit
Watching: /Users/John/Projects/myProject/src
Starting the development server...

ts-loader: Using typescript@2.9.2 and /Users/John/Projects/myProject/tsconfig.json

No valid rules have been specified for TypeScript files

Compiled successfully!
You can now view book-viewer-test in the browser.
Local:            http://localhost:3000/

I have highlighted the line with the error. Everything works good, but I am afraid that it could have effect when project will be bigger and more complex.

What is this Warning/Error? How could I fix it?

Here is my tsconfig.json file:

{
  "compilerOptions": {
    "baseUrl": "./",
    "outDir": "build/dist",
    "module": "esnext",
    "target": "es5",
    "lib": ["es7", "dom"],
    "sourceMap": true,
    "allowJs": true,
    "jsx": "react",
    "moduleResolution": "node",
    "rootDir": "src",
    "forceConsistentCasingInFileNames": true,
    "noImplicitReturns": true,
    "noImplicitThis": true,
    "noImplicitAny": true,
    "strictNullChecks": true,
    "suppressImplicitAnyIndexErrors": true,
    "noUnusedLocals": true,
    "experimentalDecorators": true
  },
  "exclude": [
    "node_modules",
    "build",
    "scripts",
    "acceptance-tests",
    "webpack",
    "jest",
    "src/setupTests.ts"
  ]
}

and there is tslint.json file:

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

Thank you for your advice.

Advertisement

Answer

Solution is to add this to tslint.json in your project directory:

{
    "rules": {
        "no-empty": false
    },
    "jsRules": {
        "no-empty": true
    }
 }
User contributions licensed under: CC BY-SA
6 People found this is helpful
Advertisement