Skip to content

Commit 02bce2e

Browse files
guillemsardaclaude
andauthored
JS-1609 Clean up accepted S4204/S3801 issues in SonarJS self-analysis (#6843)
Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
1 parent 7d5dfa9 commit 02bce2e

File tree

3 files changed

+3
-5
lines changed

3 files changed

+3
-5
lines changed

packages/analysis/src/jsts/rules/S100/rule.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -131,5 +131,5 @@ export const rule: Rule.RuleModule = {
131131

132132
//handling arrow functions without return statement
133133
function returnsJSX(node: estree.Function) {
134-
return (node.body as any).type.startsWith('JSX');
134+
return node.body.type.startsWith('JSX');
135135
}

packages/analysis/src/jsts/rules/S109/rule.ts

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -80,9 +80,7 @@ function getNumericLiteral(node: estree.Literal) {
8080
}
8181

8282
function numericLiteralValue(node: estree.Literal) {
83-
if (typeof node.value === 'number') {
84-
return node.value;
85-
}
83+
return typeof node.value === 'number' ? node.value : undefined;
8684
}
8785

8886
function isNumericLiteral(node: estree.Node): node is estree.Literal {

packages/analysis/src/jsts/rules/S1105/decorator.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ function reportExempting(
3535
exemptionCondition: (messageId: string) => boolean,
3636
): (context: Rule.RuleContext, reportDescriptor: Rule.ReportDescriptor) => void {
3737
return (context, reportDescriptor) => {
38-
if (exemptionCondition((reportDescriptor as any).messageId)) {
38+
if ('messageId' in reportDescriptor && exemptionCondition(reportDescriptor.messageId)) {
3939
context.report(reportDescriptor);
4040
}
4141
};

0 commit comments

Comments
 (0)