Skip to content

Commit

Permalink
Merge pull request #24 from retejs/fix-type-coverage-range
Browse files Browse the repository at this point in the history
fix(lint): type coverage end line and column
  • Loading branch information
Ni55aN authored Aug 30, 2024
2 parents 36c786d + 7b4e900 commit df00bd3
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 df00bd3

Please sign in to comment.