-
Notifications
You must be signed in to change notification settings - Fork 24.8k
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
fix(compiler): report errors for missing binding names #34595
Conversation
@@ -21,7 +21,7 @@ import * as t from './r3_ast'; | |||
import {I18N_ICU_VAR_PREFIX, isI18nRootNode} from './view/i18n/util'; | |||
|
|||
const BIND_NAME_REGEXP = | |||
/^(?:(?:(?:(bind-)|(let-)|(ref-|#)|(on-)|(bindon-)|(@))(.+))|\[\(([^\)]+)\)\]|\[([^\]]+)\]|\(([^\)]+)\))$/; | |||
/^(?:(?:(?:(bind-)|(let-)|(ref-|#)|(on-)|(bindon-)|(@))(.*))|\[\(([^\)]+)\)\]|\[([^\]]+)\]|\(([^\)]+)\))$/; |
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.
😱
f96e07e
to
1c3a0a4
Compare
merge-assistance: plz presubmit |
@ayazhafiz Can you rebase on master? (Circle CI config has changed) |
Currently, would-be binding attributes that are missing binding names are not parsed as bindings, and fall through as regular attributes. In some cases, this can lead to a runtime error; trying to assign `#` as a DOM attribute in an element like in `<div #></div>` fails because `#` is not a valid attribute name. Attributes composed of binding prefixes but not defining a binding should be considered invalid, as this almost certainly indicates an unintentional elision of a binding by the developer. This commit introduces error reporting for attributes with a binding name prefix but no actual binding name. Closes angular/vscode-ng-language-service#293.
1c3a0a4
to
2a7a297
Compare
Currently, would-be binding attributes that are missing binding names are not parsed as bindings, and fall through as regular attributes. In some cases, this can lead to a runtime error; trying to assign `#` as a DOM attribute in an element like in `<div #></div>` fails because `#` is not a valid attribute name. Attributes composed of binding prefixes but not defining a binding should be considered invalid, as this almost certainly indicates an unintentional elision of a binding by the developer. This commit introduces error reporting for attributes with a binding name prefix but no actual binding name. Closes angular/vscode-ng-language-service#293. PR Close #34595
Currently, would-be binding attributes that are missing binding names are not parsed as bindings, and fall through as regular attributes. In some cases, this can lead to a runtime error; trying to assign `#` as a DOM attribute in an element like in `<div #></div>` fails because `#` is not a valid attribute name. Attributes composed of binding prefixes but not defining a binding should be considered invalid, as this almost certainly indicates an unintentional elision of a binding by the developer. This commit introduces error reporting for attributes with a binding name prefix but no actual binding name. Closes angular/vscode-ng-language-service#293. PR Close angular#34595
Currently, would-be binding attributes that are missing binding names are not parsed as bindings, and fall through as regular attributes. In some cases, this can lead to a runtime error; trying to assign `#` as a DOM attribute in an element like in `<div #></div>` fails because `#` is not a valid attribute name. Attributes composed of binding prefixes but not defining a binding should be considered invalid, as this almost certainly indicates an unintentional elision of a binding by the developer. This commit introduces error reporting for attributes with a binding name prefix but no actual binding name. Closes angular/vscode-ng-language-service#293. PR Close angular#34595
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. |
Currently, would-be binding attributes that are missing binding names
are not parsed as bindings, and fall through as regular attributes. In
some cases, this can lead to a runtime error; trying to assign
#
as aDOM attribute in an element like in
<div #></div>
fails because#
isnot a valid attribute name.
Attributes composed of binding prefixes but not defining a binding
should be considered invalid, as this almost certainly indicates an
unintentional elision of a binding by the developer. This commit
introduces error reporting for attributes with a binding name prefix but
no actual binding name.
Closes angular/vscode-ng-language-service#293.
PR Checklist
Please check if your PR fulfills the following requirements:
PR Type
What kind of change does this PR introduce?
Does this PR introduce a breaking change?