I have upgraded Eslint
from 7.7.0 to 7.10.0 and @types/node
from 14.6.0 to 14.11.2. The application tsconfig.json
defines types: ["node"]
and typescript is version 4.0.3. Eslint is called with eslint --env node,es2020
.
Before the upgrade Eslint never flagged any problem in my code. Now Eslint started complaining that NodeJS
is not defined in the following code fragment:
private handleServerErrors(error: NodeJS.ErrnoException): void {
if(error.code === "EADDRINUSE") {
. . .
I silence the Eslint error and the compilation succeeded. So seems a problem specific to eslint, not the code.
The same problem happens in another file for namespace JQuery
, but I had not yet investigated.
Is there anything I'm missing? Need to add some import? What has changed in eslint/typescript/node?
Thanks for your help! mario
ESLint requires Node. js for installation. Follow the instructions in the Getting Started Guide to install ESLint. Note: You can also use alternative package managers such as Yarn or pnpm to run ESLint.
ESLint is a JavaScript and TypeScript linting tool, that means it analyses source code and identifies possible programming problems and errors. It underlines errors in red and warnings in yellow. It is very useful to cover coding styles issues.
ESLint is a JavaScript linter that you can use to lint either TypeScript or JavaScript code.
TSLint is an extensible static analysis tool that checks TypeScript code for readability, maintainability, and functionality errors. It is widely supported across modern editors & build systems and can be customized with your own lint rules, configurations, and formatters.
In my case, @typescript-eslint/parser@4
causes this problem.
Downgrade it to v3 @typescript-eslint/parser@3
to solve the problem.
See: https://github.com/Chatie/eslint-config/issues/45
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With