From 938c5d5c517831f61df739f7b8d19680bf3dbcb5 Mon Sep 17 00:00:00 2001 From: MukundaKatta Date: Tue, 14 Apr 2026 23:13:36 -0700 Subject: [PATCH] docs: add documentation for no-typos ESLint rule The `@next/next/no-typos` rule ships in `@next/eslint-plugin-next` but has no corresponding page under `errors/`, so users who click through from ESLint config inspectors hit a 404. This adds `errors/no-typos.mdx` describing what the rule catches (`getStaticProps` / `getStaticPaths` / `getServerSideProps`), a before/after example, and a casing example (the rule uses a 1-char edit-distance threshold). Addresses review feedback on #89436: - Title shortened to "No Typos" to match sibling rule docs - Casing example now has an actual casing typo (`getServerSideprops`) Fixes #67342 --- errors/no-typos.mdx | 55 +++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 55 insertions(+) create mode 100644 errors/no-typos.mdx diff --git a/errors/no-typos.mdx b/errors/no-typos.mdx new file mode 100644 index 000000000000..e00bb1a5f371 --- /dev/null +++ b/errors/no-typos.mdx @@ -0,0 +1,55 @@ +--- +title: No Typos +--- + +> Prevent common typos in Next.js data fetching functions. + +## Why This Error Occurred + +A near-miss spelling of a Next.js data fetching function was detected. This rule checks for typos in these exports inside the `pages/` directory: + +- `getStaticProps` +- `getStaticPaths` +- `getServerSideProps` + +When the name is off by even a single character, Next.js will not recognize the export and your data fetching logic will silently not run. + +## Possible Ways to Fix It + +Check the spelling and casing of your exported function so it matches a Next.js data fetching function exactly. + +**Before:** + +```jsx filename="pages/index.js" +// Typo: "getStaticProp" instead of "getStaticProps" +export async function getStaticProp() { + return { + props: {}, + } +} +``` + +**After:** + +```jsx filename="pages/index.js" +export async function getStaticProps() { + return { + props: {}, + } +} +``` + +Casing also matters — a single wrong-case letter will trip the rule: + +```jsx filename="pages/index.js" +// Typo: lowercase "p" in "props" +export async function getServerSideprops() { + return { props: {} } +} +``` + +## Useful Links + +- [`getStaticProps`](/docs/pages/building-your-application/data-fetching/get-static-props) +- [`getStaticPaths`](/docs/pages/building-your-application/data-fetching/get-static-paths) +- [`getServerSideProps`](/docs/pages/building-your-application/data-fetching/get-server-side-props)