Skip to content

Commit 2680907

Browse files
committed
Minor cleanup in code and types
1 parent dcb30d8 commit 2680907

File tree

2 files changed

+13
-6
lines changed

2 files changed

+13
-6
lines changed

src/shadow/arborist.ts

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -879,7 +879,7 @@ class SafeNode extends Node {
879879
return false
880880
}
881881
// It's a top level pkg, or a dep of one.
882-
if (!this.resolveParent || !this.resolveParent.resolveParent) {
882+
if (!this.resolveParent?.resolveParent) {
883883
return false
884884
}
885885
// No one wants it, remove it.
@@ -1387,7 +1387,7 @@ void (async () => {
13871387
const orgResult = await socketSdk.getOrganizations()
13881388
if (!orgResult.success) {
13891389
throw new Error(
1390-
'Failed to fetch Socket organization info: ' + orgResult.error.message
1390+
`Failed to fetch Socket organization info: ${orgResult.error.message}`
13911391
)
13921392
}
13931393
const orgs: Exclude<
@@ -1404,7 +1404,7 @@ void (async () => {
14041404
)
14051405
if (!result.success) {
14061406
throw new Error(
1407-
'Failed to fetch API key settings: ' + result.error.message
1407+
`Failed to fetch API key settings: ${result.error.message}`
14081408
)
14091409
}
14101410
return {
@@ -1442,11 +1442,19 @@ void (async () => {
14421442
if (socketYml) {
14431443
settings.entries.push({
14441444
start: socketYml.path,
1445-
// @ts-ignore
14461445
settings: {
14471446
[socketYml.path]: {
14481447
deferTo: null,
1449-
issueRules: socketYml.parsed.issueRules
1448+
// TODO: TypeScript complains about the type not matching. We should
1449+
// figure out why are providing
1450+
// issueRules: { [issueName: string]: boolean }
1451+
// but expecting
1452+
// issueRules: { [issueName: string]: { action: 'defer' | 'error' | 'ignore' | 'monitor' | 'warn' } }
1453+
issueRules: (<unknown>socketYml.parsed.issueRules) as {
1454+
[key: string]: {
1455+
action: 'defer' | 'error' | 'ignore' | 'monitor' | 'warn'
1456+
}
1457+
}
14501458
}
14511459
}
14521460
})

src/utils/issue-rules.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,6 @@ function issueRuleValueDoesNotDefer(
102102

103103
/**
104104
* Handles booleans for backwards compatibility
105-
106105
*/
107106
function uxForDefinedNonDeferValue(
108107
issueRuleValue: NonNormalizedResolvedIssueRule

0 commit comments

Comments
 (0)