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

fix: make messages more consistent #11643

Merged
merged 1 commit into from
May 16, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/cyan-ducks-teach.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'svelte': patch
---

fix: make messages more consistent
4 changes: 2 additions & 2 deletions packages/svelte/messages/compile-errors/template.md
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,7 @@

## mixed_event_handler_syntaxes

> Mixing old (on:%name%) and new syntaxes for event handling is not allowed. Use only the on%name% syntax.
> Mixing old (on:%name%) and new syntaxes for event handling is not allowed. Use only the on%name% syntax

## node_invalid_placement

Expand Down Expand Up @@ -230,7 +230,7 @@

## slot_snippet_conflict

> Cannot use `<slot>` syntax and `{@render ...}` tags in the same component. Migrate towards `{@render ...}` tags completely.
> Cannot use `<slot>` syntax and `{@render ...}` tags in the same component. Migrate towards `{@render ...}` tags completely

## snippet_conflict

Expand Down
10 changes: 5 additions & 5 deletions packages/svelte/messages/compile-warnings/a11y.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@

## a11y_click_events_have_key_events

> Visible, non-interactive elements with a click event must be accompanied by a keyboard event handler. Consider whether an interactive element such as `<button type="button">` or `<a>` might be more appropriate. See https://svelte.dev/docs/accessibility-warnings#a11y-click-events-have-key-events for more details.
> Visible, non-interactive elements with a click event must be accompanied by a keyboard event handler. Consider whether an interactive element such as `<button type="button">` or `<a>` might be more appropriate. See https://svelte.dev/docs/accessibility-warnings#a11y-click-events-have-key-events for more details

## a11y_distracting_elements

Expand All @@ -40,7 +40,7 @@

## a11y_img_redundant_alt

> Screenreaders already announce `<img>` elements as an image.
> Screenreaders already announce `<img>` elements as an image

## a11y_incorrect_aria_attribute_type

Expand Down Expand Up @@ -76,15 +76,15 @@

## a11y_interactive_supports_focus

> Elements with the '%role%' interactive role must have a tabindex value.
> Elements with the '%role%' interactive role must have a tabindex value

## a11y_invalid_attribute

> '%href_value%' is not a valid %href_attribute% attribute

## a11y_label_has_associated_control

> A form label must be associated with a control.
> A form label must be associated with a control

## a11y_media_has_caption

Expand Down Expand Up @@ -120,7 +120,7 @@

## a11y_no_noninteractive_element_interactions

> Non-interactive element `<%element%>` should not be assigned mouse or keyboard event listeners.
> Non-interactive element `<%element%>` should not be assigned mouse or keyboard event listeners

## a11y_no_noninteractive_element_to_interactive_role

Expand Down
4 changes: 2 additions & 2 deletions packages/svelte/messages/compile-warnings/template.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,8 @@

## event_directive_deprecated

> Using `on:%name%` to listen to the %name% event is deprecated. Use the event attribute `on%name%` instead.
> Using `on:%name%` to listen to the %name% event is deprecated. Use the event attribute `on%name%` instead

## slot_element_deprecated

> Using `<slot>` to render parent content is deprecated. Use `{@render ...}` tags instead.
> Using `<slot>` to render parent content is deprecated. Use `{@render ...}` tags instead
8 changes: 4 additions & 4 deletions packages/svelte/src/compiler/errors.js
Original file line number Diff line number Diff line change
Expand Up @@ -928,13 +928,13 @@ export function let_directive_invalid_placement(node) {
}

/**
* Mixing old (on:%name%) and new syntaxes for event handling is not allowed. Use only the on%name% syntax.
* Mixing old (on:%name%) and new syntaxes for event handling is not allowed. Use only the on%name% syntax
* @param {null | number | NodeLike} node
* @param {string} name
* @returns {never}
*/
export function mixed_event_handler_syntaxes(node, name) {
e(node, "mixed_event_handler_syntaxes", `Mixing old (on:${name}) and new syntaxes for event handling is not allowed. Use only the on${name} syntax.`);
e(node, "mixed_event_handler_syntaxes", `Mixing old (on:${name}) and new syntaxes for event handling is not allowed. Use only the on${name} syntax`);
}

/**
Expand Down Expand Up @@ -1059,12 +1059,12 @@ export function slot_element_invalid_name_default(node) {
}

/**
* Cannot use `<slot>` syntax and `{@render ...}` tags in the same component. Migrate towards `{@render ...}` tags completely.
* Cannot use `<slot>` syntax and `{@render ...}` tags in the same component. Migrate towards `{@render ...}` tags completely
* @param {null | number | NodeLike} node
* @returns {never}
*/
export function slot_snippet_conflict(node) {
e(node, "slot_snippet_conflict", "Cannot use `<slot>` syntax and `{@render ...}` tags in the same component. Migrate towards `{@render ...}` tags completely.");
e(node, "slot_snippet_conflict", "Cannot use `<slot>` syntax and `{@render ...}` tags in the same component. Migrate towards `{@render ...}` tags completely");
}

/**
Expand Down
28 changes: 14 additions & 14 deletions packages/svelte/src/compiler/warnings.js
Original file line number Diff line number Diff line change
Expand Up @@ -137,11 +137,11 @@ export function a11y_autofocus(node) {
}

/**
* Visible, non-interactive elements with a click event must be accompanied by a keyboard event handler. Consider whether an interactive element such as `<button type="button">` or `<a>` might be more appropriate. See https://svelte.dev/docs/accessibility-warnings#a11y-click-events-have-key-events for more details.
* Visible, non-interactive elements with a click event must be accompanied by a keyboard event handler. Consider whether an interactive element such as `<button type="button">` or `<a>` might be more appropriate. See https://svelte.dev/docs/accessibility-warnings#a11y-click-events-have-key-events for more details
* @param {null | NodeLike} node
*/
export function a11y_click_events_have_key_events(node) {
w(node, "a11y_click_events_have_key_events", "Visible, non-interactive elements with a click event must be accompanied by a keyboard event handler. Consider whether an interactive element such as `<button type=\"button\">` or `<a>` might be more appropriate. See https://svelte.dev/docs/accessibility-warnings#a11y-click-events-have-key-events for more details.");
w(node, "a11y_click_events_have_key_events", "Visible, non-interactive elements with a click event must be accompanied by a keyboard event handler. Consider whether an interactive element such as `<button type=\"button\">` or `<a>` might be more appropriate. See https://svelte.dev/docs/accessibility-warnings#a11y-click-events-have-key-events for more details");
}

/**
Expand Down Expand Up @@ -179,11 +179,11 @@ export function a11y_hidden(node, name) {
}

/**
* Screenreaders already announce `<img>` elements as an image.
* Screenreaders already announce `<img>` elements as an image
* @param {null | NodeLike} node
*/
export function a11y_img_redundant_alt(node) {
w(node, "a11y_img_redundant_alt", "Screenreaders already announce `<img>` elements as an image.");
w(node, "a11y_img_redundant_alt", "Screenreaders already announce `<img>` elements as an image");
}

/**
Expand Down Expand Up @@ -262,12 +262,12 @@ export function a11y_incorrect_aria_attribute_type_tristate(node, attribute) {
}

/**
* Elements with the '%role%' interactive role must have a tabindex value.
* Elements with the '%role%' interactive role must have a tabindex value
* @param {null | NodeLike} node
* @param {string} role
*/
export function a11y_interactive_supports_focus(node, role) {
w(node, "a11y_interactive_supports_focus", `Elements with the '${role}' interactive role must have a tabindex value.`);
w(node, "a11y_interactive_supports_focus", `Elements with the '${role}' interactive role must have a tabindex value`);
}

/**
Expand All @@ -281,11 +281,11 @@ export function a11y_invalid_attribute(node, href_value, href_attribute) {
}

/**
* A form label must be associated with a control.
* A form label must be associated with a control
* @param {null | NodeLike} node
*/
export function a11y_label_has_associated_control(node) {
w(node, "a11y_label_has_associated_control", "A form label must be associated with a control.");
w(node, "a11y_label_has_associated_control", "A form label must be associated with a control");
}

/**
Expand Down Expand Up @@ -363,12 +363,12 @@ export function a11y_no_interactive_element_to_noninteractive_role(node, element
}

/**
* Non-interactive element `<%element%>` should not be assigned mouse or keyboard event listeners.
* Non-interactive element `<%element%>` should not be assigned mouse or keyboard event listeners
* @param {null | NodeLike} node
* @param {string} element
*/
export function a11y_no_noninteractive_element_interactions(node, element) {
w(node, "a11y_no_noninteractive_element_interactions", `Non-interactive element \`<${element}>\` should not be assigned mouse or keyboard event listeners.`);
w(node, "a11y_no_noninteractive_element_interactions", `Non-interactive element \`<${element}>\` should not be assigned mouse or keyboard event listeners`);
}

/**
Expand Down Expand Up @@ -698,18 +698,18 @@ export function element_invalid_self_closing_tag(node, name) {
}

/**
* Using `on:%name%` to listen to the %name% event is deprecated. Use the event attribute `on%name%` instead.
* Using `on:%name%` to listen to the %name% event is deprecated. Use the event attribute `on%name%` instead
* @param {null | NodeLike} node
* @param {string} name
*/
export function event_directive_deprecated(node, name) {
w(node, "event_directive_deprecated", `Using \`on:${name}\` to listen to the ${name} event is deprecated. Use the event attribute \`on${name}\` instead.`);
w(node, "event_directive_deprecated", `Using \`on:${name}\` to listen to the ${name} event is deprecated. Use the event attribute \`on${name}\` instead`);
}

/**
* Using `<slot>` to render parent content is deprecated. Use `{@render ...}` tags instead.
* Using `<slot>` to render parent content is deprecated. Use `{@render ...}` tags instead
* @param {null | NodeLike} node
*/
export function slot_element_deprecated(node) {
w(node, "slot_element_deprecated", "Using `<slot>` to render parent content is deprecated. Use `{@render ...}` tags instead.");
w(node, "slot_element_deprecated", "Using `<slot>` to render parent content is deprecated. Use `{@render ...}` tags instead");
}
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ export default test({
error: {
code: 'slot_snippet_conflict',
message:
'Cannot use `<slot>` syntax and `{@render ...}` tags in the same component. Migrate towards `{@render ...}` tags completely.',
'Cannot use `<slot>` syntax and `{@render ...}` tags in the same component. Migrate towards `{@render ...}` tags completely',
position: [71, 84]
}
});
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[
{
"code": "a11y_click_events_have_key_events",
"message": "Visible, non-interactive elements with a click event must be accompanied by a keyboard event handler. Consider whether an interactive element such as `<button type=\"button\">` or `<a>` might be more appropriate. See https://svelte.dev/docs/accessibility-warnings#a11y-click-events-have-key-events for more details.",
"message": "Visible, non-interactive elements with a click event must be accompanied by a keyboard event handler. Consider whether an interactive element such as `<button type=\"button\">` or `<a>` might be more appropriate. See https://svelte.dev/docs/accessibility-warnings#a11y-click-events-have-key-events for more details",
"start": {
"line": 13,
"column": 0
Expand All @@ -13,7 +13,7 @@
},
{
"code": "a11y_click_events_have_key_events",
"message": "Visible, non-interactive elements with a click event must be accompanied by a keyboard event handler. Consider whether an interactive element such as `<button type=\"button\">` or `<a>` might be more appropriate. See https://svelte.dev/docs/accessibility-warnings#a11y-click-events-have-key-events for more details.",
"message": "Visible, non-interactive elements with a click event must be accompanied by a keyboard event handler. Consider whether an interactive element such as `<button type=\"button\">` or `<a>` might be more appropriate. See https://svelte.dev/docs/accessibility-warnings#a11y-click-events-have-key-events for more details",
"start": {
"line": 15,
"column": 0
Expand All @@ -25,7 +25,7 @@
},
{
"code": "a11y_click_events_have_key_events",
"message": "Visible, non-interactive elements with a click event must be accompanied by a keyboard event handler. Consider whether an interactive element such as `<button type=\"button\">` or `<a>` might be more appropriate. See https://svelte.dev/docs/accessibility-warnings#a11y-click-events-have-key-events for more details.",
"message": "Visible, non-interactive elements with a click event must be accompanied by a keyboard event handler. Consider whether an interactive element such as `<button type=\"button\">` or `<a>` might be more appropriate. See https://svelte.dev/docs/accessibility-warnings#a11y-click-events-have-key-events for more details",
"start": {
"line": 18,
"column": 0
Expand All @@ -37,7 +37,7 @@
},
{
"code": "a11y_click_events_have_key_events",
"message": "Visible, non-interactive elements with a click event must be accompanied by a keyboard event handler. Consider whether an interactive element such as `<button type=\"button\">` or `<a>` might be more appropriate. See https://svelte.dev/docs/accessibility-warnings#a11y-click-events-have-key-events for more details.",
"message": "Visible, non-interactive elements with a click event must be accompanied by a keyboard event handler. Consider whether an interactive element such as `<button type=\"button\">` or `<a>` might be more appropriate. See https://svelte.dev/docs/accessibility-warnings#a11y-click-events-have-key-events for more details",
"start": {
"line": 20,
"column": 0
Expand All @@ -49,7 +49,7 @@
},
{
"code": "a11y_click_events_have_key_events",
"message": "Visible, non-interactive elements with a click event must be accompanied by a keyboard event handler. Consider whether an interactive element such as `<button type=\"button\">` or `<a>` might be more appropriate. See https://svelte.dev/docs/accessibility-warnings#a11y-click-events-have-key-events for more details.",
"message": "Visible, non-interactive elements with a click event must be accompanied by a keyboard event handler. Consider whether an interactive element such as `<button type=\"button\">` or `<a>` might be more appropriate. See https://svelte.dev/docs/accessibility-warnings#a11y-click-events-have-key-events for more details",
"start": {
"line": 22,
"column": 0
Expand All @@ -61,7 +61,7 @@
},
{
"code": "a11y_click_events_have_key_events",
"message": "Visible, non-interactive elements with a click event must be accompanied by a keyboard event handler. Consider whether an interactive element such as `<button type=\"button\">` or `<a>` might be more appropriate. See https://svelte.dev/docs/accessibility-warnings#a11y-click-events-have-key-events for more details.",
"message": "Visible, non-interactive elements with a click event must be accompanied by a keyboard event handler. Consider whether an interactive element such as `<button type=\"button\">` or `<a>` might be more appropriate. See https://svelte.dev/docs/accessibility-warnings#a11y-click-events-have-key-events for more details",
"start": {
"line": 24,
"column": 0
Expand All @@ -73,7 +73,7 @@
},
{
"code": "a11y_click_events_have_key_events",
"message": "Visible, non-interactive elements with a click event must be accompanied by a keyboard event handler. Consider whether an interactive element such as `<button type=\"button\">` or `<a>` might be more appropriate. See https://svelte.dev/docs/accessibility-warnings#a11y-click-events-have-key-events for more details.",
"message": "Visible, non-interactive elements with a click event must be accompanied by a keyboard event handler. Consider whether an interactive element such as `<button type=\"button\">` or `<a>` might be more appropriate. See https://svelte.dev/docs/accessibility-warnings#a11y-click-events-have-key-events for more details",
"start": {
"line": 26,
"column": 0
Expand All @@ -85,7 +85,7 @@
},
{
"code": "a11y_click_events_have_key_events",
"message": "Visible, non-interactive elements with a click event must be accompanied by a keyboard event handler. Consider whether an interactive element such as `<button type=\"button\">` or `<a>` might be more appropriate. See https://svelte.dev/docs/accessibility-warnings#a11y-click-events-have-key-events for more details.",
"message": "Visible, non-interactive elements with a click event must be accompanied by a keyboard event handler. Consider whether an interactive element such as `<button type=\"button\">` or `<a>` might be more appropriate. See https://svelte.dev/docs/accessibility-warnings#a11y-click-events-have-key-events for more details",
"start": {
"line": 28,
"column": 0
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[
{
"code": "a11y_img_redundant_alt",
"message": "Screenreaders already announce `<img>` elements as an image.",
"message": "Screenreaders already announce `<img>` elements as an image",
"end": {
"column": 49,
"line": 3
Expand All @@ -13,7 +13,7 @@
},
{
"code": "a11y_img_redundant_alt",
"message": "Screenreaders already announce `<img>` elements as an image.",
"message": "Screenreaders already announce `<img>` elements as an image",
"end": {
"column": 45,
"line": 4
Expand All @@ -25,7 +25,7 @@
},
{
"code": "a11y_img_redundant_alt",
"message": "Screenreaders already announce `<img>` elements as an image.",
"message": "Screenreaders already announce `<img>` elements as an image",
"end": {
"column": 52,
"line": 5
Expand Down
Loading
Loading