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 plex.
What is this Warning/Error? How could I fix it?
Here is my tsconfig.json file:
{
"pilerOptions": {
"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.
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 plex.
What is this Warning/Error? How could I fix it?
Here is my tsconfig.json file:
{
"pilerOptions": {
"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.
Share Improve this question asked Aug 9, 2018 at 14:02 Jan ČernýJan Černý 1,3862 gold badges20 silver badges39 bronze badges4 Answers
Reset to default 3The 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
}
}
You should check the versions your using probably nothing serious since there are no rules defined! Anyway if you have react, npm , node updated you should have an output like this more or less:
PS C:\React\my-app> npm run start
> [email protected] start C:\React\my-app
> react-scripts start
Starting the development server...
Compiled successfully!
You can now view my-app in the browser.
Local: http://localhost:3000/
On Your Network: http://192.168.1.67:3000/
Note that the development build is not optimized.
To create a production build, use npm run build.
This looks like a TSLint error. Do you have TSLint installed? Mind sharing your package.json
? Do you have a tslint.json
and if so, can you share it? (Creating a tslint.json
with the rules you want might already solve it.)
Solution is to add this to tslint.json
in your project directory:
{
"rules": {
"no-empty": false
},
"jsRules": {
"no-empty": true
}
}