Skip to content

Commit

Permalink
refactor to satisfy no else condition rule
Browse files Browse the repository at this point in the history
  • Loading branch information
rrd108 committed Aug 22, 2024
1 parent 2e556f5 commit 1c2826e
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 4 deletions.
6 changes: 4 additions & 2 deletions src/missingRules.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ const findRules = async (srcDir) => {
if (stat.isDirectory()) {
await traverseDirectory(fullPath)
}
else if (isValidSourceFile(currentPath, file)) {
if (isValidSourceFile(currentPath, file)) {
allRules.push(`${currentPath}/${file}`)
}
}
Expand Down Expand Up @@ -84,7 +84,9 @@ const main = async () => {
console.error(`\n${errors} errors were found during the check.\n`)
// eslint-disable-next-line node/prefer-global/process
process.exit(1) // Exit with error code
} else {
}

if (!errors) {
console.log('All checks passed successfully.')
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/rules/rrd/parameterCount.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ const checkParameterCount = (script: SFCScriptBlock | null, filePath: string) =>
// Regular function
checkParameters(match[1], match[2], filePath) // match[2] are the params for current regular function
}
else if (match[3]) {
if (match[3]) {
// Arrow function
checkParameters(match[3], match[4], filePath) // match[4] are the params for current arrow function
}
Expand Down
4 changes: 3 additions & 1 deletion src/rulesReport.ts
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,9 @@ export const reportRules = (groupBy: GroupBy, orderBy: OrderBy, level: OutputLev

if (groupBy === 'file') {
output.push({ info: ` Rule: ${offense.rule}` })
} else {
}

if (groupBy !== 'file') {
output.push({ info: ` File: ${offense.file}` })
}
output.push({ info: ` Description: ${offense.description}` })
Expand Down

0 comments on commit 1c2826e

Please sign in to comment.