#EsLint error " appService' is defined but never used "but i used the appservice in function.

8 messages · Page 1 of 1 (latest)

drowsy yoke
#

import { Controller, Get } from '@nestjs/common';
import { AppService } from './app.service';

@Controller()
export class AppController {
constructor(
private readonly appService: AppService,
) {
}
@Get()
getHello(): string {
return this.appService.getHello();
}
}

warm forumBOT
#

Suggestion for @drowsy yoke:
Please format your question with Markdown formatting.
It leads to better readability and an easier time to spot problems.
For code blocks, you can wrap your block with three back ticks before and after the block, and after the first three back ticks you can add a language (like ts) to add syntax highlighting.
e.g.

```ts
@Injectable()
export class MySuperAwesomeService {
constructor(@Inject('InjectionToken') private readonly dep: SomeDependency) {}

getRandomNumber(): number {
return Math.round(Math.random() * 1000);
}
}
```

Becomes

@Injectable()
export class MySuperAwesomeService {
  constructor(@Inject('InjectionToken') private readonly dep: SomeDependency) {}

  getRandomNumber(): number {
    return Math.round(Math.random() * 1000);
  }
}
regal rain
#

It looks fine. Make sure the file is saved and the problem isn't from your editor/IDE by running npm run lint

drowsy yoke
regal rain
drowsy yoke
regal rain