Skip to content

Commit

Permalink
Minor cleanup in code and types
Browse files Browse the repository at this point in the history
  • Loading branch information
jdalton committed Nov 6, 2024
1 parent dcb30d8 commit 2680907
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 6 deletions.
18 changes: 13 additions & 5 deletions src/shadow/arborist.ts
Original file line number Diff line number Diff line change
Expand Up @@ -879,7 +879,7 @@ class SafeNode extends Node {
return false
}
// It's a top level pkg, or a dep of one.
if (!this.resolveParent || !this.resolveParent.resolveParent) {
if (!this.resolveParent?.resolveParent) {
return false
}
// No one wants it, remove it.
Expand Down Expand Up @@ -1387,7 +1387,7 @@ void (async () => {
const orgResult = await socketSdk.getOrganizations()
if (!orgResult.success) {
throw new Error(
'Failed to fetch Socket organization info: ' + orgResult.error.message
`Failed to fetch Socket organization info: ${orgResult.error.message}`
)
}
const orgs: Exclude<
Expand All @@ -1404,7 +1404,7 @@ void (async () => {
)
if (!result.success) {
throw new Error(
'Failed to fetch API key settings: ' + result.error.message
`Failed to fetch API key settings: ${result.error.message}`
)
}
return {
Expand Down Expand Up @@ -1442,11 +1442,19 @@ void (async () => {
if (socketYml) {
settings.entries.push({
start: socketYml.path,
// @ts-ignore
settings: {
[socketYml.path]: {
deferTo: null,
issueRules: socketYml.parsed.issueRules
// TODO: TypeScript complains about the type not matching. We should
// figure out why are providing
// issueRules: { [issueName: string]: boolean }
// but expecting
// issueRules: { [issueName: string]: { action: 'defer' | 'error' | 'ignore' | 'monitor' | 'warn' } }
issueRules: (<unknown>socketYml.parsed.issueRules) as {
[key: string]: {
action: 'defer' | 'error' | 'ignore' | 'monitor' | 'warn'
}
}
}
}
})
Expand Down
1 change: 0 additions & 1 deletion src/utils/issue-rules.ts
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,6 @@ function issueRuleValueDoesNotDefer(

/**
* Handles booleans for backwards compatibility
*/
function uxForDefinedNonDeferValue(
issueRuleValue: NonNormalizedResolvedIssueRule
Expand Down

0 comments on commit 2680907

Please sign in to comment.