-
-
Notifications
You must be signed in to change notification settings - Fork 33.7k
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
refactor: add empty v-bind warning(re #7973) #7988
Conversation
src/compiler/parser/index.js
Outdated
) { | ||
warn( | ||
`${name}="${value}": ` + | ||
'The v-bind expression should not be empty' |
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 think we can improve the message to something like the value for a v-bind expression cannot be empty. Found in '${name}'.
Let's wait for others feedback as I am not native
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.
thanks, I will do it later
@@ -508,6 +508,7 @@ describe('parser', () => { | |||
expect(ast.attrs[1].value).toBe('"field1"') | |||
expect(ast.props[0].name).toBe('value') | |||
expect(ast.props[0].value).toBe('msg') | |||
expect('The v-bind expression should not be empty').toHaveBeenWarned() |
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.
Let's extract this into one single test
2cc2965
to
dd4f92a
Compare
dd4f92a
to
45a4744
Compare
@posva Is it ok? |
yeah, we will just wait for a native to chime in to improve the warning message 🙂 |
thank you 😀 |
The warning message sounds good to me as a native speaker 👍 |
@@ -528,6 +528,14 @@ function processAttrs (el) { | |||
name = name.replace(bindRE, '') | |||
value = parseFilters(value) | |||
isProp = false | |||
if ( | |||
process.env.NODE_ENV !== 'production' && |
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 think we should check all environments instead of just production.
* refactor: add empty v-bind warnings re vuejs#7973 * Update index.js
* refactor: add empty v-bind warnings re vuejs#7973 * Update index.js
What kind of change does this PR introduce? (check at least one)
Does this PR introduce a breaking change? (check one)
If yes, please describe the impact and migration path for existing applications:
The PR fulfills these requirements:
dev
branch for v2.x (or to a previous version branch), not themaster
branchfix #xxx[,#xxx]
, where "xxx" is the issue number)If adding a new feature, the PR's description includes:
Other information: