replace 'group' binding with , drive-by fix some other messages

pull/16874/head
Rich Harris 11 months ago
parent d2e2021e30
commit 926f9a571e

@ -33,7 +33,7 @@ export function BindDirective(node, context) {
e.bind_invalid_target(
node,
node.name,
property.valid_elements.map((valid_element) => `<${valid_element}>`).join(', ')
property.valid_elements.map((valid_element) => `\`<${valid_element}>\``).join(', ')
);
}
@ -70,12 +70,12 @@ export function BindDirective(node, context) {
e.bind_invalid_target(
node,
node.name,
`<input type="checkbox">${type?.value[0].data === 'radio' ? ` — for <input type="radio">, use 'group' binding` : ''}`
`\`<input type="checkbox">\`${type?.value[0].data === 'radio' ? ` — for \`<input type="radio">\`, use \`bind:group\`` : ''}`
);
}
if (node.name === 'files' && type?.value[0].data !== 'file') {
e.bind_invalid_target(node, node.name, '<input type="file">');
e.bind_invalid_target(node, node.name, '`<input type="file">`');
}
}
}
@ -98,7 +98,7 @@ export function BindDirective(node, context) {
e.bind_invalid_target(
node,
node.name,
`non-<svg> elements. Use 'clientWidth' for <svg> instead`
`non-\`<svg>\` elements. Use \`bind:clientWidth\` for \`<svg>\` instead`
);
}

@ -3,6 +3,6 @@ import { test } from '../../test';
export default test({
error: {
code: 'bind_invalid_target',
message: '`bind:value` can only be used with <input>, <textarea>, <select>'
message: '`bind:value` can only be used with `<input>`, `<textarea>`, `<select>`'
}
});

@ -1,7 +1,7 @@
[
{
"code": "bind_invalid_target",
"message": "`bind:offsetWidth` can only be used with non-<svg> elements. Use 'clientWidth' for <svg> instead",
"message": "`bind:offsetWidth` can only be used with non-`<svg>` elements. Use `bind:clientWidth` for `<svg>` instead",
"start": {
"line": 5,
"column": 5

@ -1,7 +1,7 @@
[
{
"code": "bind_invalid_target",
"message": "`bind:checked` can only be used with <input type=\"checkbox\">",
"message": "`bind:checked` can only be used with `<input type=\"checkbox\">`",
"start": {
"line": 5,
"column": 7

@ -1,7 +1,7 @@
[
{
"code": "bind_invalid_target",
"message": "`bind:open` can only be used with <details>",
"message": "`bind:open` can only be used with `<details>`",
"start": {
"line": 5,
"column": 5

@ -1,7 +1,7 @@
[
{
"code": "bind_invalid_target",
"message": "`bind:value` can only be used with <input>, <textarea>, <select>",
"message": "`bind:value` can only be used with `<input>`, `<textarea>`, `<select>`",
"start": {
"line": 5,
"column": 5

@ -1,7 +1,7 @@
[
{
"code": "bind_invalid_target",
"message": "`bind:checked` can only be used with <input type=\"checkbox\"> — for <input type=\"radio\">, use 'group' binding",
"message": "`bind:checked` can only be used with `<input type=\"checkbox\">` — for `<input type=\"radio\">`, use `bind:group`",
"start": {
"line": 5,
"column": 20

Loading…
Cancel
Save