mirror of
https://github.com/supabase/supabase.git
synced 2026-07-06 00:54:56 +08:00
* Start * Start * Move advisors * cleanup * Add redirects * Check for an id * Cleanup * Link to the advisor from the table editor * Cleanup * Link to rows in performance grid
25 lines
638 B
TypeScript
25 lines
638 B
TypeScript
import { Lint } from '../../../data/lint/lint-query'
|
|
|
|
export const getEntityLintDetails = (
|
|
entityName: string,
|
|
lintName: string,
|
|
lintLevels: ('ERROR' | 'WARN')[],
|
|
lints: Lint[],
|
|
schema: string
|
|
): { hasLint: boolean; count: number; matchingLint: Lint | null } => {
|
|
const matchingLint =
|
|
lints?.find(
|
|
(lint) =>
|
|
lint?.metadata?.name === entityName &&
|
|
lint?.metadata?.schema === schema &&
|
|
lint?.name === lintName &&
|
|
lintLevels.includes(lint?.level as 'ERROR' | 'WARN')
|
|
) || null
|
|
|
|
return {
|
|
hasLint: matchingLint !== null,
|
|
count: matchingLint ? 1 : 0,
|
|
matchingLint,
|
|
}
|
|
}
|