eslint-plugin-nestjs icon indicating copy to clipboard operation
eslint-plugin-nestjs copied to clipboard

POC. ESLint rules for nestjs framework

eslint-plugin-nestjs

ESLint rules for nestjs framework.

This project is POC and is not under development. But it will be, if I will get nestjs project on my job.

INSTALL

npm install --save-dev eslint-plugin-nestjs

USAGE

Configure it in your configuration file:

  1. Add to plugins section:
nestjs
  1. Add to extends section (optional):
plugin:nestjs/recommended
  1. Configure rules

RULES

  • nestjs/parse-int-pipe — Usage of transform pipe ParseIntPipe for @Param() decorator
  • nestjs/deprecated-api-modules — Usage of the deprecated api (import modules)
  • nestjs/use-dependency-injection — Dependencies must be provided through a class constructor
  • nestjs/use-validation-pipe — Usage of ValidationPipe for @Body decorated parameters

SIMILAR PROJECTS

  • https://github.com/darraghoriordan/eslint-plugin-nestjs-typed

TODO

  • rule: inject @Res() but not using send or json
  • rule: if class decorated it must be exported
  • cqrs: commands which only trigger 1 command handler (for write), but events can multiple
  • cqrs: command should return void

USEFUL LINKS

  • https://astexplorer.net/

CHANGELOG

See CHANGELOG.md