Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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 [email protected] 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.

like image 616
Jan Černý Avatar asked Feb 04 '26 15:02

Jan Černý


1 Answers

The only TSLint rules you have apply to JavaScript files, not TypeScript ones. In order to lint TypeScript files, use rules instead of jsRules.

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

Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!