Skip to content

Commit

Permalink
add red modifiers
Browse files Browse the repository at this point in the history
  • Loading branch information
michael-siek committed Feb 13, 2025
1 parent 9db43a0 commit 5d298cb
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 13 deletions.
6 changes: 2 additions & 4 deletions dist/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -43079,17 +43079,15 @@ ${pendingInterceptorsFormatter.format(pending)}
// Add file heading
core.summary
.addHeading(
`Error${(0, utils_1.pluralize)(errors.length)} in ${file}:`,
`Error${(0, utils_1.pluralize)(errors.length)} in ${file}:`,
2
)
.addRaw('<span style="color: red">', true)
.addList(
errors.map(
(error) =>
`Line ${error.line}: ${error.ruleId} - ${error.description}`
`🔴 Line ${error.line}: ${error.ruleId} - ${error.description}`
)
)
.addRaw('</span>', true)
.addBreak()
// Create GitHub annotations
for (const error of errors) {
Expand Down
11 changes: 6 additions & 5 deletions src/linter.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -452,21 +452,22 @@ describe('linter', () => {

// Verify file sections
assert.isTrue(
summaryStub.addHeading.calledWith('Error in app.js:', 3),
summaryStub.addHeading.calledWith('Error in app.js:', 2),
'Should add app.js section'
)

assert.isTrue(
summaryStub.addHeading.calledWith('Errors in index.html:', 3),
summaryStub.addHeading.calledWith('Errors in index.html:', 2),
'Should add index.html section'
)

// Verify error lists
const appJsErrors = [
'Line 1: click-handler - Click handler should have keyboard equivalent'
'🔴 Line 1: click-handler - Click handler should have keyboard equivalent'
]
const indexHtmlErrors = [
'Line 1: color-contrast - Element has insufficient color contrast',
'Line 1: aria-label - Element should have aria-label'
'🔴 Line 1: color-contrast - Element has insufficient color contrast',
'🔴 Line 1: aria-label - Element should have aria-label'
]

assert.isTrue(
Expand Down
6 changes: 2 additions & 4 deletions src/linter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -72,15 +72,13 @@ export async function lintFiles(
if (errors.length > 0) {
// Add file heading
core.summary
.addHeading(`Error${pluralize(errors.length)} in ${file}:`, 2)
.addRaw('<span style="color: red">', true)
.addHeading(`❌ Error${pluralize(errors.length)} in ${file}:`, 2)
.addList(
errors.map(
(error) =>
`Line ${error.line}: ${error.ruleId} - ${error.description}`
`🔴 Line ${error.line}: ${error.ruleId} - ${error.description}`
)
)
.addRaw('</span>', true)
.addBreak()

// Create GitHub annotations
Expand Down

0 comments on commit 5d298cb

Please sign in to comment.