As a code reviewer for Next.js projects, ensure that all code artifacts, including component names, file names, and configuration keys, adhere to consistent naming conventions.
As a code reviewer for Next.js projects, ensure that all code artifacts, including component names, file names, and configuration keys, adhere to consistent naming conventions. This helps improve code readability, maintainability, and alignment with the Next.js framework’s best practices.
Key guidelines:
.jsx
for React components and .js
for non-React JavaScript files.staticPageGenerationSourcemaps
instead of staticPageGenerationSourceMaps
.Example of inconsistent Next.js code:
// Inconsistent file extensions
pages/search.js // Should be search.jsx for a React component
pages/utils.ts // Should be utils.js for a non-React JavaScript file
// Inconsistent configuration keys
next.config.js:
{
staticPageGenerationSourceMaps: false, // Documentation
staticPageGenerationSourcemaps: false // Implementation
}
Corrected version:
// Consistent file extensions
pages/search.jsx // React component
pages/utils.js // Non-React JavaScript file
// Consistent configuration keys
next.config.js:
{
staticPageGenerationSourcemaps: false, // Matches implementation
}
Enter the URL of a public GitHub repository