From e24f169cb681cd1cf70fb8f1b3d349dea5b06863 Mon Sep 17 00:00:00 2001 From: Chris Manson Date: Wed, 26 Apr 2023 21:35:50 +0100 Subject: [PATCH] Release 3.2.0 --- CHANGELOG.md | 18 + README.md | 1 + package.json | 2 +- transforms/ember-object/README.md | 584 +++++++++++++++++++++++------- 4 files changed, 474 insertions(+), 131 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 0cde51a..b171b9c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,24 @@ # Changelog + +## v3.2.0 (2023-04-26) + +#### :rocket: Enhancement +* [#525](https://github.com/ember-codemods/ember-native-class-codemod/pull/525) Utilize jscodeshift CLI results output ([@gitKrystan](https://github.com/gitKrystan)) + +#### :bug: Bug Fix +* [#524](https://github.com/ember-codemods/ember-native-class-codemod/pull/524) Retain async / generator behavior on class methods (Closes [#521](https://github.com/ember-codemods/ember-native-class-codemod/issues/521)) ([@gitKrystan](https://github.com/gitKrystan)) + +#### :memo: Documentation +* [#531](https://github.com/ember-codemods/ember-native-class-codemod/pull/531) Fix typos in readme ([@gitKrystan](https://github.com/gitKrystan)) + +#### :house: Internal +* [#529](https://github.com/ember-codemods/ember-native-class-codemod/pull/529) Upgrade Dependencies + Fix CI ([@gitKrystan](https://github.com/gitKrystan)) + +#### Committers: 1 +- Krystan HuffMenne ([@gitKrystan](https://github.com/gitKrystan)) + ## v3.1.0 (2023-03-10) #### :rocket: Enhancement diff --git a/README.md b/README.md index 3eeaf08..45cfd4b 100644 --- a/README.md +++ b/README.md @@ -93,6 +93,7 @@ transformation of * [ember-object](transforms/ember-object/README.md) +* [helpers](transforms/helpers/README.md) ## Contributing diff --git a/package.json b/package.json index e8b618b..3049882 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "ember-native-class-codemod", - "version": "3.1.0", + "version": "3.2.0", "description": "Codemods for transforming ember app code to native class syntax with decorators.", "keywords": [ "codemod-cli" diff --git a/transforms/ember-object/README.md b/transforms/ember-object/README.md index 0589a86..061c073 100644 --- a/transforms/ember-object/README.md +++ b/transforms/ember-object/README.md @@ -14,34 +14,51 @@ ember-native-class-codemod ember-object path/of/files/ or/some**/*glob.js ## Input / Output -* [action-invalid](#action-invalid) +* [action-invalid-1](#action-invalid-1) +* [action-invalid-2](#action-invalid-2) +* [action-invalid-3](#action-invalid-3) +* [action-invalid-4](#action-invalid-4) +* [action-invalid-5](#action-invalid-5) +* [async-function-property](#async-function-property) +* [async-method](#async-method) * [basic-computed](#basic-computed) * [basic](#basic) * [chained-class-definition](#chained-class-definition) * [class-fields](#class-fields) * [class-reopen](#class-reopen) -* [decorators-invalid](#decorators-invalid) +* [decorators-invalid-1](#decorators-invalid-1) +* [decorators-invalid-2](#decorators-invalid-2) +* [decorators-invalid-3](#decorators-invalid-3) +* [decorators-invalid-4](#decorators-invalid-4) +* [decorators-invalid-5](#decorators-invalid-5) +* [decorators-invalid-6](#decorators-invalid-6) +* [decorators-invalid-7](#decorators-invalid-7) +* [decorators-invalid-8](#decorators-invalid-8) * [decorators](#decorators) * [default-export](#default-export) * [double-quotes](#double-quotes) * [ember-concurrency](#ember-concurrency) * [frozen](#frozen) +* [generator-method](#generator-method) +* [generator-property](#generator-property) * [import](#import) * [injecting-service](#injecting-service) * [logical-expression](#logical-expression) * [mixin](#mixin) * [object-literal-with-action-hash-and-decorator](#object-literal-with-action-hash-and-decorator) -* [object-literal-with-decorators-invalid](#object-literal-with-decorators-invalid) +* [object-literal-with-decorators-invalid-1](#object-literal-with-decorators-invalid-1) +* [object-literal-with-decorators-invalid-2](#object-literal-with-decorators-invalid-2) +* [object-literal-with-decorators-invalid-3](#object-literal-with-decorators-invalid-3) +* [object-literal-with-decorators-invalid-4](#object-literal-with-decorators-invalid-4) * [object-literal-with-decorators](#object-literal-with-decorators) -* [partial-transform](#partial-transform) * [runtime](#runtime) ## --- -**action-invalid** +**action-invalid-1** -**Input** ([action-invalid.input.js](transforms/ember-object/__testfixtures__/action-invalid.input.js)): +**Input** ([action-invalid-1.input.js](transforms/ember-object/__testfixtures__/action-invalid-1.input.js)): ```js const Foo1 = EmberObject.extend({ actions: { @@ -51,83 +68,151 @@ const Foo1 = EmberObject.extend({ }, }, }); +``` -const Foo2 = EmberObject.extend({ +**Output** ([action-invalid-1.output.js](transforms/ember-object/__testfixtures__/action-invalid-1.output.js)): +```js +/* +Expect error: + ValidationError: Validation errors for class 'Foo1': + [actions]: Transform not supported - [bar]: calling the passed action would cause an infinite loop. See https://github.com/scalvert/eslint-plugin-ember-es6-class/pull/2 for more details +*/ + +const Foo1 = EmberObject.extend({ actions: { - biz() { + bar() { this._super(...arguments); - get(this, 'biz')(); + this.get('bar')(); }, }, }); -const Foo3 = EmberObject.extend({ +``` +--- +**action-invalid-2** + +**Input** ([action-invalid-2.input.js](transforms/ember-object/__testfixtures__/action-invalid-2.input.js)): +```js +const Foo2 = EmberObject.extend({ actions: { - baz() { + biz() { this._super(...arguments); - tryInvoke(this, 'baz'); + get(this, 'biz')(); }, }, }); -const Foo4 = EmberObject.extend({ +``` + +**Output** ([action-invalid-2.output.js](transforms/ember-object/__testfixtures__/action-invalid-2.output.js)): +```js +/* +Expect error: + ValidationError: Validation errors for class 'Foo2': + [actions]: Transform not supported - [biz]: calling the passed action would cause an infinite loop. See https://github.com/scalvert/eslint-plugin-ember-es6-class/pull/2 for more details +*/ + +const Foo2 = EmberObject.extend({ actions: { - sendBaz() { + biz() { this._super(...arguments); - this.send('sendBaz'); + get(this, 'biz')(); }, }, }); -const Foo5 = EmberObject.extend({ +``` +--- +**action-invalid-3** + +**Input** ([action-invalid-3.input.js](transforms/ember-object/__testfixtures__/action-invalid-3.input.js)): +```js +const Foo3 = EmberObject.extend({ actions: { - thisBaz() { + baz() { this._super(...arguments); - this.thisBaz(); + tryInvoke(this, 'baz'); }, }, }); ``` -**Output** ([action-invalid.output.js](transforms/ember-object/__testfixtures__/action-invalid.output.js)): +**Output** ([action-invalid-3.output.js](transforms/ember-object/__testfixtures__/action-invalid-3.output.js)): ```js -const Foo1 = EmberObject.extend({ +/* +Expect error: + ValidationError: Validation errors for class 'Foo3': + [actions]: Transform not supported - [baz]: calling the passed action would cause an infinite loop. See https://github.com/scalvert/eslint-plugin-ember-es6-class/pull/2 for more details +*/ + +const Foo3 = EmberObject.extend({ actions: { - bar() { + baz() { this._super(...arguments); - this.get('bar')(); + tryInvoke(this, 'baz'); }, }, }); -const Foo2 = EmberObject.extend({ +``` +--- +**action-invalid-4** + +**Input** ([action-invalid-4.input.js](transforms/ember-object/__testfixtures__/action-invalid-4.input.js)): +```js +const Foo4 = EmberObject.extend({ actions: { - biz() { + sendBaz() { this._super(...arguments); - get(this, 'biz')(); + this.send('sendBaz'); }, }, }); +``` -const Foo3 = EmberObject.extend({ +**Output** ([action-invalid-4.output.js](transforms/ember-object/__testfixtures__/action-invalid-4.output.js)): +```js +/* +Expect error: + ValidationError: Validation errors for class 'Foo4': + [actions]: Transform not supported - [sendBaz]: calling the passed action would cause an infinite loop. See https://github.com/scalvert/eslint-plugin-ember-es6-class/pull/2 for more details +*/ + +const Foo4 = EmberObject.extend({ actions: { - baz() { + sendBaz() { this._super(...arguments); - tryInvoke(this, 'baz'); + this.send('sendBaz'); }, }, }); -const Foo4 = EmberObject.extend({ +``` +--- +**action-invalid-5** + +**Input** ([action-invalid-5.input.js](transforms/ember-object/__testfixtures__/action-invalid-5.input.js)): +```js +const Foo5 = EmberObject.extend({ actions: { - sendBaz() { + thisBaz() { this._super(...arguments); - this.send('sendBaz'); + this.thisBaz(); }, }, }); +``` + +**Output** ([action-invalid-5.output.js](transforms/ember-object/__testfixtures__/action-invalid-5.output.js)): +```js +/* +Expect error: + ValidationError: Validation errors for class 'Foo5': + [actions]: Transform not supported - [thisBaz]: calling the passed action would cause an infinite loop. See https://github.com/scalvert/eslint-plugin-ember-es6-class/pull/2 for more details +*/ + const Foo5 = EmberObject.extend({ actions: { thisBaz() { @@ -137,6 +222,56 @@ const Foo5 = EmberObject.extend({ }, }); +``` +--- +**async-function-property** + +**Input** ([async-function-property.input.js](transforms/ember-object/__testfixtures__/async-function-property.input.js)): +```js +const Foo = Test.extend({ + myAsyncMethod: async function() { + await Promise.resolve('hello'); + } +}); + +``` + +**Output** ([async-function-property.output.js](transforms/ember-object/__testfixtures__/async-function-property.output.js)): +```js +import classic from 'ember-classic-decorator'; + +@classic +class Foo extends Test { + async myAsyncMethod() { + await Promise.resolve('hello'); + } +} + +``` +--- +**async-method** + +**Input** ([async-method.input.js](transforms/ember-object/__testfixtures__/async-method.input.js)): +```js +const Foo = Test.extend({ + async myAsyncMethod() { + await Promise.resolve('hello'); + } +}); + +``` + +**Output** ([async-method.output.js](transforms/ember-object/__testfixtures__/async-method.output.js)): +```js +import classic from 'ember-classic-decorator'; + +@classic +class Foo extends Test { + async myAsyncMethod() { + await Promise.resolve('hello'); + } +} + ``` --- **basic-computed** @@ -276,6 +411,12 @@ export default EmberObject.extend({}).reopenClass({}); **Output** ([chained-class-definition.output.js](transforms/ember-object/__testfixtures__/chained-class-definition.output.js)): ```js +/* +Expect error: + ValidationError: Validation errors for class 'ChainedClassDefinition': + class has chained definition (e.g. EmberObject.extend().reopenClass(); +*/ + import EmberObject from '@ember/object'; export default EmberObject.extend({}).reopenClass({}); @@ -375,19 +516,61 @@ export default Foo; ``` --- -**decorators-invalid** +**decorators-invalid-1** + +**Input** ([decorators-invalid-1.input.js](transforms/ember-object/__testfixtures__/decorators-invalid-1.input.js)): +```js +// Do not transform +const Foo1 = EmberObject.extend({ + statefulObject: {}, +}); + +``` -**Input** ([decorators-invalid.input.js](transforms/ember-object/__testfixtures__/decorators-invalid.input.js)): +**Output** ([decorators-invalid-1.output.js](transforms/ember-object/__testfixtures__/decorators-invalid-1.output.js)): ```js +/* +Expect error: + ValidationError: Validation errors for class 'Foo1': + [statefulObject]: Transform not supported - value is of type object. For more details: eslint-plugin-ember/avoid-leaking-state-in-ember-objects +*/ + // Do not transform const Foo1 = EmberObject.extend({ statefulObject: {}, }); +``` +--- +**decorators-invalid-2** + +**Input** ([decorators-invalid-2.input.js](transforms/ember-object/__testfixtures__/decorators-invalid-2.input.js)): +```js // Do not transform if not a primitive value const Foo2 = EmberObject.extend({ macroValue: macro(), }); +``` + +**Output** ([decorators-invalid-2.output.js](transforms/ember-object/__testfixtures__/decorators-invalid-2.output.js)): +```js +/* +Expect error: + ValidationError: Validation errors for class 'Foo2': + [macroValue]: Transform not supported - call to 'macro' can not be transformed +*/ + +// Do not transform if not a primitive value +const Foo2 = EmberObject.extend({ + macroValue: macro(), +}); +``` +--- +**decorators-invalid-3** + +**Input** ([decorators-invalid-3.input.js](transforms/ember-object/__testfixtures__/decorators-invalid-3.input.js)): +```js +import { computed } from '@ember/object'; // Do not transform as a computed property has readOnly and volatile with meta const Foo3 = EmberObject.extend({ @@ -403,50 +586,17 @@ const Foo3 = EmberObject.extend({ .meta({ type: 'Property' }), }); -// Do not transform as a computed meta has volatile -const Foo4 = EmberObject.extend({ - lName1: add('description', 'lastName').volatile(), -}); - -// Do not transform as computed prop has `property` -const Foo5 = EmberObject.extend({ - fName2: computed('firstName', 'lastName', function() { - return true; - }).property('baz'), -}); - -// Do not transform as computed prop has `meta` -const Foo6 = EmberObject.extend({ - fName2: computed('firstName', 'lastName', function() { - return true; - }).meta({ type: 'Property' }), -}); - -// Do not transform as action name matches lifecycle hook -const Foo7 = EmberObject.extend({ - actions: { - click() { - this.set('clicked', true); - }, - }, -}); - -const Foo8 = EmberObject.extend({ - statefulArray: [], -}); ``` -**Output** ([decorators-invalid.output.js](transforms/ember-object/__testfixtures__/decorators-invalid.output.js)): +**Output** ([decorators-invalid-3.output.js](transforms/ember-object/__testfixtures__/decorators-invalid-3.output.js)): ```js -// Do not transform -const Foo1 = EmberObject.extend({ - statefulObject: {}, -}); +/* +Expect error: + ValidationError: Validation errors for class 'Foo3': + [fName2]: Transform not supported - value has modifiers like 'property' or 'meta' +*/ -// Do not transform if not a primitive value -const Foo2 = EmberObject.extend({ - macroValue: macro(), -}); +import { computed } from '@ember/object'; // Do not transform as a computed property has readOnly and volatile with meta const Foo3 = EmberObject.extend({ @@ -462,10 +612,56 @@ const Foo3 = EmberObject.extend({ .meta({ type: 'Property' }), }); +``` +--- +**decorators-invalid-4** + +**Input** ([decorators-invalid-4.input.js](transforms/ember-object/__testfixtures__/decorators-invalid-4.input.js)): +```js +// Do not transform as a computed meta has volatile +const Foo4 = EmberObject.extend({ + lName1: add('description', 'lastName').volatile(), +}); + +``` + +**Output** ([decorators-invalid-4.output.js](transforms/ember-object/__testfixtures__/decorators-invalid-4.output.js)): +```js +/* +Expect error: + ValidationError: Validation errors for class 'Foo4': + [lName1]: Transform not supported - call to 'add' can not be transformed +*/ + // Do not transform as a computed meta has volatile const Foo4 = EmberObject.extend({ lName1: add('description', 'lastName').volatile(), }); +``` +--- +**decorators-invalid-5** + +**Input** ([decorators-invalid-5.input.js](transforms/ember-object/__testfixtures__/decorators-invalid-5.input.js)): +```js +import { computed } from '@ember/object'; + +// Do not transform as computed prop has `property` +const Foo5 = EmberObject.extend({ + fName2: computed('firstName', 'lastName', function() { + return true; + }).property('baz'), +}); +``` + +**Output** ([decorators-invalid-5.output.js](transforms/ember-object/__testfixtures__/decorators-invalid-5.output.js)): +```js +/* +Expect error: + ValidationError: Validation errors for class 'Foo5': + [fName2]: Transform not supported - value has modifiers like 'property' or 'meta' +*/ + +import { computed } from '@ember/object'; // Do not transform as computed prop has `property` const Foo5 = EmberObject.extend({ @@ -473,6 +669,13 @@ const Foo5 = EmberObject.extend({ return true; }).property('baz'), }); +``` +--- +**decorators-invalid-6** + +**Input** ([decorators-invalid-6.input.js](transforms/ember-object/__testfixtures__/decorators-invalid-6.input.js)): +```js +import { computed } from '@ember/object'; // Do not transform as computed prop has `meta` const Foo6 = EmberObject.extend({ @@ -480,7 +683,30 @@ const Foo6 = EmberObject.extend({ return true; }).meta({ type: 'Property' }), }); +``` +**Output** ([decorators-invalid-6.output.js](transforms/ember-object/__testfixtures__/decorators-invalid-6.output.js)): +```js +/* +Expect error: + ValidationError: Validation errors for class 'Foo6': + [fName2]: Transform not supported - value has modifiers like 'property' or 'meta' +*/ + +import { computed } from '@ember/object'; + +// Do not transform as computed prop has `meta` +const Foo6 = EmberObject.extend({ + fName2: computed('firstName', 'lastName', function() { + return true; + }).meta({ type: 'Property' }), +}); +``` +--- +**decorators-invalid-7** + +**Input** ([decorators-invalid-7.input.js](transforms/ember-object/__testfixtures__/decorators-invalid-7.input.js)): +```js // Do not transform as action name matches lifecycle hook const Foo7 = EmberObject.extend({ actions: { @@ -489,6 +715,43 @@ const Foo7 = EmberObject.extend({ }, }, }); +``` + +**Output** ([decorators-invalid-7.output.js](transforms/ember-object/__testfixtures__/decorators-invalid-7.output.js)): +```js +/* +Expect error: + ValidationError: Validation errors for class 'Foo7': + [actions]: Transform not supported - [click]: action name matches one of the lifecycle hooks. Rename and try again. See https://github.com/scalvert/ember-native-class-codemod/issues/34 for more details +*/ + +// Do not transform as action name matches lifecycle hook +const Foo7 = EmberObject.extend({ + actions: { + click() { + this.set('clicked', true); + }, + }, +}); + +``` +--- +**decorators-invalid-8** + +**Input** ([decorators-invalid-8.input.js](transforms/ember-object/__testfixtures__/decorators-invalid-8.input.js)): +```js +const Foo8 = EmberObject.extend({ + statefulArray: [], +}); +``` + +**Output** ([decorators-invalid-8.output.js](transforms/ember-object/__testfixtures__/decorators-invalid-8.output.js)): +```js +/* +Expect error: + ValidationError: Validation errors for class 'Foo8': + [statefulArray]: Transform not supported - value is of type object. For more details: eslint-plugin-ember/avoid-leaking-state-in-ember-objects +*/ const Foo8 = EmberObject.extend({ statefulArray: [], @@ -1048,6 +1311,56 @@ class Foo extends Test { frozen = Object.freeze(['name']); } +``` +--- +**generator-method** + +**Input** ([generator-method.input.js](transforms/ember-object/__testfixtures__/generator-method.input.js)): +```js +const Foo = Test.extend({ + *gen() { + yield 'hello'; + } +}); + +``` + +**Output** ([generator-method.output.js](transforms/ember-object/__testfixtures__/generator-method.output.js)): +```js +import classic from 'ember-classic-decorator'; + +@classic +class Foo extends Test { + *gen() { + yield 'hello'; + } +} + +``` +--- +**generator-property** + +**Input** ([generator-property.input.js](transforms/ember-object/__testfixtures__/generator-property.input.js)): +```js +const Foo = Test.extend({ + gen: function*() { + yield 'hello'; + } +}); + +``` + +**Output** ([generator-property.output.js](transforms/ember-object/__testfixtures__/generator-property.output.js)): +```js +import classic from 'ember-classic-decorator'; + +@classic +class Foo extends Test { + *gen() { + yield 'hello'; + } +} + ``` --- **import** @@ -1209,50 +1522,100 @@ class Foo extends EmberObject { ``` --- -**object-literal-with-decorators-invalid** +**object-literal-with-decorators-invalid-1** + +**Input** ([object-literal-with-decorators-invalid-1.input.js](transforms/ember-object/__testfixtures__/object-literal-with-decorators-invalid-1.input.js)): +```js +// Do not transform if not a primitive value +const Foo1 = EmberObject.extend({ + @tracked computedMacro: customMacro(), +}); +``` -**Input** ([object-literal-with-decorators-invalid.input.js](transforms/ember-object/__testfixtures__/object-literal-with-decorators-invalid.input.js)): +**Output** ([object-literal-with-decorators-invalid-1.output.js](transforms/ember-object/__testfixtures__/object-literal-with-decorators-invalid-1.output.js)): ```js +/* +Expect error: + ValidationError: Validation errors for class 'Foo1': + [computedMacro]: Transform not supported - can only transform object literal decorators on methods or properties with literal values (string, number, boolean, null, undefined) + [computedMacro]: Transform not supported - call to 'customMacro' can not be transformed +*/ + // Do not transform if not a primitive value const Foo1 = EmberObject.extend({ @tracked computedMacro: customMacro(), }); +``` +--- +**object-literal-with-decorators-invalid-2** +**Input** ([object-literal-with-decorators-invalid-2.input.js](transforms/ember-object/__testfixtures__/object-literal-with-decorators-invalid-2.input.js)): +```js // Do not transform if not on allowlist const Foo2 = EmberObject.extend({ @banned prop: '', }); +``` -// Do not transform array -const Foo3 = EmberObject.extend({ - @tracked arr: [1, 2, 3], -}); +**Output** ([object-literal-with-decorators-invalid-2.output.js](transforms/ember-object/__testfixtures__/object-literal-with-decorators-invalid-2.output.js)): +```js +/* +Expect error: + ValidationError: Validation errors for class 'Foo2': + [prop]: Transform not supported - decorator '@banned' not included in ALLOWED_OBJECT_LITERAL_DECORATORS or option '--objectLiteralDecorators' +*/ -// Do not function expression if not on allowlist -const Foo4 = EmberObject.extend({ - @userAdded methodish: () => {}, +// Do not transform if not on allowlist +const Foo2 = EmberObject.extend({ + @banned prop: '', }); ``` +--- +**object-literal-with-decorators-invalid-3** -**Output** ([object-literal-with-decorators-invalid.output.js](transforms/ember-object/__testfixtures__/object-literal-with-decorators-invalid.output.js)): +**Input** ([object-literal-with-decorators-invalid-3.input.js](transforms/ember-object/__testfixtures__/object-literal-with-decorators-invalid-3.input.js)): ```js -// Do not transform if not a primitive value -const Foo1 = EmberObject.extend({ - @tracked computedMacro: customMacro(), +// Do not transform array +const Foo3 = EmberObject.extend({ + @tracked arr: [1, 2, 3], }); +``` -// Do not transform if not on allowlist -const Foo2 = EmberObject.extend({ - @banned prop: '', -}); +**Output** ([object-literal-with-decorators-invalid-3.output.js](transforms/ember-object/__testfixtures__/object-literal-with-decorators-invalid-3.output.js)): +```js +/* +Expect error: + ValidationError: Validation errors for class 'Foo3': + [arr]: Transform not supported - value is of type object. For more details: eslint-plugin-ember/avoid-leaking-state-in-ember-objects +*/ // Do not transform array const Foo3 = EmberObject.extend({ @tracked arr: [1, 2, 3], }); +``` +--- +**object-literal-with-decorators-invalid-4** -// Do not function expression if not on allowlist +**Input** ([object-literal-with-decorators-invalid-4.input.js](transforms/ember-object/__testfixtures__/object-literal-with-decorators-invalid-4.input.js)): +```js +// Do not transform function expression if not on allowlist +const Foo4 = EmberObject.extend({ + @userAdded methodish: () => {}, +}); + +``` + +**Output** ([object-literal-with-decorators-invalid-4.output.js](transforms/ember-object/__testfixtures__/object-literal-with-decorators-invalid-4.output.js)): +```js +/* +Expect error: + ValidationError: Validation errors for class 'Foo4': + [methodish]: Transform not supported - decorator '@userAdded' not included in ALLOWED_OBJECT_LITERAL_DECORATORS or option '--objectLiteralDecorators' +*/ + +// Do not transform function expression if not on allowlist const Foo4 = EmberObject.extend({ @userAdded methodish: () => {}, }); @@ -1538,45 +1901,6 @@ class Foo extends EmberObject { } } -``` ---- -**partial-transform** - -**Input** ([partial-transform.input.js](transforms/ember-object/__testfixtures__/partial-transform.input.js)): -```js -import EmberObject from '@ember/object'; -import { inject as service } from '@ember/service'; - -// Should succeed -const Foo1 = EmberObject.extend({ - store: service('store'), -}); - -// Should fail -const Foo2 = EmberObject.extend({ - macroValue: macro(), -}) - -``` - -**Output** ([partial-transform.output.js](transforms/ember-object/__testfixtures__/partial-transform.output.js)): -```js -import classic from 'ember-classic-decorator'; -import { inject as service } from '@ember/service'; -import EmberObject from '@ember/object'; - -// Should succeed -@classic -class Foo1 extends EmberObject { - @service('store') - store; -} - -// Should fail -const Foo2 = EmberObject.extend({ - macroValue: macro(), -}) - ``` --- **runtime**