From bf614b11b17aaa3e376e9e2f1bb494ce5f3ea5c4 Mon Sep 17 00:00:00 2001 From: Simon Ihmig Date: Thu, 16 Mar 2023 12:17:35 +0100 Subject: [PATCH 001/419] Convert addon to use template tag --- .prettierrc.js | 16 ++++++ .../ember-headless-form/babel.config.json | 1 + packages/ember-headless-form/package.json | 1 + .../ember-headless-form/rollup.config.mjs | 6 ++- .../{headless-form.ts => headless-form.gts} | 49 ++++++++++++++++--- .../src/components/headless-form.hbs | 34 ------------- .../src/{index.ts => index.gts} | 0 ...late-registry.ts => template-registry.gts} | 0 pnpm-lock.yaml | 43 +++++++++++----- test-app/.prettierrc.js | 23 --------- 10 files changed, 97 insertions(+), 76 deletions(-) rename packages/ember-headless-form/src/components/{headless-form.ts => headless-form.gts} (93%) delete mode 100644 packages/ember-headless-form/src/components/headless-form.hbs rename packages/ember-headless-form/src/{index.ts => index.gts} (100%) rename packages/ember-headless-form/src/{template-registry.ts => template-registry.gts} (100%) delete mode 100644 test-app/.prettierrc.js diff --git a/.prettierrc.js b/.prettierrc.js index f9f8cd21..ef60ba9b 100644 --- a/.prettierrc.js +++ b/.prettierrc.js @@ -4,4 +4,20 @@ module.exports = { plugins: ['prettier-plugin-ember-template-tag'], singleQuote: true, templateSingleQuote: false, + // this was required to make the VSCode + Prettier work correctly with } diff --git a/packages/ember-headless-form/src/-private/components/control/textarea.hbs b/packages/ember-headless-form/src/-private/components/control/textarea.hbs deleted file mode 100644 index 9e8c4ee4..00000000 --- a/packages/ember-headless-form/src/-private/components/control/textarea.hbs +++ /dev/null @@ -1,8 +0,0 @@ - \ No newline at end of file diff --git a/packages/ember-headless-form/src/-private/components/errors.ts b/packages/ember-headless-form/src/-private/components/errors.gts similarity index 73% rename from packages/ember-headless-form/src/-private/components/errors.ts rename to packages/ember-headless-form/src/-private/components/errors.gts index 8c49652c..da6e7dd8 100644 --- a/packages/ember-headless-form/src/-private/components/errors.ts +++ b/packages/ember-headless-form/src/-private/components/errors.gts @@ -25,4 +25,18 @@ export interface HeadlessFormErrorsComponentSignature { // eslint-disable-next-line ember/no-empty-glimmer-component-classes -- unfortunately we cannot use templateOnlyComponent() here, as it is not possible to type that as a generic type, like templateOnlyComponent> export default class HeadlessFormErrorsComponent extends Component< HeadlessFormErrorsComponentSignature -> {} +> { + +} diff --git a/packages/ember-headless-form/src/-private/components/errors.hbs b/packages/ember-headless-form/src/-private/components/errors.hbs deleted file mode 100644 index 2aa58e19..00000000 --- a/packages/ember-headless-form/src/-private/components/errors.hbs +++ /dev/null @@ -1,11 +0,0 @@ -
- {{#if (has-block)}} - {{yield @errors}} - {{else}} - {{#each @errors as |e|}} - {{#if e.message}} - {{e.message}}
- {{/if}} - {{/each}} - {{/if}} -
\ No newline at end of file diff --git a/packages/ember-headless-form/src/-private/components/field.ts b/packages/ember-headless-form/src/-private/components/field.gts similarity index 78% rename from packages/ember-headless-form/src/-private/components/field.ts rename to packages/ember-headless-form/src/-private/components/field.gts index 5ac9c045..d1b7e85b 100644 --- a/packages/ember-headless-form/src/-private/components/field.ts +++ b/packages/ember-headless-form/src/-private/components/field.gts @@ -1,8 +1,10 @@ import Component from '@glimmer/component'; import { assert } from '@ember/debug'; +import { fn, hash } from '@ember/helper'; import { action, get } from '@ember/object'; import CaptureEventsModifier from '../modifiers/capture-events'; +import { uniqueId } from '../utils'; import CheckboxComponent from './control/checkbox'; import InputComponent from './control/input'; import RadioGroupComponent from './control/radio-group'; @@ -279,4 +281,85 @@ export default class HeadlessFormFieldComponent< setValue(value: unknown): void { this.args.set(this.args.name, value as DATA[KEY]); } + + } + +// eslint-disable-next-line @typescript-eslint/no-unused-vars -- workaround for unknown modifier helper: https://github.com/typed-ember/glint/issues/410 +declare const modifier: any; diff --git a/packages/ember-headless-form/src/-private/components/field.hbs b/packages/ember-headless-form/src/-private/components/field.hbs deleted file mode 100644 index f144ca44..00000000 --- a/packages/ember-headless-form/src/-private/components/field.hbs +++ /dev/null @@ -1,79 +0,0 @@ -{{#let - (unique-id) - (unique-id) - (fn @set @name) - (fn @triggerValidationFor @name) - as |fieldId errorId setValue triggerValidation| -}} - {{yield - (hash - Label=(component - (ensure-safe-component this.LabelComponent) fieldId=fieldId - ) - Input=(component - (ensure-safe-component this.InputComponent) - name=@name - fieldId=fieldId - errorId=errorId - value=this.valueAsString - setValue=this.setValue - invalid=this.hasErrors - ) - Checkbox=(component - (ensure-safe-component this.CheckboxComponent) - name=@name - fieldId=fieldId - errorId=errorId - value=this.valueAsBoolean - setValue=this.setValue - invalid=this.hasErrors - ) - Select=(component - (ensure-safe-component this.SelectComponent) - name=@name - fieldId=fieldId - errorId=errorId - value=this.valueAsString - setValue=this.setValue - invalid=this.hasErrors - ) - Textarea=(component - (ensure-safe-component this.TextareaComponent) - name=@name - fieldId=fieldId - errorId=errorId - value=this.valueAsString - setValue=this.setValue - invalid=this.hasErrors - ) - RadioGroup=(component - (ensure-safe-component this.RadioGroupComponent) - name=@name - errorId=errorId - selected=this.valueAsString - setValue=this.setValue - invalid=this.hasErrors - ) - value=this.value - setValue=setValue - id=fieldId - errorId=errorId - Errors=(if - this.errors - (component - (ensure-safe-component this.ErrorsComponent) - errors=this.errors - id=errorId - ) - ) - isInvalid=this.hasErrors - rawErrors=this.errors - triggerValidation=triggerValidation - captureEvents=(modifier - this.CaptureEventsModifier - event=(if this.hasErrors @fieldRevalidationEvent @fieldValidationEvent) - triggerValidation=triggerValidation - ) - ) - }} -{{/let}} \ No newline at end of file diff --git a/packages/ember-headless-form/src/-private/components/label.gts b/packages/ember-headless-form/src/-private/components/label.gts new file mode 100644 index 00000000..2aca44b0 --- /dev/null +++ b/packages/ember-headless-form/src/-private/components/label.gts @@ -0,0 +1,25 @@ +import type { TemplateOnlyComponent } from '@ember/component/template-only'; + +export interface HeadlessFormLabelComponentSignature { + Element: HTMLLabelElement; + Args: { + // the following are private arguments curried by the component helper, so users will never have to use those + + /* + * @internal + */ + fieldId: string; + }; + Blocks: { + default: []; + }; +} + +const HeadlessFormLabelComponent: TemplateOnlyComponent = + ; + +export default HeadlessFormLabelComponent; diff --git a/packages/ember-headless-form/src/-private/components/label.hbs b/packages/ember-headless-form/src/-private/components/label.hbs deleted file mode 100644 index 410e164c..00000000 --- a/packages/ember-headless-form/src/-private/components/label.hbs +++ /dev/null @@ -1,3 +0,0 @@ - \ No newline at end of file diff --git a/packages/ember-headless-form/src/-private/components/label.ts b/packages/ember-headless-form/src/-private/components/label.ts deleted file mode 100644 index 8a2b49fb..00000000 --- a/packages/ember-headless-form/src/-private/components/label.ts +++ /dev/null @@ -1,18 +0,0 @@ -import templateOnlyComponent from '@ember/component/template-only'; - -export interface HeadlessFormLabelComponentSignature { - Element: HTMLLabelElement; - Args: { - // the following are private arguments curried by the component helper, so users will never have to use those - - /* - * @internal - */ - fieldId: string; - }; - Blocks: { - default: []; - }; -} - -export default templateOnlyComponent(); diff --git a/packages/ember-headless-form/src/-private/utils.ts b/packages/ember-headless-form/src/-private/utils.ts index acae2c04..87f7e47e 100644 --- a/packages/ember-headless-form/src/-private/utils.ts +++ b/packages/ember-headless-form/src/-private/utils.ts @@ -28,3 +28,14 @@ export function mergeErrorRecord< return errors; } + +// this is copy pasted from https://github.com/emberjs/ember.js/blob/60d2e0cddb353aea0d6e36a72fda971010d92355/packages/%40ember/-internals/glimmer/lib/helpers/unique-id.ts +// Unfortunately due to https://github.com/emberjs/ember.js/issues/20165 we cannot use the built-in version in template tags +export function uniqueId() { + // @ts-expect-error this one-liner abuses weird JavaScript semantics that + // TypeScript (legitimately) doesn't like, but they're nonetheless valid and + // specced. + return ([3e7] + -1e3 + -4e3 + -2e3 + -1e11).replace(/[0-3]/g, (a) => + ((a * 4) ^ ((Math.random() * 16) >> (a & 2))).toString(16) + ); +} diff --git a/packages/ember-headless-form/src/components/headless-form.gts b/packages/ember-headless-form/src/components/headless-form.gts index 67b2a70c..d17fa15a 100644 --- a/packages/ember-headless-form/src/components/headless-form.gts +++ b/packages/ember-headless-form/src/components/headless-form.gts @@ -4,7 +4,6 @@ import { assert, warn } from '@ember/debug'; import { hash } from '@ember/helper'; import { on } from '@ember/modifier'; import { action, set } from '@ember/object'; -import { EnsureSafeComponentHelper } from '@embroider/util'; import { TrackedAsyncData } from 'ember-async-data'; import { modifier as elementModifier } from 'ember-modifier'; @@ -23,14 +22,10 @@ import type { UserData, ValidationError, } from '../-private/types'; -import type { EnsureSafeComponentHelperFixed } from '@embroider/util'; import type { ModifierLike, WithBoundArgs } from '@glint/template'; type ValidateOn = 'change' | 'focusout' | 'submit' | 'input'; -const ensureSafeComponent = - EnsureSafeComponentHelper as typeof EnsureSafeComponentHelperFixed; - export interface HeadlessFormComponentSignature< DATA extends UserData, SUBMISSION_VALUE @@ -524,7 +519,7 @@ export default class HeadlessFormComponent< {{yield (hash Field=(component - (ensureSafeComponent this.FieldComponent) + this.FieldComponent data=this.internalData set=this.set errors=this.visibleErrors diff --git a/packages/ember-headless-form/unpublished-development-types/index.d.ts b/packages/ember-headless-form/unpublished-development-types/index.d.ts index 7f3a87d2..59661b66 100644 --- a/packages/ember-headless-form/unpublished-development-types/index.d.ts +++ b/packages/ember-headless-form/unpublished-development-types/index.d.ts @@ -3,39 +3,13 @@ import '@glint/environment-ember-loose'; -import Helper from '@ember/component/helper'; - -import { ComponentLike } from '@glint/template'; - import type HeadlessFormRegistry from '../src/template-registry'; -import type { EnsureSafeComponentHelperFixed } from '@embroider/util'; -import type TemplateRegistry from '@glint/environment-ember-loose/registry'; - -declare module '@embroider/util' { - // importing this directly from the published types (https://github.com/embroider-build/embroider/blob/main/packages/util/index.d.ts) does not work, - // see point 3 in Dan's comment here: https://github.com/typed-ember/glint/issues/518#issuecomment-1400306133 - export class EnsureSafeComponentHelperFixed< - // eslint-disable-next-line @typescript-eslint/no-explicit-any - C extends string | ComponentLike - > extends Helper<{ - Args: { - Positional: [component: C]; - }; - Return: C extends keyof TemplateRegistry - ? TemplateRegistry[C] - : C extends string - ? ComponentLike - : C; - }> {} -} declare module '@glint/environment-ember-loose/registry' { export default interface Registry extends HeadlessFormRegistry { // Add any registry entries from other addons here that your addon itself uses (in non-strict mode templates) // See https://typed-ember.gitbook.io/glint/using-glint/ember/using-addons - 'ensure-safe-component': typeof EnsureSafeComponentHelperFixed; - // eslint-disable-next-line @typescript-eslint/no-explicit-any -- effectively skipping type checks until https://github.com/typed-ember/glint/issues/410 is resolved modifier: any; } From f1d8baa70394830f954622bc72d08f249326d50d Mon Sep 17 00:00:00 2001 From: Simon Ihmig Date: Fri, 14 Apr 2023 12:27:25 +0200 Subject: [PATCH 008/419] Run embroider scenarios using unstable --- test-app/config/ember-try.js | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/test-app/config/ember-try.js b/test-app/config/ember-try.js index 9d1c8ef4..5905b9ff 100644 --- a/test-app/config/ember-try.js +++ b/test-app/config/ember-try.js @@ -54,6 +54,10 @@ module.exports = async function () { npm: { devDependencies: { 'ember-source': '~4.8.0', + // @todo remove this once we have a stable release that includes https://github.com/embroider-build/embroider/pull/1383 + '@embroider/core': '2.1.2-unstable.3a9d8ad', + '@embroider/compat': '2.1.2-unstable.3a9d8ad', + '@embroider/webpack': '2.1.2-unstable.3a9d8ad', }, }, }), @@ -62,6 +66,10 @@ module.exports = async function () { npm: { devDependencies: { 'ember-source': '~4.8.0', + // @todo remove this once we have a stable release that includes https://github.com/embroider-build/embroider/pull/1383 + '@embroider/core': '2.1.2-unstable.3a9d8ad', + '@embroider/compat': '2.1.2-unstable.3a9d8ad', + '@embroider/webpack': '2.1.2-unstable.3a9d8ad', }, }, }), @@ -70,6 +78,10 @@ module.exports = async function () { npm: { devDependencies: { 'ember-source': releaseVersion, + // @todo remove this once we have a stable release that includes https://github.com/embroider-build/embroider/pull/1383 + '@embroider/core': '2.1.2-unstable.3a9d8ad', + '@embroider/compat': '2.1.2-unstable.3a9d8ad', + '@embroider/webpack': '2.1.2-unstable.3a9d8ad', }, }, }), From 67a5169eb11552d7db9eb1f2553f59dfaad9aa65 Mon Sep 17 00:00:00 2001 From: Simon Ihmig Date: Fri, 14 Apr 2023 13:34:05 +0200 Subject: [PATCH 009/419] Add changeset --- .changeset/red-lizards-dress.md | 5 +++++ 1 file changed, 5 insertions(+) create mode 100644 .changeset/red-lizards-dress.md diff --git a/.changeset/red-lizards-dress.md b/.changeset/red-lizards-dress.md new file mode 100644 index 00000000..5d7dc3ed --- /dev/null +++ b/.changeset/red-lizards-dress.md @@ -0,0 +1,5 @@ +--- +'ember-headless-form': patch +--- + +Convert addon to use template tag From bb9843ff0b893f79c0088056d04d610a261f8f18 Mon Sep 17 00:00:00 2001 From: Simon Ihmig Date: Tue, 18 Apr 2023 12:20:38 +0200 Subject: [PATCH 010/419] Fix validate-changeset helper --- docs/validation/ember-changeset-demo/demo.md | 2 +- .../src/helpers/validate-changeset.ts | 75 +++++++++---------- .../integration/components/changeset-test.gts | 10 +-- .../unit/helpers/validate-changeset-test.ts | 10 +-- 4 files changed, 46 insertions(+), 51 deletions(-) diff --git a/docs/validation/ember-changeset-demo/demo.md b/docs/validation/ember-changeset-demo/demo.md index 84610dd7..00001f84 100644 --- a/docs/validation/ember-changeset-demo/demo.md +++ b/docs/validation/ember-changeset-demo/demo.md @@ -7,7 +7,7 @@ Using a Changeset instance to validate a form. @data={{changeset this.data this.validations}} @dataMode='mutable' @onSubmit={{this.handleSubmit}} - @validate={{validate-changeset}} + @validate={{(validate-changeset)}} as |form| > diff --git a/packages/changeset/src/helpers/validate-changeset.ts b/packages/changeset/src/helpers/validate-changeset.ts index bb0c918e..1a47f686 100644 --- a/packages/changeset/src/helpers/validate-changeset.ts +++ b/packages/changeset/src/helpers/validate-changeset.ts @@ -11,48 +11,45 @@ import { assert } from '@ember/debug'; * - pass this helper into the form's `@validate` hook `@validate={{validateChangeset}}` * - opt-in to `@dataMode="mutable"` */ -const validateChangeset: FormValidateCallback = async ( - changeset, - fields -) => { - assert( - 'Cannot use `validateChangeset` on `@data` that is not a Changeset instance!', - isChangeset(changeset) - ); - - // there is also an argument-less version of changeset.validate(), but for this to work the changeset needs a so called validationMap, and not just a validator function - // while ember-changeset-validations would provide such a map, we cannot necessarily rely on it being present, so the way to reliably validate all fields is to iterate - // over them explicitly - // - await Promise.all(fields.map((field) => changeset.validate(field))); - - if (changeset.get('isValid')) { - return; - } - - const errorRecord: ErrorRecord> = {}; - - for (const { key, value, validation } of changeset.get('errors')) { - if (!errorRecord[key]) { - errorRecord[key] = []; +export default function validateChangeset(): FormValidateCallback { + return async (changeset, fields) => { + assert( + 'Cannot use `validateChangeset` on `@data` that is not a Changeset instance!', + isChangeset(changeset) + ); + + // there is also an argument-less version of changeset.validate(), but for this to work the changeset needs a so called validationMap, and not just a validator function + // while ember-changeset-validations would provide such a map, we cannot necessarily rely on it being present, so the way to reliably validate all fields is to iterate + // over them explicitly + // + await Promise.all(fields.map((field) => changeset.validate(field))); + + if (changeset.get('isValid')) { + return; } - const errors = errorRecord[key]; - assert('Expected errorRecord to have array', errors); // TS does not understand errors cannot be undefined at this point + const errorRecord: ErrorRecord> = {}; - // some type casting due to https://github.com/validated-changeset/validated-changeset/issues/187 - const fixedValidations = validation as string | string[]; + for (const { key, value, validation } of changeset.get('errors')) { + if (!errorRecord[key]) { + errorRecord[key] = []; + } + const errors = errorRecord[key]; - // aggregate all errors into the ErrorRecord that is expected as the return type of the validate callback - const messages: string[] = Array.isArray(fixedValidations) - ? fixedValidations - : [fixedValidations]; - errors.push( - ...messages.map((message) => ({ type: 'changeset', value, message })) - ); - } + assert('Expected errorRecord to have array', errors); // TS does not understand errors cannot be undefined at this point + + // some type casting due to https://github.com/validated-changeset/validated-changeset/issues/187 + const fixedValidations = validation as string | string[]; - return errorRecord; -}; + // aggregate all errors into the ErrorRecord that is expected as the return type of the validate callback + const messages: string[] = Array.isArray(fixedValidations) + ? fixedValidations + : [fixedValidations]; + errors.push( + ...messages.map((message) => ({ type: 'changeset', value, message })) + ); + } -export default validateChangeset; + return errorRecord; + }; +} diff --git a/test-app/tests/integration/components/changeset-test.gts b/test-app/tests/integration/components/changeset-test.gts index d521ae83..30309ee8 100644 --- a/test-app/tests/integration/components/changeset-test.gts +++ b/test-app/tests/integration/components/changeset-test.gts @@ -59,7 +59,7 @@ module('Integration Component HeadlessForm > Changeset', function (hooks) { @data={{data}} @dataMode="mutable" {{! @glint-expect-error -- a type error is expected here, as this test intentionally has a type mismatch when data not being a changeset }} - @validate={{validateChangeset}} + @validate={{(validateChangeset)}} @onSubmit={{submitHandler}} as |form| > @@ -83,7 +83,7 @@ module('Integration Component HeadlessForm > Changeset', function (hooks) { @@ -109,7 +109,7 @@ module('Integration Component HeadlessForm > Changeset', function (hooks) { @@ -146,7 +146,7 @@ module('Integration Component HeadlessForm > Changeset', function (hooks) { @@ -180,7 +180,7 @@ module('Integration Component HeadlessForm > Changeset', function (hooks) { diff --git a/test-app/tests/unit/helpers/validate-changeset-test.ts b/test-app/tests/unit/helpers/validate-changeset-test.ts index 2df40d3c..ec977581 100644 --- a/test-app/tests/unit/helpers/validate-changeset-test.ts +++ b/test-app/tests/unit/helpers/validate-changeset-test.ts @@ -26,10 +26,12 @@ module('Unit | Helpers | validate-changeset', function () { return errors.length > 0 ? errors : true; }; + const validate = validateChangeset(); + test('it returns undefined if validation passes', async function (assert) { const changeset = Changeset({ firstName: 'Nicole' }, validator); - let result = await validateChangeset(changeset, ['firstName']); + let result = await validate(changeset, ['firstName']); assert.strictEqual(result, undefined); }); @@ -40,11 +42,7 @@ module('Unit | Helpers | validate-changeset', function () { validator ); - let result = await validateChangeset(changeset, [ - 'firstName', - 'lastName', - 'email', - ]); + let result = await validate(changeset, ['firstName', 'lastName', 'email']); assert.deepEqual(result, { firstName: [ From 5d750110000f22460207f963feed3bc7deccd473 Mon Sep 17 00:00:00 2001 From: Simon Ihmig Date: Tue, 18 Apr 2023 12:26:30 +0200 Subject: [PATCH 011/419] Add changeset --- .changeset/gold-tools-jump.md | 9 +++++++++ 1 file changed, 9 insertions(+) create mode 100644 .changeset/gold-tools-jump.md diff --git a/.changeset/gold-tools-jump.md b/.changeset/gold-tools-jump.md new file mode 100644 index 00000000..de8f3a26 --- /dev/null +++ b/.changeset/gold-tools-jump.md @@ -0,0 +1,9 @@ +--- +'ember-headless-form-changeset': patch +--- + +Fix changeset-helper to work with global resolution + +The previous API worked by passing the helper as-is without actually invoking it: `@validate={{validate-changeset}}`, as the expected return value of the helper is a function itself. But this does not work when globally resolving the helper by its string reference, i.e. when not using `); const promise = click('[data-test-submit]'); + await waitFor('[data-test-validation-state]'); assert diff --git a/test-app/tests/integration/components/headless-form-basic-test.gts b/test-app/tests/integration/components/headless-form-basic-test.gts index d7e5f96b..dedeacb6 100644 --- a/test-app/tests/integration/components/headless-form-basic-test.gts +++ b/test-app/tests/integration/components/headless-form-basic-test.gts @@ -1,5 +1,4 @@ /* eslint-disable no-undef -- Until https://github.com/ember-cli/eslint-plugin-ember/issues/1747 is resolved... */ -/* eslint-disable simple-import-sort/imports,padding-line-between-statements,decorator-position/decorator-position -- Can't fix these manually, without --fix working in .gts */ import { render, setupOnerror } from '@ember/test-helpers'; import { module, test } from 'qunit'; @@ -51,6 +50,7 @@ module('Integration Component HeadlessForm > Basics', function (hooks) { test('@name must be unique', async function (assert) { assert.expect(1); + const data = { firstName: 'Simon' }; setupOnerror((e: Error) => { diff --git a/test-app/tests/integration/components/headless-form-control-checkbox-test.gts b/test-app/tests/integration/components/headless-form-control-checkbox-test.gts index bd6dc50d..56a73411 100644 --- a/test-app/tests/integration/components/headless-form-control-checkbox-test.gts +++ b/test-app/tests/integration/components/headless-form-control-checkbox-test.gts @@ -1,5 +1,4 @@ /* eslint-disable no-undef -- Until https://github.com/ember-cli/eslint-plugin-ember/issues/1747 is resolved... */ -/* eslint-disable simple-import-sort/imports,padding-line-between-statements,decorator-position/decorator-position -- Can't fix these manually, without --fix working in .gts */ import { render } from '@ember/test-helpers'; import { module, test } from 'qunit'; diff --git a/test-app/tests/integration/components/headless-form-control-input-test.gts b/test-app/tests/integration/components/headless-form-control-input-test.gts index f5b71a36..c1930c2e 100644 --- a/test-app/tests/integration/components/headless-form-control-input-test.gts +++ b/test-app/tests/integration/components/headless-form-control-input-test.gts @@ -1,5 +1,4 @@ /* eslint-disable no-undef -- Until https://github.com/ember-cli/eslint-plugin-ember/issues/1747 is resolved... */ -/* eslint-disable simple-import-sort/imports,padding-line-between-statements,decorator-position/decorator-position -- Can't fix these manually, without --fix working in .gts */ import { render, setupOnerror } from '@ember/test-helpers'; import { module, test } from 'qunit'; diff --git a/test-app/tests/integration/components/headless-form-control-radio-test.gts b/test-app/tests/integration/components/headless-form-control-radio-test.gts index efc0e292..9e856a5a 100644 --- a/test-app/tests/integration/components/headless-form-control-radio-test.gts +++ b/test-app/tests/integration/components/headless-form-control-radio-test.gts @@ -1,7 +1,6 @@ /* eslint-disable no-undef -- Until https://github.com/ember-cli/eslint-plugin-ember/issues/1747 is resolved... */ -/* eslint-disable simple-import-sort/imports,padding-line-between-statements,decorator-position/decorator-position -- Can't fix these manually, without --fix working in .gts */ -import { render, click } from '@ember/test-helpers'; +import { click, render } from '@ember/test-helpers'; import { module, test } from 'qunit'; import { HeadlessForm } from 'ember-headless-form'; diff --git a/test-app/tests/integration/components/headless-form-control-select-test.gts b/test-app/tests/integration/components/headless-form-control-select-test.gts index ebe09a30..f9f13d5e 100644 --- a/test-app/tests/integration/components/headless-form-control-select-test.gts +++ b/test-app/tests/integration/components/headless-form-control-select-test.gts @@ -1,5 +1,4 @@ /* eslint-disable no-undef -- Until https://github.com/ember-cli/eslint-plugin-ember/issues/1747 is resolved... */ -/* eslint-disable simple-import-sort/imports,padding-line-between-statements,decorator-position/decorator-position -- Can't fix these manually, without --fix working in .gts */ import { render } from '@ember/test-helpers'; import { module, test } from 'qunit'; diff --git a/test-app/tests/integration/components/headless-form-control-textarea-test.gts b/test-app/tests/integration/components/headless-form-control-textarea-test.gts index 8b5f1c94..9d1baeaf 100644 --- a/test-app/tests/integration/components/headless-form-control-textarea-test.gts +++ b/test-app/tests/integration/components/headless-form-control-textarea-test.gts @@ -1,5 +1,4 @@ /* eslint-disable no-undef -- Until https://github.com/ember-cli/eslint-plugin-ember/issues/1747 is resolved... */ -/* eslint-disable simple-import-sort/imports,padding-line-between-statements,decorator-position/decorator-position -- Can't fix these manually, without --fix working in .gts */ import { render } from '@ember/test-helpers'; import { module, test } from 'qunit'; diff --git a/test-app/tests/integration/components/headless-form-custom-controls-test.gts b/test-app/tests/integration/components/headless-form-custom-controls-test.gts index f74d4567..68bd2c36 100644 --- a/test-app/tests/integration/components/headless-form-custom-controls-test.gts +++ b/test-app/tests/integration/components/headless-form-custom-controls-test.gts @@ -1,22 +1,22 @@ /* eslint-disable no-undef -- Until https://github.com/ember-cli/eslint-plugin-ember/issues/1747 is resolved... */ -/* eslint-disable simple-import-sort/imports,padding-line-between-statements,decorator-position/decorator-position -- Can't fix these manually, without --fix working in .gts */ +import Component from '@glimmer/component'; +import { on } from '@ember/modifier'; +import { action } from '@ember/object'; import { blur, - focus, - fillIn, click, + fillIn, + focus, render, triggerEvent, } from '@ember/test-helpers'; import { module, test } from 'qunit'; -import { on } from '@ember/modifier'; -import Component from '@glimmer/component'; -import { action } from '@ember/object'; import { HeadlessForm } from 'ember-headless-form'; import sinon from 'sinon'; import { setupRenderingTest } from 'test-app/tests/helpers'; + import type { RenderingTestContext } from '@ember/test-helpers'; module( diff --git a/test-app/tests/integration/components/headless-form-data-test.gts b/test-app/tests/integration/components/headless-form-data-test.gts index 97413cb0..3ffb4a6f 100644 --- a/test-app/tests/integration/components/headless-form-data-test.gts +++ b/test-app/tests/integration/components/headless-form-data-test.gts @@ -1,5 +1,4 @@ /* eslint-disable no-undef -- Until https://github.com/ember-cli/eslint-plugin-ember/issues/1747 is resolved... */ -/* eslint-disable simple-import-sort/imports,padding-line-between-statements,decorator-position/decorator-position -- Can't fix these manually, without --fix working in .gts */ import { tracked } from '@glimmer/tracking'; import { fn } from '@ember/helper'; @@ -116,10 +115,11 @@ module('Integration Component HeadlessForm > Data', function (hooks) { lastName: string; } class Context { - @tracked - data?: Data; + @tracked data?: Data; } + const ctx = new Context(); + ctx.data = { firstName: 'Tony', lastName: 'Ward' }; await render(