From b504a44b8e9b0e87c71b4b295f99af91e4bc156e Mon Sep 17 00:00:00 2001 From: Simon Holthausen Date: Thu, 10 Oct 2024 21:32:22 +0200 Subject: [PATCH] lint --- documentation/docs/98-reference/30-compiler-errors.md | 2 +- .../docs/98-reference/30-compiler-warnings.md | 7 ++++++- .../docs/98-reference/30-runtime-warnings.md | 2 +- packages/svelte/messages/compile-warnings/a11y.md | 5 +++++ packages/svelte/scripts/process-messages/index.js | 11 ++++++++++- 5 files changed, 23 insertions(+), 4 deletions(-) diff --git a/documentation/docs/98-reference/30-compiler-errors.md b/documentation/docs/98-reference/30-compiler-errors.md index 4ba4761eea..b1d2c1161f 100644 --- a/documentation/docs/98-reference/30-compiler-errors.md +++ b/documentation/docs/98-reference/30-compiler-errors.md @@ -279,7 +279,7 @@ generated: 'generated by process-messages/index.js' ## `import_svelte_internal_forbidden` -> [!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 +> [!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 ## `invalid_arguments_usage` diff --git a/documentation/docs/98-reference/30-compiler-warnings.md b/documentation/docs/98-reference/30-compiler-warnings.md index 6cc22d2e66..6a2c27f525 100644 --- a/documentation/docs/98-reference/30-compiler-warnings.md +++ b/documentation/docs/98-reference/30-compiler-warnings.md @@ -25,6 +25,7 @@ You can list multiple rules in a single comment (separated by commas), and add a 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. + ```svelte
@@ -43,7 +44,7 @@ An element with `aria-activedescendant` must be tabbable, so it must either have ## `a11y_aria_attributes` -> [!NOTE] '\<%name%>' should not have aria-* attributes +> [!NOTE] '\<%name%>' should not have aria-\* attributes 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. @@ -376,6 +377,7 @@ A non-interactive element does not support event handlers (mouse and key handler Tab key navigation should be limited to elements on the page that can be interacted with. + ```svelte
@@ -401,6 +403,7 @@ Some HTML elements have default ARIA roles. Giving these elements an ARIA role t Elements like `
` with interactive handlers like `click` must have an ARIA role. + ```svelte
''}>
@@ -412,6 +415,7 @@ Elements like `
` with interactive handlers like `click` must have an ARIA r Avoid positive `tabindex` property values. This will move elements out of the expected tab order, creating a confusing experience for keyboard users. + ```svelte
@@ -477,6 +481,7 @@ Enforce that only known ARIA attributes are used. This is based on the [WAI-ARIA 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. + ```svelte
diff --git a/documentation/docs/98-reference/30-runtime-warnings.md b/documentation/docs/98-reference/30-runtime-warnings.md index f21b8b1e86..104daec4d3 100644 --- a/documentation/docs/98-reference/30-runtime-warnings.md +++ b/documentation/docs/98-reference/30-runtime-warnings.md @@ -81,4 +81,4 @@ To resolve this, ensure you're comparing values where both values were created w > [!NOTE] Value cannot be cloned with '$state.snapshot' — the original value was returned > [!NOTE] The following properties cannot be cloned with '$state.snapshot' — the return value contains the originals: -%properties% +> %properties% diff --git a/packages/svelte/messages/compile-warnings/a11y.md b/packages/svelte/messages/compile-warnings/a11y.md index ac13b68ccd..938c0a103d 100644 --- a/packages/svelte/messages/compile-warnings/a11y.md +++ b/packages/svelte/messages/compile-warnings/a11y.md @@ -4,6 +4,7 @@ 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. + ```svelte
@@ -355,6 +356,7 @@ A non-interactive element does not support event handlers (mouse and key handler Tab key navigation should be limited to elements on the page that can be interacted with. + ```svelte
@@ -380,6 +382,7 @@ Some HTML elements have default ARIA roles. Giving these elements an ARIA role t Elements like `
` with interactive handlers like `click` must have an ARIA role. + ```svelte
''}>
@@ -391,6 +394,7 @@ Elements like `
` with interactive handlers like `click` must have an ARIA r Avoid positive `tabindex` property values. This will move elements out of the expected tab order, creating a confusing experience for keyboard users. + ```svelte
@@ -456,6 +460,7 @@ Enforce that only known ARIA attributes are used. This is based on the [WAI-ARIA 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. + ```svelte
diff --git a/packages/svelte/scripts/process-messages/index.js b/packages/svelte/scripts/process-messages/index.js index 1495c7324e..62d10f4874 100644 --- a/packages/svelte/scripts/process-messages/index.js +++ b/packages/svelte/scripts/process-messages/index.js @@ -126,7 +126,16 @@ for (const [category, codes] of Object.entries(consolidated_messages)) { for (const message of messages) { // Replace backticks with single quotes to avoid markdown formatting it to code blocks // Also make sure to escape < to avoid markdown interpreting it as an HTML tag - lines.push('> [!NOTE] ' + message.replaceAll('`', "'").replace(/(? [!NOTE] ' + + message + .replaceAll('`', "'") + .replace(/(? ') + + '\n' + ); } if (details) { lines.push(details + '\n');