Skip to content

Commit

Permalink
refactor: use enum for Severity
Browse files Browse the repository at this point in the history
  • Loading branch information
sheck committed Oct 1, 2024
1 parent d9cbca5 commit 2897587
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 5 deletions.
9 changes: 7 additions & 2 deletions dist/index.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

11 changes: 8 additions & 3 deletions src/eslint_result.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ export type ResultObject = {

type EslintMessage = {
ruleId: string
severity: number
severity: Severity
message: string
line: number
column: number
Expand All @@ -19,6 +19,11 @@ type EslintMessage = {
suggestions: any[]
}

enum Severity {
Warning = 1,
Error = 2,
}

export class EslintResult {
public relevantWarningCount: number = 0
public relevantErrorCount: number = 0
Expand Down Expand Up @@ -55,10 +60,10 @@ export class EslintResult {
endColumn: msg.endColumn,
}
switch (msg.severity) {
case 1:
case Severity.Warning:
core.warning(msg.message, options)
break
case 2:
case Severity.Error:
core.error(msg.message, options)
default:
break
Expand Down

0 comments on commit 2897587

Please sign in to comment.