New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Clarify pipe naming requirement #31806
Conversation
You can preview 49553ee at https://pr31806-49553ee.ngbuilds.io/. |
The doc related changes look good, but as @Airblader mentioned we should throw a proper exception from the framework. |
* The pipe name to use in template bindings. Must be in | ||
* [lowerCamelCase](guide/glossary#case-types), and by convention | ||
* should match the class name. For example, the class `MyPipe` | ||
* should use the name `myPipe`. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I disagree that something like a suffix "must" be kept. A NumberPipe would likely just have a name "number".
I also don't see why the name must match the class name in any way at all. There's no technical requirement for that.
The styleguide can be opionated, but IMHO here we should stick to facts.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I agree - that's why the wording is "MUST be in lowerCamelCase" and "by convention SHOULD match class name". A one-word name that starts with lower case ("number") satisfies the requirement and does not throw an error.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
But "must be in lowerCamelCase" is simply not true. "Cannot contain hyphens" is not the same as lowerCamelCase. I can also use rAndOmcASe if I want.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That also passes the lowerCamelCase definition - starts with a lower case, followed by mixed case. Using uppercase for word-separation is a convention. However, I will add "cannot contain hyphens" - that is more specific, thanks.
This PR is to satisfy the doc issue. There should be a separate issue for changing the code to throw a better exception. |
I can also use UpperCamelCase as a name. Again, there's no technical constraint for that. |
92325a2
to
a4a72cf
Compare
You can preview 92325a2 at https://pr31806-92325a2.ngbuilds.io/. |
You can preview a4a72cf at https://pr31806-a4a72cf.ngbuilds.io/. |
663235a
to
4cb698a
Compare
You can preview 663235a at https://pr31806-663235a.ngbuilds.io/. |
You can preview fb16673 at https://pr31806-fb16673.ngbuilds.io/. |
You can preview 4cb698a at https://pr31806-4cb698a.ngbuilds.io/. |
ffee22a
to
06c60a9
Compare
You can preview 06c60a9 at https://pr31806-06c60a9.ngbuilds.io/. |
You can preview ffee22a at https://pr31806-ffee22a.ngbuilds.io/. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
merge-assistance: global approval |
This issue has been automatically locked due to inactivity. Read more about our automatic conversation locking policy. This action has been performed automatically by a bot. |
PR Checklist
Please check if your PR fulfills the following requirements:
PR Type
What kind of change does this PR introduce?
What is the current behavior?
The naming requirement for pipes is only mentioned as a recommended naming convention in the style guide.
Issue Number: #31787
What is the new behavior?
Clarify requirement in style guide and add to the API doc for
@Pipe
decorator.Does this PR introduce a breaking change?
Other information