Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adjust error message for re-exported class when it has a co-located template #773

Conversation

robinborst95
Copy link
Contributor

As mentioned in #772, the error message for re-exported classes with a different template is not very descriptive. This PR fixes that, let me know what you think of this new error message. Note that I adjusted the file path of the other error message as well, as it contained .hbs, while in fact the error was about the .js file.

if (hasTemplate && !jsContents.includes('export default')) {
let message = `\`${relativePath}\` does not contain a \`default export\`. Did you forget to export the component class?`;
if (hasTemplate && jsContents.includes('export { default }')) {
let message = `\`${backingClassPath}\` contains an \`export { default }\` re-export, but it has a co-located template. You must explicitly extend the component to assign it a different template.`;

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this message is beautiful!

@mansona mansona merged commit 8eb78cd into ember-cli:master Aug 8, 2023
@robinborst95 robinborst95 deleted the fix/co-located-template-with-re-exported-class-error-message branch August 8, 2023 15:26
@kategengler
Copy link
Member

It doesn't appear CI ran here

@mansona
Copy link
Member

mansona commented Aug 8, 2023

🙈 should we add some required checks to github for the CI?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants