Skip to content

Commit

Permalink
fix(lint): type coverage end line and column
Browse files Browse the repository at this point in the history
  • Loading branch information
Ni55aN committed Aug 30, 2024
1 parent 36c786d commit 7b4e900
Showing 1 changed file with 19 additions and 8 deletions.
27 changes: 19 additions & 8 deletions src/lint/type-coverage/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,14 +19,25 @@ export class TypeCoverage implements BaseLinter {
const results = Object.entries(groups).map(([file, anys]) => {
return {
filePath: file,
messages: anys.map(any => ({
ruleId: getRuleId(any),
message: getMessages(any),
severity: 1,
line: any.line + 1,
column: any.character + 1,
endColumn: any.character + 1 + any.text.length
}))
messages: anys.map(any => {
const line = any.line + 1
const column = any.character + 1
const lines = any.text.split('\n')
const [firstLine, ...rest] = lines
const lastLine = [...rest].pop() ?? firstLine

return {
ruleId: getRuleId(any),
message: getMessages(any),
severity: 1,
line,
endLine: line + lines.length - 1,
column,
endColumn: lines.length === 1
? column + lastLine.length
: lastLine.length
}
})
} satisfies LintResult
})
const rules = Object.entries(groups)
Expand Down

0 comments on commit 7b4e900

Please sign in to comment.