|
| 1 | +--- |
| 2 | +source: crates/biome_html_analyze/tests/spec_tests.rs |
| 3 | +expression: invalid.vue |
| 4 | +--- |
| 5 | +# Input |
| 6 | +```html |
| 7 | +<!-- should generate diagnostics --> |
| 8 | +
|
| 9 | +<template> |
| 10 | + <!-- Missing argument: long-form without an argument --> |
| 11 | + <div v-bind></div> |
| 12 | +
|
| 13 | + <!-- Missing argument with modifier --> |
| 14 | + <div v-bind.prop></div> |
| 15 | +
|
| 16 | + <!-- Invalid single modifier on long-form --> |
| 17 | + <div v-bind:foo.invalid="bar"></div> |
| 18 | +
|
| 19 | + <!-- Invalid modifier on shorthand --> |
| 20 | + <span :bar.badModifier="baz"></span> |
| 21 | +
|
| 22 | + <!-- Mixed valid and invalid modifiers: 'prop' is valid, 'wrong' is not --> |
| 23 | + <p :baz.prop.wrong="value"></p> |
| 24 | +
|
| 25 | + <!-- Dynamic argument is present but modifier is invalid --> |
| 26 | + <p v-bind:[dynamic].notAValidModifier="value"></p> |
| 27 | +
|
| 28 | + <!-- Multiple invalid modifiers --> |
| 29 | + <button :disabled.once="true"></button> |
| 30 | +
|
| 31 | + <!-- Component binding with unknown modifier --> |
| 32 | + <MyComponent v-bind:propName.weird="someValue"></MyComponent> |
| 33 | +</template> |
| 34 | +
|
| 35 | +``` |
| 36 | +
|
| 37 | +# Diagnostics |
| 38 | +``` |
| 39 | +invalid.vue:5:8 lint/nursery/noVueInvalidVBind ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ |
| 40 | +
|
| 41 | + i The v-bind directive is missing an argument. |
| 42 | + |
| 43 | + 3 │ <template> |
| 44 | + 4 │ <!-- Missing argument: long-form without an argument --> |
| 45 | + > 5 │ <div v-bind></div> |
| 46 | + │ ^^^^^^ |
| 47 | + 6 │ |
| 48 | + 7 │ <!-- Missing argument with modifier --> |
| 49 | + |
| 50 | + i v-bind directives require an argument to specify which attribute to bind to. |
| 51 | + |
| 52 | + i For example, use v-bind:foo to bind to the foo attribute. |
| 53 | + |
| 54 | +
|
| 55 | +``` |
| 56 | +
|
| 57 | +``` |
| 58 | +invalid.vue:8:8 lint/nursery/noVueInvalidVBind ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ |
| 59 | +
|
| 60 | + i The v-bind directive is missing an argument. |
| 61 | + |
| 62 | + 7 │ <!-- Missing argument with modifier --> |
| 63 | + > 8 │ <div v-bind.prop></div> |
| 64 | + │ ^^^^^^^^^^^ |
| 65 | + 9 │ |
| 66 | + 10 │ <!-- Invalid single modifier on long-form --> |
| 67 | + |
| 68 | + i v-bind directives require an argument to specify which attribute to bind to. |
| 69 | + |
| 70 | + i For example, use v-bind:foo to bind to the foo attribute. |
| 71 | + |
| 72 | +
|
| 73 | +``` |
| 74 | +
|
| 75 | +``` |
| 76 | +invalid.vue:11:18 lint/nursery/noVueInvalidVBind ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ |
| 77 | +
|
| 78 | + i This v-bind directive has an invalid modifier. |
| 79 | + |
| 80 | + 10 │ <!-- Invalid single modifier on long-form --> |
| 81 | + > 11 │ <div v-bind:foo.invalid="bar"></div> |
| 82 | + │ ^^^^^^^^ |
| 83 | + 12 │ |
| 84 | + 13 │ <!-- Invalid modifier on shorthand --> |
| 85 | + |
| 86 | + i Only the following modifiers are allowed on v-bind directives: prop, camel, sync, and attr. |
| 87 | + |
| 88 | + i Remove or correct the invalid modifier. |
| 89 | + |
| 90 | +
|
| 91 | +``` |
| 92 | +
|
| 93 | +``` |
| 94 | +invalid.vue:14:13 lint/nursery/noVueInvalidVBind ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ |
| 95 | +
|
| 96 | + i This v-bind directive has an invalid modifier. |
| 97 | + |
| 98 | + 13 │ <!-- Invalid modifier on shorthand --> |
| 99 | + > 14 │ <span :bar.badModifier="baz"></span> |
| 100 | + │ ^^^^^^^^^^^^ |
| 101 | + 15 │ |
| 102 | + 16 │ <!-- Mixed valid and invalid modifiers: 'prop' is valid, 'wrong' is not --> |
| 103 | + |
| 104 | + i Only the following modifiers are allowed on v-bind directives: prop, camel, sync, and attr. |
| 105 | + |
| 106 | + i Remove or correct the invalid modifier. |
| 107 | + |
| 108 | +
|
| 109 | +``` |
| 110 | +
|
| 111 | +``` |
| 112 | +invalid.vue:17:15 lint/nursery/noVueInvalidVBind ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ |
| 113 | +
|
| 114 | + i This v-bind directive has an invalid modifier. |
| 115 | + |
| 116 | + 16 │ <!-- Mixed valid and invalid modifiers: 'prop' is valid, 'wrong' is not --> |
| 117 | + > 17 │ <p :baz.prop.wrong="value"></p> |
| 118 | + │ ^^^^^^ |
| 119 | + 18 │ |
| 120 | + 19 │ <!-- Dynamic argument is present but modifier is invalid --> |
| 121 | + |
| 122 | + i Only the following modifiers are allowed on v-bind directives: prop, camel, sync, and attr. |
| 123 | + |
| 124 | + i Remove or correct the invalid modifier. |
| 125 | + |
| 126 | +
|
| 127 | +``` |
| 128 | +
|
| 129 | +``` |
| 130 | +invalid.vue:20:22 lint/nursery/noVueInvalidVBind ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ |
| 131 | +
|
| 132 | + i This v-bind directive has an invalid modifier. |
| 133 | + |
| 134 | + 19 │ <!-- Dynamic argument is present but modifier is invalid --> |
| 135 | + > 20 │ <p v-bind:[dynamic].notAValidModifier="value"></p> |
| 136 | + │ ^^^^^^^^^^^^^^^^^^ |
| 137 | + 21 │ |
| 138 | + 22 │ <!-- Multiple invalid modifiers --> |
| 139 | + |
| 140 | + i Only the following modifiers are allowed on v-bind directives: prop, camel, sync, and attr. |
| 141 | + |
| 142 | + i Remove or correct the invalid modifier. |
| 143 | + |
| 144 | +
|
| 145 | +``` |
| 146 | +
|
| 147 | +``` |
| 148 | +invalid.vue:23:20 lint/nursery/noVueInvalidVBind ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ |
| 149 | +
|
| 150 | + i This v-bind directive has an invalid modifier. |
| 151 | + |
| 152 | + 22 │ <!-- Multiple invalid modifiers --> |
| 153 | + > 23 │ <button :disabled.once="true"></button> |
| 154 | + │ ^^^^^ |
| 155 | + 24 │ |
| 156 | + 25 │ <!-- Component binding with unknown modifier --> |
| 157 | + |
| 158 | + i Only the following modifiers are allowed on v-bind directives: prop, camel, sync, and attr. |
| 159 | + |
| 160 | + i Remove or correct the invalid modifier. |
| 161 | + |
| 162 | +
|
| 163 | +``` |
| 164 | +
|
| 165 | +``` |
| 166 | +invalid.vue:26:31 lint/nursery/noVueInvalidVBind ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ |
| 167 | +
|
| 168 | + i This v-bind directive has an invalid modifier. |
| 169 | + |
| 170 | + 25 │ <!-- Component binding with unknown modifier --> |
| 171 | + > 26 │ <MyComponent v-bind:propName.weird="someValue"></MyComponent> |
| 172 | + │ ^^^^^^ |
| 173 | + 27 │ </template> |
| 174 | + 28 │ |
| 175 | + |
| 176 | + i Only the following modifiers are allowed on v-bind directives: prop, camel, sync, and attr. |
| 177 | + |
| 178 | + i Remove or correct the invalid modifier. |
| 179 | + |
| 180 | +
|
| 181 | +``` |
0 commit comments