ESLint: constructors and enum values are reported as unused but they are used in app.ts

Viewed 20

I have a NodeJS project with Express and TypeScript.

Some of the classes/enums usied in the project are reported by ESLint as unused althought they are used in the project's entrypoint file (app.ts in my case).

For instance, I have a class defined in handler/RequestHandler.ts as follows:

export class RequestHandler {
    constructor (private readonly manager: Manager) {}
    ...
}

The in the app.ts it is used like this:

 import { RequestHandler } from './handler/RequestHandler'
 //....
 const handler = new RequestHandler(manager)

But when I run linter I get:

/path-to-my-project-root/src/handler/RequestHandler.ts
  5:2  error  Useless constructor  no-useless-constructor

I thought it ignores app.ts but if I break linter rules for app.ts (for instance by adding unneeded spaces) it would report it.

The same happens with enumeration values.

Question: How to make ESLint see constructor/enum usages in the app.ts file?

0 Answers
Related