Home / Function/ getLints() — supabase Function Reference

getLints() — supabase Function Reference

Architecture documentation for the getLints() function in page.tsx from the supabase codebase.

Entity Profile

Dependency Diagram

graph TD
  d1e7cd4b_f3dc_44dd_6156_af58f4410a41["getLints()"]
  cc5c129d_acf8_c4f4_faa0_5127ca121e21["DatabaseAdvisorDocs()"]
  cc5c129d_acf8_c4f4_faa0_5127ca121e21 -->|calls| d1e7cd4b_f3dc_44dd_6156_af58f4410a41
  f2c9d510_78e4_916b_9413_99c971c4b5e9["getBasename()"]
  d1e7cd4b_f3dc_44dd_6156_af58f4410a41 -->|calls| f2c9d510_78e4_916b_9413_99c971c4b5e9
  style d1e7cd4b_f3dc_44dd_6156_af58f4410a41 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

apps/docs/app/guides/database/database-advisors/page.tsx lines 146–191

const getLints = async () => {
  const octokit = new Octokit({ request: { fetch: fetchRevalidatePerDay } })

  const response = await octokit.request('GET /repos/{owner}/{repo}/contents/{path}', {
    owner: org,
    repo: repo,
    path: docsDir,
    ref: branch,
    headers: {
      'X-GitHub-Api-Version': '2022-11-28',
    },
  })

  if (response.status >= 400) {
    throw Error(`Could not get contents of repo ${org}/${repo}`)
  }

  if (!Array.isArray(response.data)) {
    throw Error(
      'Reading a directory, not a file. Should not reach this, solely to appease Typescript.'
    )
  }

  const lintsList = response.data.filter(({ path }) => /docs\/\d+.+\.md$/.test(path))

  const lints = await Promise.all(
    lintsList.map(async ({ path }) => {
      const fileResponse = await fetchRevalidatePerDay(
        `https://raw.githubusercontent.com/${org}/${repo}/${branch}/${path}`
      )

      if (fileResponse.status >= 400) {
        throw Error(`Could not get contents of file ${org}/${repo}/${path}`)
      }

      const content = await fileResponse.text()

      return {
        path: getBasename(path),
        content,
      }
    })
  )

  return { lints, lintsList }
}

Subdomains

Frequently Asked Questions

What does getLints() do?
getLints() is a function in the supabase codebase.
What does getLints() call?
getLints() calls 1 function(s): getBasename.
What calls getLints()?
getLints() is called by 1 function(s): DatabaseAdvisorDocs.

Analyze Your Own Codebase

Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.

Try Supermodel Free