Skip to content

Issues with semi-colons? #227

@machty

Description

@machty

Historically we've disabled semi-colons in our eslint/prettier setup (but it's not really important for us to keep it that way), and I think I'm finding that ember-template-imports requires/assumes you're using semi colons due to the following:

export default class StarRating2Component extends GlimmerComponent<StarRatingSignature> {
  ratings = [1, 2, 3, 4, 5]

  <template>
    <div ...attributes>
      ...
    </div>
  </template>
}

yields error

[0]   20 |SyntaxError: /Users/machty/code/fpr/fpr-ember/packages/@futureproofretail/shopper-app/@futureproofretail/shopper-app/components/star-rating-2.ts: Attempted to use `<template>` to define a template in an unsupported way. Templates defined using this syntax must be:
[0] 
[0] 1. Assigned to a variable declaration OR
[0] 2. The default export of a file OR
[0] 2. In the top level of the file on their own (sugar for `export default`) OR
[0] 4. Used directly within a named class body
[0]   15 |
[0]   16 | export default class StarRating2Component extends GlimmerComponent<StarRatingSignature> {
[0] > 17 |   ratings = [1, 2, 3, 4, 5]
[0]      |             ^
[0]   18 |
[0]   19 |   
[0]   20 |
[0]     at File.buildCodeFrameError (/Users/machty/code/fpr/fpr-ember/node_modules/.pnpm/@[email protected]/node_modules/@babel/core/lib/transformation/file/file.js:205:12)

If I add a semi-colon after ratings, it compiles.

I searched this repo for "semi-colon" and this is the only issue comment that turned up: #31

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions