no-html-link-for-pages eslint rule uses cwd instead of project directory #43526
Replies: 11 comments 1 reply
-
To be clear, explicitly setting the path like
works. But if possible, it would be great if the rule could automatically find the pages directory from the NextJS project root |
Beta Was this translation helpful? Give feedback.
-
Hey @brandonchinn178, I'm currently working on something around this. Are you working from a monorepo? Or just a custom folder in a project? |
Beta Was this translation helpful? Give feedback.
-
Yes, I'm in a monorepo |
Beta Was this translation helpful? Give feedback.
-
Great, I think the solution in #27918 will help - but I'm not sure about auto-detecting, as that's more error-prone. Please let me know what you think. |
Beta Was this translation helpful? Give feedback.
-
Looks great! Are there any other rules this is applicable for? Even if not, it's good/it makes sense to have this as a global setting. Is it possible to have it default to the location of the eslintrc file it's in? for my usecase, i wouldnt even need to set the setting then |
Beta Was this translation helpful? Give feedback.
-
I don't think so, but I imagine there will be - and like you, I think it makes more sense to have this as a global setting. So the way we're rolling out our updated ESLint configs at Vercel is that we have a root config, and then use overrides to set any per-workspace settings. So everything is root-level in the monorepo. I'm guessing (correct me if I'm wrong) that you're running ESLint from the root of the repo, but the ESLint config file is within the workspace. What happens if you run the ESLint command from within the workspace? I imagine that might work because ESLint's context would then be that workspace. |
Beta Was this translation helpful? Give feedback.
-
Yes, that's correct.
It would probably work, but I think it would break the dev workflow, or at least complicate the scripts that run eslint. |
Beta Was this translation helpful? Give feedback.
-
Yes, I understand. I'll give it thought and see if there are any smart ways to automate this in future. |
Beta Was this translation helpful? Give feedback.
-
It seems that we don't have anything actionable now (it's not really a bug). |
Beta Was this translation helpful? Give feedback.
-
I got the same error after using the new
|
Beta Was this translation helpful? Give feedback.
-
Hey. Any updates here? |
Beta Was this translation helpful? Give feedback.
-
What version of Next.js are you using?
11.0.1-canary.4
What version of Node.js are you using?
14.15.5
What browser are you using?
Chrome
What operating system are you using?
macOS
How are you deploying your application?
vercel
Describe the Bug
I have a project with separate directories for client and server (my project has two servers: nextjs and graphql), with the path
client/next.config.js
. Running eslint from the root directory using the next eslint plugin showsThis happens whether I add the plugin in the top-level
.eslintrc
or in theclient/.eslintrc
Expected Behavior
Rule should look for
pages
directory in the same directory asnext.config.js
(or some other marker of a NextJS project). Alternatively, rule should look forpages
directory in the same directory as the.eslintrc
file it's added in.To Reproduce
Create a NextJS project in a subdirectory and run linting from the parent directory.
Beta Was this translation helpful? Give feedback.
All reactions