npm install --save-dev eslint-plugin-authing-nestjs
or
yarn add eslint-plugin-authing-nestjs -D
Configure it in your configuration file:
-
Add to
plugins
section: -
Add to
extends
orrules
section:
module.exports = {
plugins: ['authing-nestjs'],
extends: [
'plugin:authing-nestjs/recommended'
],
// *** Usage: refer to unit test documents for specific rules ***
rules: {
// It is forbidden to use parameters in the @Body, eg: @Body("name")
'authing-nestjs/forbid_body_parameters': 'warn', // default 'error'
// It is forbidden to read body from Req, eg: req.body
'authing-nestjs/forbid_read_body_from_req': 'warn',
// The @Body type annotation in the function must be a class, eg: @Body() dto: ClassDto
'authing-nestjs/use_class_as_type_in_method_of_controller': 'warn',
// Each DTO field must have a class validator
// There must be at least 2 class validators for a DTO with IsOptional
// For nested DTO,Type and ValidateNested must appear at the same time
'authing-nestjs/use_class_validator_to_dto': 'warn',
// ... more
}
}
Detailed changes for each release are documented in the release notes.
- Fork it
- Create your feature branch (git checkout -b my-new-feature)
- Commit your changes (git commit -am 'Add some feature')
- Push to the branch (git push -u origin my-new-feature)
- Create new Pull Request
Join us on forum: #authing-chat
Copyright (c) 2022 Authing