From 9efe7b1cc64c550917bbf3b8b6ed296e4abc5342 Mon Sep 17 00:00:00 2001 From: Alexey Kulakov Date: Tue, 9 Jul 2024 06:58:49 -0700 Subject: [PATCH] feat: drop support for classic component layout (#721) * feat: drop support for classic component layout * Delete component with classicly resolved template --------- Co-authored-by: NullVoxPopuli <199018+NullVoxPopuli@users.noreply.github.com> --- .../-private/environment/index.ts | 3 --- .../__tests__/environment.test.ts | 8 -------- test-packages/ts-ember-app/app/components/foo.hbs | 2 -- test-packages/ts-ember-app/app/components/qux.ts | 12 ------------ .../ts-ember-app/app/templates/components/qux.hbs | 4 ---- .../tests/integration/components/qux-test.ts | 13 ------------- .../ts-ember-preview-types/app/components/foo.hbs | 2 -- .../ts-ember-preview-types/app/components/qux.ts | 11 ----------- .../app/templates/components/qux.hbs | 4 ---- 9 files changed, 59 deletions(-) delete mode 100644 test-packages/ts-ember-app/app/components/qux.ts delete mode 100644 test-packages/ts-ember-app/app/templates/components/qux.hbs delete mode 100644 test-packages/ts-ember-app/tests/integration/components/qux-test.ts delete mode 100644 test-packages/ts-ember-preview-types/app/components/qux.ts delete mode 100644 test-packages/ts-ember-preview-types/app/templates/components/qux.hbs diff --git a/packages/environment-ember-loose/-private/environment/index.ts b/packages/environment-ember-loose/-private/environment/index.ts index cc0c80214..61a2b7504 100644 --- a/packages/environment-ember-loose/-private/environment/index.ts +++ b/packages/environment-ember-loose/-private/environment/index.ts @@ -62,9 +62,6 @@ export default function emberLooseEnvironment( templatePath.replace(REGEXES.POD_TEMPLATE, '/controller.ts'), templatePath.replace(REGEXES.POD_TEMPLATE, '/route.ts'), ); - } else if (templatePath.includes('/templates/components/')) { - // Classic component - candidates.push(colocatedTsScriptPath.replace('/templates/components/', '/components/')); } else if (templatePath.includes('/templates/')) { // Classic controller/route candidates.push( diff --git a/packages/environment-ember-loose/__tests__/environment.test.ts b/packages/environment-ember-loose/__tests__/environment.test.ts index 962152d72..627c84dbc 100644 --- a/packages/environment-ember-loose/__tests__/environment.test.ts +++ b/packages/environment-ember-loose/__tests__/environment.test.ts @@ -69,14 +69,6 @@ describe('Environments: Ember Loose', () => { '/route.js', ]); - // Classic component - expect(env?.getPossibleScriptPaths('/templates/components/hello.hbs')).toEqual([ - '/templates/components/hello.ts', - '/templates/components/hello.js', - '/components/hello.ts', - '/components/hello.js', - ]); - // Classic controller/route expect(env?.getPossibleScriptPaths('/templates/hello.hbs')).toEqual([ '/templates/hello.ts', diff --git a/test-packages/ts-ember-app/app/components/foo.hbs b/test-packages/ts-ember-app/app/components/foo.hbs index d04a2dad0..def4a3bb4 100644 --- a/test-packages/ts-ember-app/app/components/foo.hbs +++ b/test-packages/ts-ember-app/app/components/foo.hbs @@ -20,8 +20,6 @@ - - {{! @glint-expect-error: missing required arg }} diff --git a/test-packages/ts-ember-app/app/components/qux.ts b/test-packages/ts-ember-app/app/components/qux.ts deleted file mode 100644 index de5031bba..000000000 --- a/test-packages/ts-ember-app/app/components/qux.ts +++ /dev/null @@ -1,12 +0,0 @@ -/* eslint-disable ember/no-classic-components, ember/require-tagless-components */ -import Component from '@ember/component'; - -export default class Qux extends Component { - name = 'QUX'; -} - -declare module '@glint/environment-ember-loose/registry' { - export default interface Registry { - Qux: typeof Qux; - } -} diff --git a/test-packages/ts-ember-app/app/templates/components/qux.hbs b/test-packages/ts-ember-app/app/templates/components/qux.hbs deleted file mode 100644 index 8131403b3..000000000 --- a/test-packages/ts-ember-app/app/templates/components/qux.hbs +++ /dev/null @@ -1,4 +0,0 @@ -{{this.name}} - -{{! @glint-expect-error: bad property }} -{{this.xyzzy}} diff --git a/test-packages/ts-ember-app/tests/integration/components/qux-test.ts b/test-packages/ts-ember-app/tests/integration/components/qux-test.ts deleted file mode 100644 index 8b81c8632..000000000 --- a/test-packages/ts-ember-app/tests/integration/components/qux-test.ts +++ /dev/null @@ -1,13 +0,0 @@ -import { module, test } from 'qunit'; -import { setupRenderingTest } from 'ember-qunit'; -import { render } from '@ember/test-helpers'; -import { hbs } from 'ember-cli-htmlbars'; - -module('Integration | Component | qux', function (hooks) { - setupRenderingTest(hooks); - - test('it renders', async function (assert) { - await render(hbs``); - assert.dom().hasText('QUX'); - }); -}); diff --git a/test-packages/ts-ember-preview-types/app/components/foo.hbs b/test-packages/ts-ember-preview-types/app/components/foo.hbs index d04a2dad0..def4a3bb4 100644 --- a/test-packages/ts-ember-preview-types/app/components/foo.hbs +++ b/test-packages/ts-ember-preview-types/app/components/foo.hbs @@ -20,8 +20,6 @@ - - {{! @glint-expect-error: missing required arg }} diff --git a/test-packages/ts-ember-preview-types/app/components/qux.ts b/test-packages/ts-ember-preview-types/app/components/qux.ts deleted file mode 100644 index 9994f9dcb..000000000 --- a/test-packages/ts-ember-preview-types/app/components/qux.ts +++ /dev/null @@ -1,11 +0,0 @@ -import Component from '@ember/component'; - -export default class Qux extends Component { - name = 'QUX'; -} - -declare module '@glint/environment-ember-loose/registry' { - export default interface Registry { - Qux: typeof Qux; - } -} diff --git a/test-packages/ts-ember-preview-types/app/templates/components/qux.hbs b/test-packages/ts-ember-preview-types/app/templates/components/qux.hbs deleted file mode 100644 index 8131403b3..000000000 --- a/test-packages/ts-ember-preview-types/app/templates/components/qux.hbs +++ /dev/null @@ -1,4 +0,0 @@ -{{this.name}} - -{{! @glint-expect-error: bad property }} -{{this.xyzzy}}