如何为Next/链接添加ESLINT约束
如果使用了Next/link的组件,我想显示刺激错误。
唯一允许的路由应该来自违规。
我已将“@next/next/no-html-link-for-for-for-for”添加到Eslint规则中,它仅允许使用标签并解决此错误。
12:9错误:请勿使用HTML标签导航到 /。改用“ Next/link”的链接。请参阅: https://nextjs.s.org/docs/docs/messages/messages/messages/no-------- html-link-forpages @next/next/noth/no-html-link-for页面
代替此,如果使用组件,它不会在终端上显示ESLINT错误。
谁能帮我吗?
I want to display a linting error if the component from next/link is used.
The only routing allowed should come from the defualt .
I've added the "@next/next/no-html-link-for-pages": "off" statement to eslint rules, it only allows the use of tag and solved this error.
12:9 Error: Do not use the HTML tag to navigate to /. Use Link from 'next/link' instead. See: https://nextjs.org/docs/messages/no-html-link-for-pages @next/next/no-html-link-for-pages
In place of this, it does not display eslint errors on the terminal if the component is used.
Can anyone help me?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
该警告消息希望您使用
next/link
而不是< a>
。在您的代码中,您可能需要使用
< a/>
导航到新页面,从而导致不必要的全页刷新,从而影响您的应用程序的性能。反而That warning message wants you to use
next/link
instead of<a>
. In your code, you might have this to navigate to a new pageUsing
<a/>
causes unnecessary full-page refreshes which affects on the performance of your app. Instead