-
Notifications
You must be signed in to change notification settings - Fork 183
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix FP S3800 (function-return-type
): Exception for sanitation functions
#4548
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,37 +1,5 @@ | ||
{ | ||
"vuetify:packages/docs/src/examples/v-date-picker/event-events.vue": [ | ||
44 | ||
], | ||
"vuetify:packages/docs/src/examples/v-file-input/prop-validation.vue": [ | ||
15 | ||
], | ||
"vuetify:packages/docs/src/examples/v-form/misc-vee-validate.vue": [ | ||
59, | ||
64, | ||
69, | ||
74, | ||
79 | ||
], | ||
"vuetify:packages/docs/src/examples/v-form/prop-fast-fail.vue": [ | ||
26, | ||
34 | ||
], | ||
"vuetify:packages/docs/src/examples/v-form/rules-required.vue": [ | ||
19 | ||
], | ||
"vuetify:packages/docs/src/examples/v-form/usage.vue": [ | ||
54, | ||
59, | ||
67, | ||
72 | ||
], | ||
"vuetify:packages/docs/src/examples/v-input/prop-rules.vue": [ | ||
11 | ||
], | ||
"vuetify:packages/docs/src/examples/v-text-field/misc-guide.vue": [ | ||
61 | ||
], | ||
"vuetify:packages/docs/src/examples/v-text-field/prop-validation.vue": [ | ||
42 | ||
] | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -249,6 +249,29 @@ ruleTesterTs.run(`Functions should always return the same type [ts]`, rule, { | |
} | ||
}`, | ||
}, | ||
{ | ||
code: ` | ||
function foo() { | ||
return condition ? 'str' : true; | ||
}`, | ||
}, | ||
{ | ||
code: ` | ||
const sanitize = () => { | ||
return condition ? true : 'Value should be a string'; | ||
}; | ||
`, | ||
}, | ||
{ | ||
code: ` | ||
const sanitize = () => { | ||
if (condition) { | ||
return true; | ||
}; | ||
|
||
return 'Value should be a string'; | ||
}`, | ||
}, | ||
], | ||
invalid: [ | ||
{ | ||
|
@@ -468,13 +491,6 @@ ruleTesterTs.run(`Functions should always return the same type [ts]`, rule, { | |
}, | ||
], | ||
}, | ||
{ | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This test was moved from the invalid list to the valid one. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 👍 |
||
code: ` | ||
function foo() { | ||
return condition ? 'str' : true; | ||
}`, | ||
errors: 1, | ||
}, | ||
{ | ||
code: ` | ||
class C { | ||
|
@@ -533,6 +549,14 @@ ruleTesterTs.run(`Functions should always return the same type [ts]`, rule, { | |
}, | ||
], | ||
}, | ||
{ | ||
code: ` | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I added this test to guarantee that only functions with There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 👍 |
||
const sanitize = () => { | ||
return condition ? true : 42; | ||
}; | ||
`, | ||
errors: 1, | ||
}, | ||
], | ||
}); | ||
|
||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For information, I checked all the removed lines and can confirm that they are not triggering the rule anymore - they all belong to a sanitation function.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍