ember-tooling / prettier-plugin-ember-template-tag

A prettier plugin for formatting Ember template tags
MIT License
22 stars 12 forks source link

[Bug] Unexpected token error on route files #173

Closed NullVoxPopuli closed 10 months ago

NullVoxPopuli commented 11 months ago

🐞 Describe the Bug

Error:

[error] app/templates/application.gts: SyntaxError: Unexpected token (8:2)
[error]    6 |
[error]    7 | export default Route(
[error] >  8 |   <template>
[error]      |  ^
[error]    9 |     {{pageTitle "ember-primitives"}}
[error]   10 |
[error]   11 |     <Layout />

Input

import Layout from 'docs-app/components/layout';
import pageTitle from 'ember-page-title/helpers/page-title';
import Route from 'ember-route-template';

export default Route(
  <template>
    {{pageTitle "ember-primitives"}}

    <Layout />
  </template>
);

🔬 Minimal Reproduction

the above file this config:

'use strict';

module.exports = {
  singleQuote: true,
  printWidth: 100,
  plugins: ['prettier-plugin-ember-template-tag'],
  overrides: [
    {
      files: ['**/*.hbs'],
      options: {
        singleQuote: false,
      },
    },
    {
      files: ['**/*.gjs', '**/*.gts'],
      plugins: ['prettier-plugin-ember-template-tag'],
    },
  ],
};

😕 Actual Behavior

error

🤔 Expected Behavior

no error

🌍 Environment

gitKrystan commented 11 months ago

The plugin as written doesn't expect <template> in that position. Hopefully it will be fixed with https://github.com/gitKrystan/prettier-plugin-ember-template-tag/pull/162 .

NullVoxPopuli commented 11 months ago

The plugin as written doesn't expect