Fix: Improve error messages for non-string values in getStaticPaths#92991
Open
nikitanagar08 wants to merge 4 commits intovercel:canaryfrom
Open
Fix: Improve error messages for non-string values in getStaticPaths#92991nikitanagar08 wants to merge 4 commits intovercel:canaryfrom
nikitanagar08 wants to merge 4 commits intovercel:canaryfrom
Conversation
Fixes vercel#53473 The `@next/next/no-html-link-for-pages` ESLint rule now respects the custom `pageExtensions` configuration from Next.js. Previously, the rule only detected files with hardcoded extensions (.js, .jsx, .ts, .tsx), causing false positives when using custom page extensions like `.page.tsx`. Changes: - Added second option to rule schema for pageExtensions array - Modified parseUrlForPages() and parseUrlForAppDir() to accept custom extensions - Updated file matching regex to use configured pageExtensions - Default extensions remain ['tsx', 'ts', 'jsx', 'js'] for backward compatibility Usage: ```js // eslint.config.js { rules: { '@next/next/no-html-link-for-pages': ['error', 'pages', ['.page.tsx']] } } ```
Fixes vercel#41281 Enhanced error messaging when getStaticPaths receives non-string parameter values, providing clearer guidance on how to fix the issue. Previously, errors like "received number in getStaticPaths" were not immediately actionable. Now users get a clear explanation: - What type was expected (string) - What type was received (number, boolean, etc.) - How to fix it (convert to string) Example improvements: - Before: "received number in getStaticPaths for /articles/[id]" - After: "Expected: string (e.g., "123")\nReceived: number (e.g., 123). Make sure to convert to string: String(123)" Changes: - Added detailed type validation error messages - Included conversion examples for common types - Added link to documentation for more information
Fix the nested template literal syntax in the error message for non-string parameter values. The previous version had incorrect closing syntax that caused a parse error.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #41281
Enhanced error messaging for getStaticPaths with non-string parameter values.