Skip to content

Commit

Permalink
fix(plugin-eslint): startLine 0 should not create a position object
Browse files Browse the repository at this point in the history
  • Loading branch information
Markus.Nissl authored and Markus.Nissl committed Mar 18, 2024
1 parent 525b059 commit 2db0d1d
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 12 deletions.
2 changes: 1 addition & 1 deletion packages/models/src/lib/issue.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ const sourceFileLocationSchema = z.object(
position: z
.object(
{
startLine: positiveIntSchema.describe('Start line').optional(),
startLine: positiveIntSchema.describe('Start line'),
startColumn: positiveIntSchema.describe('Start column').optional(),
endLine: positiveIntSchema.describe('End line').optional(),
endColumn: positiveIntSchema.describe('End column').optional(),
Expand Down
22 changes: 12 additions & 10 deletions packages/plugin-eslint/src/lib/runner/transform.ts
Original file line number Diff line number Diff line change
Expand Up @@ -65,16 +65,18 @@ function convertIssue(issue: LintIssue): Issue {
severity: convertSeverity(issue.severity),
source: {
file: issue.filePath,
position: {
...(issue.line > 0 && { startLine: issue.line }),
...(issue.column > 0 && { startColumn: issue.column }),
...(issue.endLine &&
issue.endLine > 0 && {
endLine: issue.endLine,
}),
...(issue.endColumn &&
issue.endColumn > 0 && { endColumn: issue.endColumn }),
},
...(issue.line > 0 && {
position: {
startLine: issue.line,
...(issue.column > 0 && { startColumn: issue.column }),
...(issue.endLine &&
issue.endLine > 0 && {
endLine: issue.endLine,
}),
...(issue.endColumn &&
issue.endColumn > 0 && { endColumn: issue.endColumn }),
},
}),
},
};
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -251,7 +251,6 @@ describe('lintResultsToAudits', () => {
severity: 'warning',
source: {
file: 'src/app/test/strictNullChecks.ts',
position: { startColumn: 1 },
},
},
],
Expand Down

0 comments on commit 2db0d1d

Please sign in to comment.