Releases: profico/eslint-plugin-profico
Release list
v2.0.1-0
Release v2.0.0
What's Changed
- Migrate
eslintto v9 and fromyarntopnpmby @fpolic-profico in #11
Full Changelog: v1.3.0...v2.0.0
Release v1.3.0
What's Changed
Full Changelog: v.1.2.2...v1.3.0
Controller parameters ordering
Only NestJS controller files are linted.
Only controller function parameters are linted.
Parameters are linted only if all parameters have decorator.
Custom parameters are last and ordered by name ascending.
// Bad
public findAll(
@Req() req: ProficoRequest,
@Query() queryParams: QueryParams,
@Custom2() customParam2: CustomParam,
@Custom1() customParam1: CustomParam,
) {
return this.service.find();
}
// Good
public findAll(
@Query() queryParams: QueryParams,
@Req() req: ProficoRequest,
@Custom1() customParam1: CustomParam,
@Custom2() customParam2: CustomParam,
) {
return this.service.find();
}
DTO decorator ordering fix for controllers
Controller files were throwing an error because of properties without decorators.
The plugin now has better DTO detection.
Add rules for decorator ordering in DTO and param classes
For describing and validating requests and responses in the NestJs, we use classes and libraries.
Version v1.2.0 supports decorators from the following libraries:
- @nestjs/swagger
- class-validator
- class-transformer
All other decorators are considered custom. These decorators are used on properties inside DTO, query params and path params classes.
Order enforced by the rule:
- @nestjs/swagger
- class-transformer
- class-validator
- IsOptional (class-validator)
- custom decorators
If there are more class-validator or custom decorators, they are ordered alphabetically.