在不切换Typescript的情况下,如何修复Import/no-default-Export?
我正在尝试将所有选择器放入外部JS文件中,然后在需要时将它们导入到我的页面对象中:
Home-page-selectors.js:
export default {
headerLinks: 'header a',
contactUsLink: "header a[href='/contact-us']",
}
home-page.js包括从'../test-data/home导入选择器-page-data.js'
我可以做cy.get(selectors.headerlinks)之类的事情
问题是当我运行棉绒任务时,我会从homepage-- selectors.js说
错误优先命名导出导入/no-default-export
如何解决此错误?我知道我可以在Typescript中进行多种方法,但是不幸的是,由于我们使用的许多插件不兼容,因此切换到TS并不是一个选择。
I'm trying to put all my selectors in an external JS file and then import them in to my page object when I need them e.g. :
Home-page-selectors.js:
export default {
headerLinks: 'header a',
contactUsLink: "header a[href='/contact-us']",
}
Home-page.js includes import selectors from '../test-data/home-page-data.js'
I can then do things like cy.get(selectors.headerLinks)
The problem is when I run my lint tasks I get an error from Home-page-selectors.js saying
error Prefer named exports import/no-default-export
How can I fix this error? I know multiple ways I can do it in TypeScript but unfortunately switching to TS isn't an option due to a number of plugins we use not being compatible.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论