Skip to content

Commit

Permalink
fix: tsoa rule not acknowledging success response decorator (#23)
Browse files Browse the repository at this point in the history
* fix valid-alternative-response rule to acknowledge SuccessResponse decorator

* bump version
  • Loading branch information
CloudNStoyan authored Dec 7, 2024
1 parent e549645 commit 131a02f
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 2 deletions.
2 changes: 1 addition & 1 deletion eslint-plugin-tsoa/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@arabasta/eslint-plugin-tsoa",
"version": "1.1.0",
"version": "1.1.1",
"type": "commonjs",
"description": "ESLint plugin for tsoa rules",
"author": "Stoyan Kolev",
Expand Down
2 changes: 1 addition & 1 deletion eslint-plugin-tsoa/src/eslint-plugin-tsoa.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import requirePropertyExampleDecoratorRule from './rules/require-property-exampl
const plugin = {
meta: {
name: '@arabasta/eslint-plugin-tsoa',
version: '1.1.0',
version: '1.1.1',
},
configs: {},
rules: {
Expand Down
11 changes: 11 additions & 0 deletions eslint-plugin-tsoa/src/rules/valid-alternative-response.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,17 @@ ruleTester.run(
}
`,
},
{
name: 'when this.noContentResult is used in a method that has the `@SuccessResponse` decorator',
code: normalizeIndent`
class User {
@SuccessResponse(204)
getAllUsers() {
return this.noContentResult();
}
}
`,
},
{
name: 'when this.noContentResult is used in a method that is inside a class that has the correct response decorator',
code: normalizeIndent`
Expand Down
4 changes: 4 additions & 0 deletions eslint-plugin-tsoa/src/rules/valid-alternative-response.ts
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,10 @@ export default createRule<RuleOptions, RuleMessageIds>({
node,
decoratorName: 'Response',
}),
...getAllDecoratorsWithName({
node,
decoratorName: 'SuccessResponse',
}),
...getAllDecoratorsWithName({
node: currentClassDeclarationNode,
decoratorName: 'Response',
Expand Down

0 comments on commit 131a02f

Please sign in to comment.