Skip to content
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

Merged
merged 2 commits into from
Oct 24, 2018

Conversation

lyhper
Copy link
Contributor

@lyhper lyhper commented Apr 9, 2018

What kind of change does this PR introduce? (check at least one)

  • Bugfix
  • Feature
  • Code style update
  • Refactor
  • Build-related changes
  • Other, please describe:

Does this PR introduce a breaking change? (check one)

  • Yes
  • No

If yes, please describe the impact and migration path for existing applications:

The PR fulfills these requirements:

If adding a new feature, the PR's description includes:

  • A convincing reason for adding this feature (to avoid wasting your time, it's best to open a suggestion issue first and wait for approval before working on it)

Other information:

) {
warn(
`${name}="${value}": ` +
'The v-bind expression should not be empty'
Copy link
Member

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

Copy link
Contributor Author

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()
Copy link
Member

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

@lyhper
Copy link
Contributor Author

lyhper commented Apr 10, 2018

@posva Is it ok?

@posva
Copy link
Member

posva commented Apr 10, 2018

yeah, we will just wait for a native to chime in to improve the warning message 🙂

@lyhper
Copy link
Contributor Author

lyhper commented Apr 10, 2018

thank you 😀

@sdras
Copy link
Member

sdras commented Apr 11, 2018

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' &&
Copy link

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.

@yyx990803 yyx990803 merged commit 1b69cbd into vuejs:dev Oct 24, 2018
f2009 pushed a commit to f2009/vue that referenced this pull request Jan 25, 2019
* refactor: add empty v-bind warnings

re vuejs#7973

* Update index.js
aJean pushed a commit to aJean/vue that referenced this pull request Aug 19, 2020
* refactor: add empty v-bind warnings

re vuejs#7973

* Update index.js
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

6 participants