ember-cli / eslint-plugin-ember

An ESLint plugin that provides set of rules for Ember applications based on commonly known good practices.
MIT License
259 stars 201 forks source link

Updating ember-template-imports breaks test in gjs-gts-processor-test.js #1685

Open nlfurniss opened 1 year ago

nlfurniss commented 1 year ago

This test fails when ember-template-imports was upgraded from 3.1.1 to 3.1.2.

If the scenario is changed to look like this:

  {
    filename: 'my-component.gjs',
    code: `
-      const Foo = <template>hi</template>
+     const Foo = <template>"hi"</template>
      <template>
        <Foo />
      </template>
    `,
  },

then the test passes, though it is not yet clear why.

gabrielcsapo commented 1 year ago

Failure when updating is

    Expected: ""
    Received: "Preprocessing error: Cannot overwrite a zero-length range – use appendLeft or prependRight instead"
gabrielcsapo commented 1 year ago

full stack is

    Error: Cannot overwrite a zero-length range – use appendLeft or prependRight instead
        at MagicString.overwrite (/Users/gcsapo/Documents/eslint-plugin-ember/node_modules/ember-template-imports/node_modules/magic-string/src/MagicString.js:344:10)
        at ensureBackticksEscaped (/Users/gcsapo/Documents/eslint-plugin-ember/node_modules/ember-template-imports/lib/preprocess-embedded-templates.js:137:7)
        at replaceMatch (/Users/gcsapo/Documents/eslint-plugin-ember/node_modules/ember-template-imports/lib/preprocess-embedded-templates.js:54:5)
        at preprocessEmbeddedTemplates (/Users/gcsapo/Documents/eslint-plugin-ember/node_modules/ember-template-imports/lib/preprocess-embedded-templates.js:114:34)
        at preprocessEmbeddedTemplates (/Users/gcsapo/Documents/eslint-plugin-ember/lib/preprocessors/glimmer.js:63:20)
gabrielcsapo commented 1 year ago

introduced as a result of https://github.com/ember-template-imports/ember-template-imports/commit/47c08d64f956fa4cf55c6a0ff8a61c87b6b551da