From 7856ddc75bd067d2fbe8bfc6c003038ac086cd4e Mon Sep 17 00:00:00 2001 From: Chris Garrett Date: Tue, 22 Dec 2020 19:11:34 -0800 Subject: [PATCH 1/2] deprecate attrs in templates --- text/0000-deprecate-attrs-in-templates.md | 71 +++++++++++++++++++++++ 1 file changed, 71 insertions(+) create mode 100644 text/0000-deprecate-attrs-in-templates.md diff --git a/text/0000-deprecate-attrs-in-templates.md b/text/0000-deprecate-attrs-in-templates.md new file mode 100644 index 0000000000..2e9243b823 --- /dev/null +++ b/text/0000-deprecate-attrs-in-templates.md @@ -0,0 +1,71 @@ +--- +Stage: Accepted +Start Date: 2020-12-22 +Release Date: Unreleased +Release Versions: + ember-source: vX.Y.Z + ember-data: vX.Y.Z +Relevant Team(s): Ember.js +RFC PR: +--- + +# Deprecate using `{{attrs}}` in templates + +## Summary + +The `{{attrs}}` object in templates is an alternative way for users to reference +named arguments directly in a template. + +```hbs +{{attrs.foo}} + +{{! is equivalent to }} +{{@foo}} +``` + +It was a legacy API that existed prior to named arguments being introduced in +Ember, and has continued to be supported via a template transform for some time. +This RFC proposes that we deprecate this functionality in favor of directly +using named arguments. + +## Motivation + +The `{{attrs}}` syntax was from a previous iteration of the concepts that +eventually became named argument syntax. Now that named arguments exist in the +framework, and are considered the best practice, there is no reason to continue +supporting this syntax. + +## Transition Path + +Users who currently rely on referencing `{{attrs}}` can convert their references +to named arguments. This should be highly codemoddable, and we will attempt to +make a codemod to help out with the transition. + +## How We Teach This + +### Deprecation Guide + +The `{{attrs}}` object was an alternative way to reference named arguments in +templates that was introduced prior to named arguments syntax being finalized. +References to properties on `{{attrs}}` can be converted directly to named +argument syntax. + +Before: + +```hbs +{{attrs.foo}} +{{this.attrs.foo.bar}} +{{deeply (nested attrs.foobar.baz)}} +``` + +After: + +```hbs + {{@foo}} + {{@foo.bar}} + {{deeply (nested @foobar.baz)}} + ``` + +## Drawbacks + +- None From 1972114794febe6748f3fe80fc0e2aaa2cb5f4a6 Mon Sep 17 00:00:00 2001 From: Chris Garrett Date: Tue, 22 Dec 2020 19:15:26 -0800 Subject: [PATCH 2/2] update filename and add PR --- ...trs-in-templates.md => 0690-deprecate-attrs-in-templates.md} | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) rename text/{0000-deprecate-attrs-in-templates.md => 0690-deprecate-attrs-in-templates.md} (97%) diff --git a/text/0000-deprecate-attrs-in-templates.md b/text/0690-deprecate-attrs-in-templates.md similarity index 97% rename from text/0000-deprecate-attrs-in-templates.md rename to text/0690-deprecate-attrs-in-templates.md index 2e9243b823..2cce39267a 100644 --- a/text/0000-deprecate-attrs-in-templates.md +++ b/text/0690-deprecate-attrs-in-templates.md @@ -6,7 +6,7 @@ Release Versions: ember-source: vX.Y.Z ember-data: vX.Y.Z Relevant Team(s): Ember.js -RFC PR: +RFC PR: https://github.com/emberjs/rfcs/pull/690 --- # Deprecate using `{{attrs}}` in templates