mirror of
https://github.com/supabase/supabase.git
synced 2026-05-22 17:00:43 +08:00
23 lines
575 B
TypeScript
23 lines
575 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 } => {
|
|
const matchingLints = lints?.filter(
|
|
(lint) =>
|
|
lint?.metadata?.name === entityName &&
|
|
lint?.metadata?.schema === schema &&
|
|
lint?.name === lintName &&
|
|
lintLevels.includes(lint?.level as 'ERROR' | 'WARN')
|
|
)
|
|
|
|
return {
|
|
hasLint: matchingLints.length > 0,
|
|
count: matchingLints.length,
|
|
}
|
|
}
|