Add seven repo-local oxlint rules scoped to packages/plugins/workos-vault/src to keep the provider's Effect-only surface, tagged-error discipline, and typed boundary patterns in place. Rules added: - no-inline-object-type-assertion - no-instanceof-tagged-error - no-manual-tag-check - no-promise-client-surface - no-raw-error-throw - no-redundant-error-factory - no-unknown-shape-probing Adapted to the existing flat scripts/oxlint-plugin-executor/utils.js layout on main; no rules already on main were duplicated. Cleanup in workos-vault to satisfy the new rules: - WorkOSVaultClientError now captures status + message at construction so callers consume typed fields instead of probing unknown causes. - Renamed exported WorkOSVaultSdk to module-private WorkOSVaultPromiseApi and removed it from the public package surface. - Replaced unwrapVaultError + inline shape probes in secret-store with direct typed access on WorkOSVaultClientError. - Introduced a named row type in secret-store.test.ts instead of an inline object type assertion.
Showing the changes to scripts/oxlint-plugin-executor/utils.js (1 of 14 files). Show all
Unified · Split
| @@ -71,3 +71,60 @@ export function getStringValue(node) { · 70 unmodified lines | |||
| 71 | if (expression?.type === "StringLiteral") return expression.value; | 71 | if (expression?.type === "StringLiteral") return expression.value; |
| 72 | return undefined; | 72 | return undefined; |
| 73 | } | 73 | } |
| 74 | |||
| 75 | export function isIdentifier(node, name) { | ||
| 76 | return node?.type === "Identifier" && (name === undefined || node.name === name); | ||
| 77 | } | ||
| 78 | |||
| 79 | export function isStringLiteral(node) { | ||
| 80 | return ( | ||
| 81 | (node?.type === "Literal" && typeof node.value === "string") || | ||
| 82 | node?.type === "StringLiteral" | ||
| 83 | ); | ||
| 84 | } | ||
| 85 | |||
| 86 | export function typeName(node) { | ||
| 87 | if (node?.type === "Identifier") return node.name; | ||
| 88 | if (node?.type === "TSQualifiedName") { | ||
| 89 | const left = typeName(node.left); | ||
| 90 | const right = typeName(node.right); | ||
| 91 | return left && right ? `${left}.${right}` : undefined; | ||
| 92 | } | ||
| 93 | return undefined; | ||
| 94 | } | ||
| 95 | |||
| 96 | export function typeReferenceName(node) { | ||
| 97 | return node?.type === "TSTypeReference" ? typeName(node.typeName) : undefined; | ||
| 98 | } | ||
| 99 | |||
| 100 | export function isPromiseType(node) { | ||
| 101 | return typeReferenceName(node) === "Promise"; | ||
| 102 | } | ||
| 103 | |||
| 104 | export function containsPromiseType(node) { | ||
| 105 | if (!node || typeof node !== "object") return false; | ||
| 106 | if (isPromiseType(node)) return true; | ||
| 107 | |||
| 108 | switch (node.type) { | ||
| 109 | case "TSTypeAnnotation": | ||
| 110 | return containsPromiseType(node.typeAnnotation); | ||
| 111 | case "TSFunctionType": | ||
| 112 | return containsPromiseType(node.returnType); | ||
| 113 | case "TSParenthesizedType": | ||
| 114 | return containsPromiseType(node.typeAnnotation); | ||
| 115 | case "TSUnionType": | ||
| 116 | case "TSIntersectionType": | ||
| 117 | return (node.types ?? []).some(containsPromiseType); | ||
| 118 | case "TSConditionalType": | ||
| 119 | return containsPromiseType(node.trueType) || containsPromiseType(node.falseType); | ||
| 120 | default: | ||
| 121 | return false; | ||
| 122 | } | ||
| 123 | } | ||
| 124 | |||
| 125 | export function nodeName(node) { | ||
| 126 | if (isIdentifier(node)) return node.name; | ||
| 127 | if (node?.type === "PrivateIdentifier") return node.name; | ||
| 128 | if (isStringLiteral(node)) return node.value; | ||
| 129 | return undefined; | ||
| 130 | } | ||