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

feat(warn): Warn on colon shorthand usage on directive (fix #10191) #10199

Open
wants to merge 4 commits into
base: dev
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
feat: Improve message context
  • Loading branch information
afontcu committed Jun 26, 2019
commit f695a6d70532a9fcde1b380b6c4e2678d3a95884
2 changes: 1 addition & 1 deletion src/compiler/parser/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -765,7 +765,7 @@ function processAttrs (el) {
// :v-if or similar
if (process.env.NODE_ENV !== 'production' && colonDirRE.test(name)) {
warn(
`A v-bind shorthand was used on another Vue directive. Did you mean '${name.substr(1)}="${value}"' instead of '${name}'?`
`A v-bind shorthand was used on another Vue directive. Did you mean '${name.substr(1)}="${value}"' instead of '${name}="${value}"'?`
)
}
if (dirRE.test(name)) {
Expand Down
2 changes: 1 addition & 1 deletion test/unit/modules/compiler/parser.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -532,7 +532,7 @@ describe('parser', () => {

it('warns when using v-bind shorthand on a directive', () => {
parse('<div :v-if="foo"></div>', baseOptions)
expect(`A v-bind shorthand was used on another Vue directive. Did you mean 'v-if="foo"' instead of ':v-if'?`).toHaveBeenWarned()
expect(`A v-bind shorthand was used on another Vue directive. Did you mean 'v-if="foo"' instead of ':v-if="foo"'?`).toHaveBeenWarned()
})

it('empty v-bind expression', () => {
Expand Down