vercel / style-guide

Vercel's engineering style guide
Mozilla Public License 2.0
1.25k stars 33 forks source link

Vercel Docs Violate Lint Rule (Webhooks) #104

Open dannyrb opened 5 months ago

dannyrb commented 5 months ago

Ref: https://vercel.com/docs/observability/webhooks-overview/webhooks-api#securing-webhooks Rule: https://github.com/vercel/style-guide/blob/canary/eslint/rules/unicorn.js#L20

Snippet:

import type { NextApiRequest, NextApiResponse } from 'next';
import crypto from 'crypto';
import getRawBody from 'raw-body';

The linter wants crypto to be node:crypto; but it's not clear if node:crypto is available on edge and middleware runtimes. It's unclear if the rule should auto fix, or if this is an exception and a doc issue.