Skip to content

Commit

Permalink
only output columns if on same line
Browse files Browse the repository at this point in the history
  • Loading branch information
a-b-r-o-w-n committed Jun 2, 2024
1 parent 8d35d37 commit a82d66e
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 4 deletions.
6 changes: 4 additions & 2 deletions lib/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -173780,12 +173780,14 @@ function processResults(results) {
else if (severity === 1) {
warningCount++;
}
const isMultiLine = endLine && endLine !== line;
fileAnnotations.push({
file: relFilePath,
startLine: line,
endLine,
startColumn: column,
endColumn: endColumn,
// only add column info if error is on a single line
startColumn: isMultiLine ? undefined : column,
endColumn: isMultiLine ? undefined : endColumn,
severity: severity === 2 ? "failure" : "warning",
message: `[${ruleId}] ${message}`,
});
Expand Down
7 changes: 5 additions & 2 deletions src/processResults.ts
Original file line number Diff line number Diff line change
Expand Up @@ -61,12 +61,15 @@ export function processResults(results: ESLint.LintResult[]): LintResult {
warningCount++;
}

const isMultiLine = endLine && endLine !== line;

fileAnnotations.push({
file: relFilePath,
startLine: line,
endLine,
startColumn: column,
endColumn: endColumn,
// only add column info if error is on a single line
startColumn: isMultiLine ? undefined : column,
endColumn: isMultiLine ? undefined : endColumn,
severity: severity === 2 ? "failure" : "warning",
message: `[${ruleId}] ${message}`,
});
Expand Down

0 comments on commit a82d66e

Please sign in to comment.