Skip to content

Commit b504a44

Browse files
committed
lint
1 parent 8d0135f commit b504a44

File tree

5 files changed

+23
-4
lines changed

5 files changed

+23
-4
lines changed

documentation/docs/98-reference/30-compiler-errors.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -279,7 +279,7 @@ generated: 'generated by process-messages/index.js'
279279
280280
## `import_svelte_internal_forbidden`
281281

282-
> [!NOTE] Imports of 'svelte/internal/*' are forbidden. It contains private runtime code which is subject to change without notice. If you're importing from 'svelte/internal/*' to work around a limitation of Svelte, please open an issue at https://github.com/sveltejs/svelte and explain your use case
282+
> [!NOTE] Imports of 'svelte/internal/\*' are forbidden. It contains private runtime code which is subject to change without notice. If you're importing from 'svelte/internal/\*' to work around a limitation of Svelte, please open an issue at https://github.com/sveltejs/svelte and explain your use case
283283
284284
## `invalid_arguments_usage`
285285

documentation/docs/98-reference/30-compiler-warnings.md

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ You can list multiple rules in a single comment (separated by commas), and add a
2525
2626
Enforce no `accesskey` on element. Access keys are HTML attributes that allow web developers to assign keyboard shortcuts to elements. Inconsistencies between keyboard shortcuts and keyboard commands used by screen reader and keyboard-only users create accessibility complications. To avoid complications, access keys should not be used.
2727

28+
<!-- prettier-ignore -->
2829
```svelte
2930
<!-- A11y: Avoid using accesskey -->
3031
<div accesskey="z"></div>
@@ -43,7 +44,7 @@ An element with `aria-activedescendant` must be tabbable, so it must either have
4344

4445
## `a11y_aria_attributes`
4546

46-
> [!NOTE] '\<%name%>' should not have aria-* attributes
47+
> [!NOTE] '\<%name%>' should not have aria-\* attributes
4748
4849
Certain reserved DOM elements do not support ARIA roles, states and properties. This is often because they are not visible, for example `meta`, `html`, `script`, `style`. This rule enforces that these DOM elements do not contain the `aria-*` props.
4950

@@ -376,6 +377,7 @@ A non-interactive element does not support event handlers (mouse and key handler
376377
377378
Tab key navigation should be limited to elements on the page that can be interacted with.
378379

380+
<!-- prettier-ignore -->
379381
```svelte
380382
<!-- A11y: noninteractive element cannot have nonnegative tabIndex value -->
381383
<div tabindex="0"></div>
@@ -401,6 +403,7 @@ Some HTML elements have default ARIA roles. Giving these elements an ARIA role t
401403
402404
Elements like `<div>` with interactive handlers like `click` must have an ARIA role.
403405

406+
<!-- prettier-ignore -->
404407
```svelte
405408
<!-- A11y: <div> with click handler must have an ARIA role -->
406409
<div onclick={() => ''}></div>
@@ -412,6 +415,7 @@ Elements like `<div>` with interactive handlers like `click` must have an ARIA r
412415
413416
Avoid positive `tabindex` property values. This will move elements out of the expected tab order, creating a confusing experience for keyboard users.
414417

418+
<!-- prettier-ignore -->
415419
```svelte
416420
<!-- A11y: avoid tabindex values above zero -->
417421
<div tabindex="1"></div>
@@ -477,6 +481,7 @@ Enforce that only known ARIA attributes are used. This is based on the [WAI-ARIA
477481
478482
Elements with ARIA roles must use a valid, non-abstract ARIA role. A reference to role definitions can be found at [WAI-ARIA](https://www.w3.org/TR/wai-aria/#role_definitions) site.
479483

484+
<!-- prettier-ignore -->
480485
```svelte
481486
<!-- A11y: Unknown role 'toooltip' (did you mean 'tooltip'?) -->
482487
<div role="toooltip"></div>

documentation/docs/98-reference/30-runtime-warnings.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,4 +81,4 @@ To resolve this, ensure you're comparing values where both values were created w
8181
> [!NOTE] Value cannot be cloned with '$state.snapshot' — the original value was returned
8282
8383
> [!NOTE] The following properties cannot be cloned with '$state.snapshot' — the return value contains the originals:
84-
%properties%
84+
> %properties%

packages/svelte/messages/compile-warnings/a11y.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
55
Enforce no `accesskey` on element. Access keys are HTML attributes that allow web developers to assign keyboard shortcuts to elements. Inconsistencies between keyboard shortcuts and keyboard commands used by screen reader and keyboard-only users create accessibility complications. To avoid complications, access keys should not be used.
66

7+
<!-- prettier-ignore -->
78
```svelte
89
<!-- A11y: Avoid using accesskey -->
910
<div accesskey="z"></div>
@@ -355,6 +356,7 @@ A non-interactive element does not support event handlers (mouse and key handler
355356
356357
Tab key navigation should be limited to elements on the page that can be interacted with.
357358

359+
<!-- prettier-ignore -->
358360
```svelte
359361
<!-- A11y: noninteractive element cannot have nonnegative tabIndex value -->
360362
<div tabindex="0"></div>
@@ -380,6 +382,7 @@ Some HTML elements have default ARIA roles. Giving these elements an ARIA role t
380382
381383
Elements like `<div>` with interactive handlers like `click` must have an ARIA role.
382384

385+
<!-- prettier-ignore -->
383386
```svelte
384387
<!-- A11y: <div> with click handler must have an ARIA role -->
385388
<div onclick={() => ''}></div>
@@ -391,6 +394,7 @@ Elements like `<div>` with interactive handlers like `click` must have an ARIA r
391394
392395
Avoid positive `tabindex` property values. This will move elements out of the expected tab order, creating a confusing experience for keyboard users.
393396

397+
<!-- prettier-ignore -->
394398
```svelte
395399
<!-- A11y: avoid tabindex values above zero -->
396400
<div tabindex="1"></div>
@@ -456,6 +460,7 @@ Enforce that only known ARIA attributes are used. This is based on the [WAI-ARIA
456460
457461
Elements with ARIA roles must use a valid, non-abstract ARIA role. A reference to role definitions can be found at [WAI-ARIA](https://www.w3.org/TR/wai-aria/#role_definitions) site.
458462

463+
<!-- prettier-ignore -->
459464
```svelte
460465
<!-- A11y: Unknown role 'toooltip' (did you mean 'tooltip'?) -->
461466
<div role="toooltip"></div>

packages/svelte/scripts/process-messages/index.js

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,16 @@ for (const [category, codes] of Object.entries(consolidated_messages)) {
126126
for (const message of messages) {
127127
// Replace backticks with single quotes to avoid markdown formatting it to code blocks
128128
// Also make sure to escape < to avoid markdown interpreting it as an HTML tag
129-
lines.push('> [!NOTE] ' + message.replaceAll('`', "'").replace(/(?<!\\)</g, '\\<') + '\n');
129+
lines.push(
130+
'> [!NOTE] ' +
131+
message
132+
.replaceAll('`', "'")
133+
.replace(/(?<!\\)</g, '\\<')
134+
.replace(/(?<!\\)\*/g, '\\*')
135+
.split('\n')
136+
.join('\n> ') +
137+
'\n'
138+
);
130139
}
131140
if (details) {
132141
lines.push(details + '\n');

0 commit comments

Comments
 (0)