Skip to content
This repository has been archived by the owner on Feb 16, 2024. It is now read-only.

[Codemod:next/13/replace-next-head] component mistakenly treated as a page #352

Open
DmytroHryshyn opened this issue Sep 19, 2023 · 3 comments
Labels
false positive The codemod transformation has been incorrect. Next.js

Comments

@DmytroHryshyn
Copy link
Contributor

Additional context

Component path: /Users/mac1/work/Projects/intuita/cal.com/apps/web/components/booking/pages/BookingPage.tsx
Codemod treats it as a page because it contains pages in the path.

@DmytroHryshyn DmytroHryshyn added false positive The codemod transformation has been incorrect. Next.js labels Sep 19, 2023
@Zergus
Copy link

Zergus commented Oct 23, 2023

Is consideration that "pages" always should come first in Next.js structure within any kind of "src" satisfies the fix?
Eg.

//Before
includePatterns: ['**/pages/**/*.{jsx,tsx,js,ts,cjs,ejs,mdx}'], 

//After
includePatterns: ['*/pages/**/*.{jsx,tsx,js,ts,cjs,ejs,mdx}']`. 

Otherwise excluding "components" might work since it is common name for components folder.

excludePatterns: ['**/components/**', '**/node_modules/**', '**/pages/api/**'],

The third option is to expose new parameter to be passed eg. "pathToPages".

@mohab-sameh
Copy link
Contributor

@all-contributors add @Zergus for ideas

@allcontributors
Copy link
Contributor

@mohab-sameh

I've put up a pull request to add @Zergus! 🎉

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
false positive The codemod transformation has been incorrect. Next.js
Projects
None yet
Development

No branches or pull requests

3 participants