Skip to content

Commit 4227459

Browse files
Merge pull request #115 from PaulGiletich/annotation-sorting
sort annotations by severity
2 parents ed70a78 + f918f5b commit 4227459

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

src/create-check.ts

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,12 @@ rxXIyGcdFUjpY/U2tobjXousbYyz8/DqgDoLWXOMt2dNkbbNAN8L3OMVTGb6TzS2
4646
gd8URXIGc6Nk7ueWMKEZaropIg6q1J7e9qJdlzA6j1fu6vVY3qX3tA==
4747
-----END RSA PRIVATE KEY-----`;
4848

49+
const annotationsOrder: Record<Annotation['annotation_level'], number> = {
50+
'failure': 1,
51+
'warning': 2,
52+
'notice': 3,
53+
}
54+
4955
export async function createAnnotations(results: eslint.CLIEngine.LintResult[]) {
5056
const repoRoot = (await execa('git', ['rev-parse', '--show-toplevel'])).stdout;
5157

@@ -73,7 +79,7 @@ export async function createAnnotations(results: eslint.CLIEngine.LintResult[])
7379
}
7480
}
7581

76-
return annotations;
82+
return annotations.sort((a, b) => annotationsOrder[a.annotation_level] - annotationsOrder[b.annotation_level]);
7783
}
7884

7985
export default async (results: eslint.CLIEngine.LintResult[]) => {

0 commit comments

Comments
 (0)