Repository: sveltejs/eslint-plugin-svelte
Pull request #844 (2024-08-26 11:18:07)

feat: Add fixes for block-lang rule
I wanted eslint to automatically fix script/style errors from the block-lang rule.

The `lang` fixes will only apply when a script/style config value contains only a single, non-null value.

```html
<!-- svelte/block-lang: ["error", {"enforceScriptPresent": true}] -->
<!-- Error: The <script> block should be present and its lang attribute should be omitted -->

<!-- fixes into at the top of the file --> 
<script>
</script>
```

```html
<!-- svelte/block-lang: ["error", {"enforceScriptPresent": true, "script": "ts"}] -->
<!-- Error: The <script> block should be present and its lang attribute should be "ts" -->

<!-- fixes into at the top of the file --> 
<script lang="ts">
</script>
```

```html
<!-- svelte/block-lang: ["error", {"script": "ts"}] -->
<!-- Error: The lang attribute of the <script> block should be "ts"-->

<script>
</script>
<!-- fixes into --> 
<script lang="ts">
</script>
```

```html
<!-- svelte/block-lang: ["error", {"script": "ts"}] -->
<!-- Error: The lang attribute of the <script> block should be "ts"-->

<script context="module">
</script>
<!-- fixes into --> 
<script lang="ts" context="module">
</script>
```

```html
<!-- svelte/block-lang: ["error", {"script": "ts"}] -->
<!-- Error: The lang attribute of the <script> block should be "ts" -->

<script module>
</script>
<!-- fixes into --> 
<script lang="ts" module>
</script>
```
*The same logic applies to the `style` tag except will create at the bottom of the file*


Patch:
diff --git a/.changeset/fifty-parents-itch.md b/.changeset/fifty-parents-itch.md
new file mode 100644
index 0000000..c5f1b36
--- /dev/null
+++ b/.changeset/fifty-parents-itch.md
@@ -0,0 +1,5 @@
+---
+'eslint-plugin-svelte': minor
+---
+
+feat: Added suggestion to the `block-lang` rule.
diff --git a/README.md b/README.md
index 7c0ae63..72cad69 100644
--- a/README.md
+++ b/README.md
@@ -354,7 +354,7 @@ These rules relate to better ways of doing things to help you avoid problems:
 
 | Rule ID | Description |    |
 |:--------|:------------|:---|
-| [svelte/block-lang](https://sveltejs.github.io/eslint-plugin-svelte/rules/block-lang/) | disallows the use of languages other than those specified in the configuration for the lang attribute of `<script>` and `<style>` blocks. |  |
+| [svelte/block-lang](https://sveltejs.github.io/eslint-plugin-svelte/rules/block-lang/) | disallows the use of languages other than those specified in the configuration for the lang attribute of `<script>` and `<style>` blocks. | :bulb: |
 | [svelte/button-has-type](https://sveltejs.github.io/eslint-plugin-svelte/rules/button-has-type/) | disallow usage of button without an explicit type attribute |  |
 | [svelte/no-at-debug-tags](https://sveltejs.github.io/eslint-plugin-svelte/rules/no-at-debug-tags/) | disallow the use of `{@debug}` | :star: |
 | [svelte/no-ignored-unsubscribe](https://sveltejs.github.io/eslint-plugin-svelte/rules/no-ignored-unsubscribe/) | disallow ignoring the unsubscribe method returned by the `subscribe()` on Svelte stores. |  |
diff --git a/docs/rules.md b/docs/rules.md
index 023d611..c5f74fc 100644
--- a/docs/rules.md
+++ b/docs/rules.md
@@ -51,7 +51,7 @@ These rules relate to better ways of doing things to help you avoid problems:
 
 | Rule ID                                                                                  | Description                                                                                                                               |          |
 | :--------------------------------------------------------------------------------------- | :---------------------------------------------------------------------------------------------------------------------------------------- | :------- |
-| [svelte/block-lang](./rules/block-lang.md)                                               | disallows the use of languages other than those specified in the configuration for the lang attribute of `<script>` and `<style>` blocks. |          |
+| [svelte/block-lang](./rules/block-lang.md)                                               | disallows the use of languages other than those specified in the configuration for the lang attribute of `<script>` and `<style>` blocks. | :bulb:   |
 | [svelte/button-has-type](./rules/button-has-type.md)                                     | disallow usage of button without an explicit type attribute                                                                               |          |
 | [svelte/no-at-debug-tags](./rules/no-at-debug-tags.md)                                   | disallow the use of `{@debug}`                                                                                                            | :star:   |
 | [svelte/no-ignored-unsubscribe](./rules/no-ignored-unsubscribe.md)                       | disallow ignoring the unsubscribe method returned by the `subscribe()` on Svelte stores.                                                  |          |
diff --git a/docs/rules/block-lang.md b/docs/rules/block-lang.md
index 2a5eb99..e5e12d8 100644
--- a/docs/rules/block-lang.md
+++ b/docs/rules/block-lang.md
@@ -10,6 +10,8 @@ since: 'v2.18.0'
 
 > disallows the use of languages other than those specified in the configuration for the lang attribute of `<script>` and `<style>` blocks.
 
+- :bulb: Some problems reported by this rule are manually fixable by editor [suggestions](https://eslint.org/docs/developer-guide/working-with-rules#providing-suggestions).
+
 ## :book: Rule Details
 
 This rule enforces all svelte components to use the same set of languages for their scripts and styles.
diff --git a/packages/eslint-plugin-svelte/src/rules/block-lang.ts b/packages/eslint-plugin-svelte/src/rules/block-lang.ts
index 67b32ff..03eed5b 100644
--- a/packages/eslint-plugin-svelte/src/rules/block-lang.ts
+++ b/packages/eslint-plugin-svelte/src/rules/block-lang.ts
@@ -1,7 +1,8 @@
 import { createRule } from '../utils/index.js';
-import { getLangValue } from '../utils/ast-utils.js';
+import { findAttribute, getLangValue } from '../utils/ast-utils.js';
 import type { SvelteScriptElement, SvelteStyleElement } from 'svelte-eslint-parser/lib/ast';
 import { getSourceCode } from '../utils/compat.js';
+import type { SuggestionReportDescriptor, SourceCode } from '../types.js';
 
 export default createRule('block-lang', {
 	meta: {
@@ -54,7 +55,8 @@ export default createRule('block-lang', {
 			}
 		],
 		messages: {},
-		type: 'suggestion'
+		type: 'suggestion',
+		hasSuggestions: true
 	},
 	create(context) {
 		if (!getSourceCode(context).parserServices.isSvelte) {
@@ -88,7 +90,8 @@ export default createRule('block-lang', {
 						loc: { line: 1, column: 1 },
 						message: `The <script> block should be present and its lang attribute should be ${prettyPrintLangs(
 							allowedScriptLangs
-						)}.`
+						)}.`,
+						suggest: buildAddLangSuggestions(allowedScriptLangs, 'script', getSourceCode(context))
 					});
 				}
 				for (const scriptNode of scriptNodes) {
@@ -97,16 +100,19 @@ export default createRule('block-lang', {
 							node: scriptNode,
 							message: `The lang attribute of the <script> block should be ${prettyPrintLangs(
 								allowedScriptLangs
-							)}.`
+							)}.`,
+							suggest: buildReplaceLangSuggestions(allowedScriptLangs, scriptNode)
 						});
 					}
 				}
 				if (styleNodes.length === 0 && enforceStylePresent) {
+					const sourceCode = getSourceCode(context);
 					context.report({
 						loc: { line: 1, column: 1 },
 						message: `The <style> block should be present and its lang attribute should be ${prettyPrintLangs(
 							allowedStyleLangs
-						)}.`
+						)}.`,
+						suggest: buildAddLangSuggestions(allowedStyleLangs, 'style', sourceCode)
 					});
 				}
 				for (const styleNode of styleNodes) {
@@ -115,7 +121,8 @@ export default createRule('block-lang', {
 							node: styleNode,
 							message: `The lang attribute of the <style> block should be ${prettyPrintLangs(
 								allowedStyleLangs
-							)}.`
+							)}.`,
+							suggest: buildReplaceLangSuggestions(allowedStyleLangs, styleNode)
 						});
 					}
 				}
@@ -124,6 +131,70 @@ export default createRule('block-lang', {
 	}
 });
 
+function buildAddLangSuggestions(
+	langs: (string | null)[],
+	tagName: 'script' | 'style',
+	sourceCode: SourceCode
+): SuggestionReportDescriptor[] {
+	return langs
+		.filter((lang) => lang != null && lang !== '')
+		.map((lang) => {
+			return {
+				desc: `Add a lang attribute to a <${tagName}> block with the value "${lang}".`,
+				fix: (fixer) => {
+					const langAttributeText = getLangAttributeText(lang ?? '', true);
+					return fixer.insertTextAfterRange(
+						tagName === 'script' ? [0, 0] : [sourceCode.text.length, sourceCode.text.length],
+						`<${tagName}${langAttributeText}>\n</${tagName}>\n\n`
+					);
+				}
+			};
+		});
+}
+
+function buildReplaceLangSuggestions(
+	langs: (string | null)[],
+	node: SvelteScriptElement | SvelteStyleElement
+): SuggestionReportDescriptor[] {
+	const tagName = node.name.name;
+	const langAttribute = findAttribute(node, 'lang');
+	const filteredLangs = langs.filter((lang) => lang != null && lang !== '');
+
+	if (filteredLangs.length === 0 && langs.includes(null) && langAttribute !== null) {
+		return [
+			{
+				desc: `Replace a <${tagName}> block with the lang attribute omitted.`,
+				fix: (fixer) => {
+					return fixer.remove({
+						type: langAttribute.type,
+						range: [langAttribute.range[0] - 1, langAttribute.range[1]]
+					});
+				}
+			}
+		];
+	}
+	return filteredLangs.map((lang) => {
+		const langAttributeText = getLangAttributeText(lang ?? '', true);
+		if (langAttribute) {
+			return {
+				desc: `Replace a <${tagName}> block with the lang attribute set to "${lang}".`,
+				fix: (fixer) => {
+					return fixer.replaceText(langAttribute, langAttributeText.trim());
+				}
+			};
+		}
+		return {
+			desc: `Add lang attribute to a <${tagName}> block with the value "${lang}".`,
+			fix: (fixer) => {
+				return fixer.insertTextBeforeRange(
+					[node.startTag.range[0] + tagName.length + 1, 0],
+					langAttributeText
+				);
+			}
+		};
+	});
+}
+
 /**
  * Prints the list of allowed languages, with special handling of the `null` option.
  */
@@ -131,7 +202,7 @@ function prettyPrintLangs(langs: (string | null)[]): string {
 	const hasNull = langs.includes(null);
 	const nonNullLangs = langs.filter((lang) => lang !== null).map((lang) => `"${lang}"`);
 	if (nonNullLangs.length === 0) {
-		// No special behaviour for `hasNull`, because that can never happen.
+		// No special behavior for `hasNull`, because that can never happen.
 		return 'omitted';
 	}
 	const hasNullText = hasNull ? 'either omitted or ' : '';
@@ -139,3 +210,10 @@ function prettyPrintLangs(langs: (string | null)[]): string {
 		nonNullLangs.length === 1 ? nonNullLangs[0] : `one of ${nonNullLangs.join(', ')}`;
 	return hasNullText + nonNullText;
 }
+
+/**
+ * Returns the lang attribute text, with special handling of the `null` lang option with respect to the `prependWhitespace` argument.
+ */
+function getLangAttributeText(lang: string, prependWhitespace: boolean): string {
+	return `${prependWhitespace ? ' ' : ''}lang="${lang}"`;
+}


Test patch:
diff --git a/packages/eslint-plugin-svelte/tests/fixtures/rules/block-lang/invalid/script/javascript/javascript-as-style-lang01-errors.yaml b/packages/eslint-plugin-svelte/tests/fixtures/rules/block-lang/invalid/script/javascript/javascript-as-style-lang01-errors.yaml
index f660dd5..13e22b2 100644
--- a/packages/eslint-plugin-svelte/tests/fixtures/rules/block-lang/invalid/script/javascript/javascript-as-style-lang01-errors.yaml
+++ b/packages/eslint-plugin-svelte/tests/fixtures/rules/block-lang/invalid/script/javascript/javascript-as-style-lang01-errors.yaml
@@ -1,4 +1,9 @@
 - message: The lang attribute of the <script> block should be "javascript".
   line: 1
   column: 1
-  suggestions: null
+  suggestions:
+    - desc: Add lang attribute to a <script> block with the value "javascript".
+      output: |
+        <script lang="javascript"></script>
+
+        <style lang="javascript"></style>
diff --git a/packages/eslint-plugin-svelte/tests/fixtures/rules/block-lang/invalid/script/javascript/js01-errors.yaml b/packages/eslint-plugin-svelte/tests/fixtures/rules/block-lang/invalid/script/javascript/js01-errors.yaml
index f660dd5..08f247b 100644
--- a/packages/eslint-plugin-svelte/tests/fixtures/rules/block-lang/invalid/script/javascript/js01-errors.yaml
+++ b/packages/eslint-plugin-svelte/tests/fixtures/rules/block-lang/invalid/script/javascript/js01-errors.yaml
@@ -1,4 +1,7 @@
 - message: The lang attribute of the <script> block should be "javascript".
   line: 1
   column: 1
-  suggestions: null
+  suggestions:
+    - desc: Replace a <script> block with the lang attribute set to "javascript".
+      output: |
+        <script lang="javascript"></script>
diff --git a/packages/eslint-plugin-svelte/tests/fixtures/rules/block-lang/invalid/script/javascript/null01-errors.yaml b/packages/eslint-plugin-svelte/tests/fixtures/rules/block-lang/invalid/script/javascript/null01-errors.yaml
index f660dd5..dc2fc1a 100644
--- a/packages/eslint-plugin-svelte/tests/fixtures/rules/block-lang/invalid/script/javascript/null01-errors.yaml
+++ b/packages/eslint-plugin-svelte/tests/fixtures/rules/block-lang/invalid/script/javascript/null01-errors.yaml
@@ -1,4 +1,7 @@
 - message: The lang attribute of the <script> block should be "javascript".
   line: 1
   column: 1
-  suggestions: null
+  suggestions:
+    - desc: Add lang attribute to a <script> block with the value "javascript".
+      output: |
+        <script lang="javascript"></script>
diff --git a/packages/eslint-plugin-svelte/tests/fixtures/rules/block-lang/invalid/script/javascript/ts01-errors.yaml b/packages/eslint-plugin-svelte/tests/fixtures/rules/block-lang/invalid/script/javascript/ts01-errors.yaml
index f660dd5..08f247b 100644
--- a/packages/eslint-plugin-svelte/tests/fixtures/rules/block-lang/invalid/script/javascript/ts01-errors.yaml
+++ b/packages/eslint-plugin-svelte/tests/fixtures/rules/block-lang/invalid/script/javascript/ts01-errors.yaml
@@ -1,4 +1,7 @@
 - message: The lang attribute of the <script> block should be "javascript".
   line: 1
   column: 1
-  suggestions: null
+  suggestions:
+    - desc: Replace a <script> block with the lang attribute set to "javascript".
+      output: |
+        <script lang="javascript"></script>
diff --git a/packages/eslint-plugin-svelte/tests/fixtures/rules/block-lang/invalid/script/javascript/typescript01-errors.yaml b/packages/eslint-plugin-svelte/tests/fixtures/rules/block-lang/invalid/script/javascript/typescript01-errors.yaml
index f660dd5..08f247b 100644
--- a/packages/eslint-plugin-svelte/tests/fixtures/rules/block-lang/invalid/script/javascript/typescript01-errors.yaml
+++ b/packages/eslint-plugin-svelte/tests/fixtures/rules/block-lang/invalid/script/javascript/typescript01-errors.yaml
@@ -1,4 +1,7 @@
 - message: The lang attribute of the <script> block should be "javascript".
   line: 1
   column: 1
-  suggestions: null
+  suggestions:
+    - desc: Replace a <script> block with the lang attribute set to "javascript".
+      output: |
+        <script lang="javascript"></script>
diff --git a/packages/eslint-plugin-svelte/tests/fixtures/rules/block-lang/invalid/script/js/javascript01-errors.yaml b/packages/eslint-plugin-svelte/tests/fixtures/rules/block-lang/invalid/script/js/javascript01-errors.yaml
index c49ef5c..b7100ca 100644
--- a/packages/eslint-plugin-svelte/tests/fixtures/rules/block-lang/invalid/script/js/javascript01-errors.yaml
+++ b/packages/eslint-plugin-svelte/tests/fixtures/rules/block-lang/invalid/script/js/javascript01-errors.yaml
@@ -1,4 +1,7 @@
 - message: The lang attribute of the <script> block should be "js".
   line: 1
   column: 1
-  suggestions: null
+  suggestions:
+    - desc: Replace a <script> block with the lang attribute set to "js".
+      output: |
+        <script lang="js"></script>
diff --git a/packages/eslint-plugin-svelte/tests/fixtures/rules/block-lang/invalid/script/js/js-as-style-lang01-errors.yaml b/packages/eslint-plugin-svelte/tests/fixtures/rules/block-lang/invalid/script/js/js-as-style-lang01-errors.yaml
index c49ef5c..8a4b033 100644
--- a/packages/eslint-plugin-svelte/tests/fixtures/rules/block-lang/invalid/script/js/js-as-style-lang01-errors.yaml
+++ b/packages/eslint-plugin-svelte/tests/fixtures/rules/block-lang/invalid/script/js/js-as-style-lang01-errors.yaml
@@ -1,4 +1,9 @@
 - message: The lang attribute of the <script> block should be "js".
   line: 1
   column: 1
-  suggestions: null
+  suggestions:
+    - desc: Add lang attribute to a <script> block with the value "js".
+      output: |
+        <script lang="js"></script>
+
+        <style lang="js"></style>
diff --git a/packages/eslint-plugin-svelte/tests/fixtures/rules/block-lang/invalid/script/js/null01-errors.yaml b/packages/eslint-plugin-svelte/tests/fixtures/rules/block-lang/invalid/script/js/null01-errors.yaml
index c49ef5c..21d9f35 100644
--- a/packages/eslint-plugin-svelte/tests/fixtures/rules/block-lang/invalid/script/js/null01-errors.yaml
+++ b/packages/eslint-plugin-svelte/tests/fixtures/rules/block-lang/invalid/script/js/null01-errors.yaml
@@ -1,4 +1,7 @@
 - message: The lang attribute of the <script> block should be "js".
   line: 1
   column: 1
-  suggestions: null
+  suggestions:
+    - desc: Add lang attribute to a <script> block with the value "js".
+      output: |
+        <script lang="js"></script>
diff --git a/packages/eslint-plugin-svelte/tests/fixtures/rules/block-lang/invalid/script/js/ts01-errors.yaml b/packages/eslint-plugin-svelte/tests/fixtures/rules/block-lang/invalid/script/js/ts01-errors.yaml
index c49ef5c..b7100ca 100644
--- a/packages/eslint-plugin-svelte/tests/fixtures/rules/block-lang/invalid/script/js/ts01-errors.yaml
+++ b/packages/eslint-plugin-svelte/tests/fixtures/rules/block-lang/invalid/script/js/ts01-errors.yaml
@@ -1,4 +1,7 @@
 - message: The lang attribute of the <script> block should be "js".
   line: 1
   column: 1
-  suggestions: null
+  suggestions:
+    - desc: Replace a <script> block with the lang attribute set to "js".
+      output: |
+        <script lang="js"></script>
diff --git a/packages/eslint-plugin-svelte/tests/fixtures/rules/block-lang/invalid/script/js/typescript01-errors.yaml b/packages/eslint-plugin-svelte/tests/fixtures/rules/block-lang/invalid/script/js/typescript01-errors.yaml
index c49ef5c..b7100ca 100644
--- a/packages/eslint-plugin-svelte/tests/fixtures/rules/block-lang/invalid/script/js/typescript01-errors.yaml
+++ b/packages/eslint-plugin-svelte/tests/fixtures/rules/block-lang/invalid/script/js/typescript01-errors.yaml
@@ -1,4 +1,7 @@
 - message: The lang attribute of the <script> block should be "js".
   line: 1
   column: 1
-  suggestions: null
+  suggestions:
+    - desc: Replace a <script> block with the lang attribute set to "js".
+      output: |
+        <script lang="js"></script>
diff --git a/packages/eslint-plugin-svelte/tests/fixtures/rules/block-lang/invalid/script/module-context/javascript01-errors.yaml b/packages/eslint-plugin-svelte/tests/fixtures/rules/block-lang/invalid/script/module-context/javascript01-errors.yaml
index b42a142..e94782c 100644
--- a/packages/eslint-plugin-svelte/tests/fixtures/rules/block-lang/invalid/script/module-context/javascript01-errors.yaml
+++ b/packages/eslint-plugin-svelte/tests/fixtures/rules/block-lang/invalid/script/module-context/javascript01-errors.yaml
@@ -1,4 +1,9 @@
 - message: The lang attribute of the <script> block should be "ts".
   line: 1
   column: 1
-  suggestions: null
+  suggestions:
+    - desc: Replace a <script> block with the lang attribute set to "ts".
+      output: |
+        <script context="module" lang="ts"></script>
+
+        <script lang="ts"></script>
diff --git a/packages/eslint-plugin-svelte/tests/fixtures/rules/block-lang/invalid/script/module-context/js01-errors.yaml b/packages/eslint-plugin-svelte/tests/fixtures/rules/block-lang/invalid/script/module-context/js01-errors.yaml
index b42a142..e94782c 100644
--- a/packages/eslint-plugin-svelte/tests/fixtures/rules/block-lang/invalid/script/module-context/js01-errors.yaml
+++ b/packages/eslint-plugin-svelte/tests/fixtures/rules/block-lang/invalid/script/module-context/js01-errors.yaml
@@ -1,4 +1,9 @@
 - message: The lang attribute of the <script> block should be "ts".
   line: 1
   column: 1
-  suggestions: null
+  suggestions:
+    - desc: Replace a <script> block with the lang attribute set to "ts".
+      output: |
+        <script context="module" lang="ts"></script>
+
+        <script lang="ts"></script>
diff --git a/packages/eslint-plugin-svelte/tests/fixtures/rules/block-lang/invalid/script/module-context/null01-errors.yaml b/packages/eslint-plugin-svelte/tests/fixtures/rules/block-lang/invalid/script/module-context/null01-errors.yaml
index b42a142..55c31fb 100644
--- a/packages/eslint-plugin-svelte/tests/fixtures/rules/block-lang/invalid/script/module-context/null01-errors.yaml
+++ b/packages/eslint-plugin-svelte/tests/fixtures/rules/block-lang/invalid/script/module-context/null01-errors.yaml
@@ -1,4 +1,9 @@
 - message: The lang attribute of the <script> block should be "ts".
   line: 1
   column: 1
-  suggestions: null
+  suggestions:
+    - desc: Add lang attribute to a <script> block with the value "ts".
+      output: |
+        <script lang="ts" context="module"></script>
+
+        <script lang="ts"></script>
diff --git a/packages/eslint-plugin-svelte/tests/fixtures/rules/block-lang/invalid/script/module-context/ts-as-style-lang01-errors.yaml b/packages/eslint-plugin-svelte/tests/fixtures/rules/block-lang/invalid/script/module-context/ts-as-style-lang01-errors.yaml
index b42a142..286fc43 100644
--- a/packages/eslint-plugin-svelte/tests/fixtures/rules/block-lang/invalid/script/module-context/ts-as-style-lang01-errors.yaml
+++ b/packages/eslint-plugin-svelte/tests/fixtures/rules/block-lang/invalid/script/module-context/ts-as-style-lang01-errors.yaml
@@ -1,4 +1,11 @@
 - message: The lang attribute of the <script> block should be "ts".
   line: 1
   column: 1
-  suggestions: null
+  suggestions:
+    - desc: Add lang attribute to a <script> block with the value "ts".
+      output: |
+        <script lang="ts" context="module"></script>
+
+        <script lang="ts"></script>
+
+        <style lang="ts"></style>
diff --git a/packages/eslint-plugin-svelte/tests/fixtures/rules/block-lang/invalid/script/module-context/typescript01-errors.yaml b/packages/eslint-plugin-svelte/tests/fixtures/rules/block-lang/invalid/script/module-context/typescript01-errors.yaml
index b42a142..e94782c 100644
--- a/packages/eslint-plugin-svelte/tests/fixtures/rules/block-lang/invalid/script/module-context/typescript01-errors.yaml
+++ b/packages/eslint-plugin-svelte/tests/fixtures/rules/block-lang/invalid/script/module-context/typescript01-errors.yaml
@@ -1,4 +1,9 @@
 - message: The lang attribute of the <script> block should be "ts".
   line: 1
   column: 1
-  suggestions: null
+  suggestions:
+    - desc: Replace a <script> block with the lang attribute set to "ts".
+      output: |
+        <script context="module" lang="ts"></script>
+
+        <script lang="ts"></script>
diff --git a/packages/eslint-plugin-svelte/tests/fixtures/rules/block-lang/invalid/script/multiple/javascript01-errors.yaml b/packages/eslint-plugin-svelte/tests/fixtures/rules/block-lang/invalid/script/multiple/javascript01-errors.yaml
index 90ac8a7..3d6c977 100644
--- a/packages/eslint-plugin-svelte/tests/fixtures/rules/block-lang/invalid/script/multiple/javascript01-errors.yaml
+++ b/packages/eslint-plugin-svelte/tests/fixtures/rules/block-lang/invalid/script/multiple/javascript01-errors.yaml
@@ -2,4 +2,10 @@
     one of "ts", "typescript".
   line: 1
   column: 1
-  suggestions: null
+  suggestions:
+    - desc: Replace a <script> block with the lang attribute set to "ts".
+      output: |
+        <script lang="ts"></script>
+    - desc: Replace a <script> block with the lang attribute set to "typescript".
+      output: |
+        <script lang="typescript"></script>
diff --git a/packages/eslint-plugin-svelte/tests/fixtures/rules/block-lang/invalid/script/multiple/js01-errors.yaml b/packages/eslint-plugin-svelte/tests/fixtures/rules/block-lang/invalid/script/multiple/js01-errors.yaml
index 90ac8a7..3d6c977 100644
--- a/packages/eslint-plugin-svelte/tests/fixtures/rules/block-lang/invalid/script/multiple/js01-errors.yaml
+++ b/packages/eslint-plugin-svelte/tests/fixtures/rules/block-lang/invalid/script/multiple/js01-errors.yaml
@@ -2,4 +2,10 @@
     one of "ts", "typescript".
   line: 1
   column: 1
-  suggestions: null
+  suggestions:
+    - desc: Replace a <script> block with the lang attribute set to "ts".
+      output: |
+        <script lang="ts"></script>
+    - desc: Replace a <script> block with the lang attribute set to "typescript".
+      output: |
+        <script lang="typescript"></script>
diff --git a/packages/eslint-plugin-svelte/tests/fixtures/rules/block-lang/invalid/script/multiple/null-as-style-lang01-errors.yaml b/packages/eslint-plugin-svelte/tests/fixtures/rules/block-lang/invalid/script/multiple/null-as-style-lang01-errors.yaml
index 90ac8a7..b603304 100644
--- a/packages/eslint-plugin-svelte/tests/fixtures/rules/block-lang/invalid/script/multiple/null-as-style-lang01-errors.yaml
+++ b/packages/eslint-plugin-svelte/tests/fixtures/rules/block-lang/invalid/script/multiple/null-as-style-lang01-errors.yaml
@@ -2,4 +2,14 @@
     one of "ts", "typescript".
   line: 1
   column: 1
-  suggestions: null
+  suggestions:
+    - desc: Replace a <script> block with the lang attribute set to "ts".
+      output: |
+        <script lang="ts"></script>
+
+        <style></style>
+    - desc: Replace a <script> block with the lang attribute set to "typescript".
+      output: |
+        <script lang="typescript"></script>
+
+        <style></style>
diff --git a/packages/eslint-plugin-svelte/tests/fixtures/rules/block-lang/invalid/script/multiple/ts-as-style-lang01-errors.yaml b/packages/eslint-plugin-svelte/tests/fixtures/rules/block-lang/invalid/script/multiple/ts-as-style-lang01-errors.yaml
index 90ac8a7..3d88a9d 100644
--- a/packages/eslint-plugin-svelte/tests/fixtures/rules/block-lang/invalid/script/multiple/ts-as-style-lang01-errors.yaml
+++ b/packages/eslint-plugin-svelte/tests/fixtures/rules/block-lang/invalid/script/multiple/ts-as-style-lang01-errors.yaml
@@ -2,4 +2,14 @@
     one of "ts", "typescript".
   line: 1
   column: 1
-  suggestions: null
+  suggestions:
+    - desc: Replace a <script> block with the lang attribute set to "ts".
+      output: |
+        <script lang="ts"></script>
+
+        <style lang="ts"></style>
+    - desc: Replace a <script> block with the lang attribute set to "typescript".
+      output: |
+        <script lang="typescript"></script>
+
+        <style lang="ts"></style>
diff --git a/packages/eslint-plugin-svelte/tests/fixtures/rules/block-lang/invalid/script/multiple/typescript-as-style-lang01-errors.yaml b/packages/eslint-plugin-svelte/tests/fixtures/rules/block-lang/invalid/script/multiple/typescript-as-style-lang01-errors.yaml
index 90ac8a7..c70d428 100644
--- a/packages/eslint-plugin-svelte/tests/fixtures/rules/block-lang/invalid/script/multiple/typescript-as-style-lang01-errors.yaml
+++ b/packages/eslint-plugin-svelte/tests/fixtures/rules/block-lang/invalid/script/multiple/typescript-as-style-lang01-errors.yaml
@@ -2,4 +2,14 @@
     one of "ts", "typescript".
   line: 1
   column: 1
-  suggestions: null
+  suggestions:
+    - desc: Replace a <script> block with the lang attribute set to "ts".
+      output: |
+        <script lang="ts"></script>
+
+        <style lang="typescript"></style>
+    - desc: Replace a <script> block with the lang attribute set to "typescript".
+      output: |
+        <script lang="typescript"></script>
+
+        <style lang="typescript"></style>
diff --git a/packages/eslint-plugin-svelte/tests/fixtures/rules/block-lang/invalid/script/null/javascript01-errors.yaml b/packages/eslint-plugin-svelte/tests/fixtures/rules/block-lang/invalid/script/null/javascript01-errors.yaml
index b2d700c..48a4976 100644
--- a/packages/eslint-plugin-svelte/tests/fixtures/rules/block-lang/invalid/script/null/javascript01-errors.yaml
+++ b/packages/eslint-plugin-svelte/tests/fixtures/rules/block-lang/invalid/script/null/javascript01-errors.yaml
@@ -1,4 +1,7 @@
 - message: The lang attribute of the <script> block should be omitted.
   line: 1
   column: 1
-  suggestions: null
+  suggestions:
+    - desc: Replace a <script> block with the lang attribute omitted.
+      output: |
+        <script></script>
diff --git a/packages/eslint-plugin-svelte/tests/fixtures/rules/block-lang/invalid/script/null/js01-errors.yaml b/packages/eslint-plugin-svelte/tests/fixtures/rules/block-lang/invalid/script/null/js01-errors.yaml
index b2d700c..48a4976 100644
--- a/packages/eslint-plugin-svelte/tests/fixtures/rules/block-lang/invalid/script/null/js01-errors.yaml
+++ b/packages/eslint-plugin-svelte/tests/fixtures/rules/block-lang/invalid/script/null/js01-errors.yaml
@@ -1,4 +1,7 @@
 - message: The lang attribute of the <script> block should be omitted.
   line: 1
   column: 1
-  suggestions: null
+  suggestions:
+    - desc: Replace a <script> block with the lang attribute omitted.
+      output: |
+        <script></script>
diff --git a/packages/eslint-plugin-svelte/tests/fixtures/rules/block-lang/invalid/script/null/null-as-style-lang01-errors.yaml b/packages/eslint-plugin-svelte/tests/fixtures/rules/block-lang/invalid/script/null/null-as-style-lang01-errors.yaml
index b2d700c..a53325c 100644
--- a/packages/eslint-plugin-svelte/tests/fixtures/rules/block-lang/invalid/script/null/null-as-style-lang01-errors.yaml
+++ b/packages/eslint-plugin-svelte/tests/fixtures/rules/block-lang/invalid/script/null/null-as-style-lang01-errors.yaml
@@ -1,4 +1,9 @@
 - message: The lang attribute of the <script> block should be omitted.
   line: 1
   column: 1
-  suggestions: null
+  suggestions:
+    - desc: Replace a <script> block with the lang attribute omitted.
+      output: |
+        <script></script>
+
+        <style></style>
diff --git a/packages/eslint-plugin-svelte/tests/fixtures/rules/block-lang/invalid/script/null/ts01-errors.yaml b/packages/eslint-plugin-svelte/tests/fixtures/rules/block-lang/invalid/script/null/ts01-errors.yaml
index b2d700c..48a4976 100644
--- a/packages/eslint-plugin-svelte/tests/fixtures/rules/block-lang/invalid/script/null/ts01-errors.yaml
+++ b/packages/eslint-plugin-svelte/tests/fixtures/rules/block-lang/invalid/script/null/ts01-errors.yaml
@@ -1,4 +1,7 @@
 - message: The lang attribute of the <script> block should be omitted.
   line: 1
   column: 1
-  suggestions: null
+  suggestions:
+    - desc: Replace a <script> block with the lang attribute omitted.
+      output: |
+        <script></script>
diff --git a/packages/eslint-plugin-svelte/tests/fixtures/rules/block-lang/invalid/script/null/typescript01-errors.yaml b/packages/eslint-plugin-svelte/tests/fixtures/rules/block-lang/invalid/script/null/typescript01-errors.yaml
index b2d700c..48a4976 100644
--- a/packages/eslint-plugin-svelte/tests/fixtures/rules/block-lang/invalid/script/null/typescript01-errors.yaml
+++ b/packages/eslint-plugin-svelte/tests/fixtures/rules/block-lang/invalid/script/null/typescript01-errors.yaml
@@ -1,4 +1,7 @@
 - message: The lang attribute of the <script> block should be omitted.
   line: 1
   column: 1
-  suggestions: null
+  suggestions:
+    - desc: Replace a <script> block with the lang attribute omitted.
+      output: |
+        <script></script>
diff --git a/packages/eslint-plugin-svelte/tests/fixtures/rules/block-lang/invalid/script/shorthand/javascript01-errors.yaml b/packages/eslint-plugin-svelte/tests/fixtures/rules/block-lang/invalid/script/shorthand/javascript01-errors.yaml
index b42a142..b311301 100644
--- a/packages/eslint-plugin-svelte/tests/fixtures/rules/block-lang/invalid/script/shorthand/javascript01-errors.yaml
+++ b/packages/eslint-plugin-svelte/tests/fixtures/rules/block-lang/invalid/script/shorthand/javascript01-errors.yaml
@@ -1,4 +1,7 @@
 - message: The lang attribute of the <script> block should be "ts".
   line: 1
   column: 1
-  suggestions: null
+  suggestions:
+    - desc: Replace a <script> block with the lang attribute set to "ts".
+      output: |
+        <script lang="ts"></script>
diff --git a/packages/eslint-plugin-svelte/tests/fixtures/rules/block-lang/invalid/script/shorthand/js01-errors.yaml b/packages/eslint-plugin-svelte/tests/fixtures/rules/block-lang/invalid/script/shorthand/js01-errors.yaml
index b42a142..b311301 100644
--- a/packages/eslint-plugin-svelte/tests/fixtures/rules/block-lang/invalid/script/shorthand/js01-errors.yaml
+++ b/packages/eslint-plugin-svelte/tests/fixtures/rules/block-lang/invalid/script/shorthand/js01-errors.yaml
@@ -1,4 +1,7 @@
 - message: The lang attribute of the <script> block should be "ts".
   line: 1
   column: 1
-  suggestions: null
+  suggestions:
+    - desc: Replace a <script> block with the lang attribute set to "ts".
+      output: |
+        <script lang="ts"></script>
diff --git a/packages/eslint-plugin-svelte/tests/fixtures/rules/block-lang/invalid/script/shorthand/null01-errors.yaml b/packages/eslint-plugin-svelte/tests/fixtures/rules/block-lang/invalid/script/shorthand/null01-errors.yaml
index b42a142..36748af 100644
--- a/packages/eslint-plugin-svelte/tests/fixtures/rules/block-lang/invalid/script/shorthand/null01-errors.yaml
+++ b/packages/eslint-plugin-svelte/tests/fixtures/rules/block-lang/invalid/script/shorthand/null01-errors.yaml
@@ -1,4 +1,7 @@
 - message: The lang attribute of the <script> block should be "ts".
   line: 1
   column: 1
-  suggestions: null
+  suggestions:
+    - desc: Add lang attribute to a <script> block with the value "ts".
+      output: |
+        <script lang="ts"></script>
diff --git a/packages/eslint-plugin-svelte/tests/fixtures/rules/block-lang/invalid/script/shorthand/ts-as-style-lang01-errors.yaml b/packages/eslint-plugin-svelte/tests/fixtures/rules/block-lang/invalid/script/shorthand/ts-as-style-lang01-errors.yaml
index b42a142..f7b4dea 100644
--- a/packages/eslint-plugin-svelte/tests/fixtures/rules/block-lang/invalid/script/shorthand/ts-as-style-lang01-errors.yaml
+++ b/packages/eslint-plugin-svelte/tests/fixtures/rules/block-lang/invalid/script/shorthand/ts-as-style-lang01-errors.yaml
@@ -1,4 +1,9 @@
 - message: The lang attribute of the <script> block should be "ts".
   line: 1
   column: 1
-  suggestions: null
+  suggestions:
+    - desc: Add lang attribute to a <script> block with the value "ts".
+      output: |
+        <script lang="ts"></script>
+
+        <style lang="ts"></style>
diff --git a/packages/eslint-plugin-svelte/tests/fixtures/rules/block-lang/invalid/script/shorthand/typescript01-errors.yaml b/packages/eslint-plugin-svelte/tests/fixtures/rules/block-lang/invalid/script/shorthand/typescript01-errors.yaml
index b42a142..b311301 100644
--- a/packages/eslint-plugin-svelte/tests/fixtures/rules/block-lang/invalid/script/shorthand/typescript01-errors.yaml
+++ b/packages/eslint-plugin-svelte/tests/fixtures/rules/block-lang/invalid/script/shorthand/typescript01-errors.yaml
@@ -1,4 +1,7 @@
 - message: The lang attribute of the <script> block should be "ts".
   line: 1
   column: 1
-  suggestions: null
+  suggestions:
+    - desc: Replace a <script> block with the lang attribute set to "ts".
+      output: |
+        <script lang="ts"></script>
diff --git a/packages/eslint-plugin-svelte/tests/fixtures/rules/block-lang/invalid/script/ts/javascript01-errors.yaml b/packages/eslint-plugin-svelte/tests/fixtures/rules/block-lang/invalid/script/ts/javascript01-errors.yaml
index b42a142..b311301 100644
--- a/packages/eslint-plugin-svelte/tests/fixtures/rules/block-lang/invalid/script/ts/javascript01-errors.yaml
+++ b/packages/eslint-plugin-svelte/tests/fixtures/rules/block-lang/invalid/script/ts/javascript01-errors.yaml
@@ -1,4 +1,7 @@
 - message: The lang attribute of the <script> block should be "ts".
   line: 1
   column: 1
-  suggestions: null
+  suggestions:
+    - desc: Replace a <script> block with the lang attribute set to "ts".
+      output: |
+        <script lang="ts"></script>
diff --git a/packages/eslint-plugin-svelte/tests/fixtures/rules/block-lang/invalid/script/ts/js01-errors.yaml b/packages/eslint-plugin-svelte/tests/fixtures/rules/block-lang/invalid/script/ts/js01-errors.yaml
index b42a142..b311301 100644
--- a/packages/eslint-plugin-svelte/tests/fixtures/rules/block-lang/invalid/script/ts/js01-errors.yaml
+++ b/packages/eslint-plugin-svelte/tests/fixtures/rules/block-lang/invalid/script/ts/js01-errors.yaml
@@ -1,4 +1,7 @@
 - message: The lang attribute of the <script> block should be "ts".
   line: 1
   column: 1
-  suggestions: null
+  suggestions:
+    - desc: Replace a <script> block with the lang attribute set to "ts".
+      output: |
+        <script lang="ts"></script>
diff --git a/packages/eslint-plugin-svelte/tests/fixtures/rules/block-lang/invalid/script/ts/null01-errors.yaml b/packages/eslint-plugin-svelte/tests/fixtures/rules/block-lang/invalid/script/ts/null01-errors.yaml
index b42a142..36748af 100644
--- a/packages/eslint-plugin-svelte/tests/fixtures/rules/block-lang/invalid/script/ts/null01-errors.yaml
+++ b/packages/eslint-plugin-svelte/tests/fixtures/rules/block-lang/invalid/script/ts/null01-errors.yaml
@@ -1,4 +1,7 @@
 - message: The lang attribute of the <script> block should be "ts".
   line: 1
   column: 1
-  suggestions: null
+  suggestions:
+    - desc: Add lang attribute to a <script> block with the value "ts".
+      output: |
+        <script lang="ts"></script>
diff --git a/packages/eslint-plugin-svelte/tests/fixtures/rules/block-lang/invalid/script/ts/ts-as-style-lang01-errors.yaml b/packages/eslint-plugin-svelte/tests/fixtures/rules/block-lang/invalid/script/ts/ts-as-style-lang01-errors.yaml
index b42a142..f7b4dea 100644
--- a/packages/eslint-plugin-svelte/tests/fixtures/rules/block-lang/invalid/script/ts/ts-as-style-lang01-errors.yaml
+++ b/packages/eslint-plugin-svelte/tests/fixtures/rules/block-lang/invalid/script/ts/ts-as-style-lang01-errors.yaml
@@ -1,4 +1,9 @@
 - message: The lang attribute of the <script> block should be "ts".
   line: 1
   column: 1
-  suggestions: null
+  suggestions:
+    - desc: Add lang attribute to a <script> block with the value "ts".
+      output: |
+        <script lang="ts"></script>
+
+        <style lang="ts"></style>
diff --git a/packages/eslint-plugin-svelte/tests/fixtures/rules/block-lang/invalid/script/ts/typescript01-errors.yaml b/packages/eslint-plugin-svelte/tests/fixtures/rules/block-lang/invalid/script/ts/typescript01-errors.yaml
index b42a142..b311301 100644
--- a/packages/eslint-plugin-svelte/tests/fixtures/rules/block-lang/invalid/script/ts/typescript01-errors.yaml
+++ b/packages/eslint-plugin-svelte/tests/fixtures/rules/block-lang/invalid/script/ts/typescript01-errors.yaml
@@ -1,4 +1,7 @@
 - message: The lang attribute of the <script> block should be "ts".
   line: 1
   column: 1
-  suggestions: null
+  suggestions:
+    - desc: Replace a <script> block with the lang attribute set to "ts".
+      output: |
+        <script lang="ts"></script>
diff --git a/packages/eslint-plugin-svelte/tests/fixtures/rules/block-lang/invalid/script/typescript/javascript01-errors.yaml b/packages/eslint-plugin-svelte/tests/fixtures/rules/block-lang/invalid/script/typescript/javascript01-errors.yaml
index a16e8f3..009d419 100644
--- a/packages/eslint-plugin-svelte/tests/fixtures/rules/block-lang/invalid/script/typescript/javascript01-errors.yaml
+++ b/packages/eslint-plugin-svelte/tests/fixtures/rules/block-lang/invalid/script/typescript/javascript01-errors.yaml
@@ -1,4 +1,7 @@
 - message: The lang attribute of the <script> block should be "typescript".
   line: 1
   column: 1
-  suggestions: null
+  suggestions:
+    - desc: Replace a <script> block with the lang attribute set to "typescript".
+      output: |
+        <script lang="typescript"></script>
diff --git a/packages/eslint-plugin-svelte/tests/fixtures/rules/block-lang/invalid/script/typescript/js01-errors.yaml b/packages/eslint-plugin-svelte/tests/fixtures/rules/block-lang/invalid/script/typescript/js01-errors.yaml
index a16e8f3..009d419 100644
--- a/packages/eslint-plugin-svelte/tests/fixtures/rules/block-lang/invalid/script/typescript/js01-errors.yaml
+++ b/packages/eslint-plugin-svelte/tests/fixtures/rules/block-lang/invalid/script/typescript/js01-errors.yaml
@@ -1,4 +1,7 @@
 - message: The lang attribute of the <script> block should be "typescript".
   line: 1
   column: 1
-  suggestions: null
+  suggestions:
+    - desc: Replace a <script> block with the lang attribute set to "typescript".
+      output: |
+        <script lang="typescript"></script>
diff --git a/packages/eslint-plugin-svelte/tests/fixtures/rules/block-lang/invalid/script/typescript/null01-errors.yaml b/packages/eslint-plugin-svelte/tests/fixtures/rules/block-lang/invalid/script/typescript/null01-errors.yaml
index a16e8f3..7dd6e10 100644
--- a/packages/eslint-plugin-svelte/tests/fixtures/rules/block-lang/invalid/script/typescript/null01-errors.yaml
+++ b/packages/eslint-plugin-svelte/tests/fixtures/rules/block-lang/invalid/script/typescript/null01-errors.yaml
@@ -1,4 +1,7 @@
 - message: The lang attribute of the <script> block should be "typescript".
   line: 1
   column: 1
-  suggestions: null
+  suggestions:
+    - desc: Add lang attribute to a <script> block with the value "typescript".
+      output: |
+        <script lang="typescript"></script>
diff --git a/packages/eslint-plugin-svelte/tests/fixtures/rules/block-lang/invalid/script/typescript/ts01-errors.yaml b/packages/eslint-plugin-svelte/tests/fixtures/rules/block-lang/invalid/script/typescript/ts01-errors.yaml
index a16e8f3..009d419 100644
--- a/packages/eslint-plugin-svelte/tests/fixtures/rules/block-lang/invalid/script/typescript/ts01-errors.yaml
+++ b/packages/eslint-plugin-svelte/tests/fixtures/rules/block-lang/invalid/script/typescript/ts01-errors.yaml
@@ -1,4 +1,7 @@
 - message: The lang attribute of the <script> block should be "typescript".
   line: 1
   column: 1
-  suggestions: null
+  suggestions:
+    - desc: Replace a <script> block with the lang attribute set to "typescript".
+      output: |
+        <script lang="typescript"></script>
diff --git a/packages/eslint-plugin-svelte/tests/fixtures/rules/block-lang/invalid/script/typescript/typescript-as-style-lang01-errors.yaml b/packages/eslint-plugin-svelte/tests/fixtures/rules/block-lang/invalid/script/typescript/typescript-as-style-lang01-errors.yaml
index a16e8f3..548cee2 100644
--- a/packages/eslint-plugin-svelte/tests/fixtures/rules/block-lang/invalid/script/typescript/typescript-as-style-lang01-errors.yaml
+++ b/packages/eslint-plugin-svelte/tests/fixtures/rules/block-lang/invalid/script/typescript/typescript-as-style-lang01-errors.yaml
@@ -1,4 +1,9 @@
 - message: The lang attribute of the <script> block should be "typescript".
   line: 1
   column: 1
-  suggestions: null
+  suggestions:
+    - desc: Add lang attribute to a <script> block with the value "typescript".
+      output: |
+        <script lang="typescript"></script>
+
+        <style lang="typescript"></style>
diff --git a/packages/eslint-plugin-svelte/tests/fixtures/rules/block-lang/invalid/style/null/null-as-script-lang01-errors.yaml b/packages/eslint-plugin-svelte/tests/fixtures/rules/block-lang/invalid/style/null/null-as-script-lang01-errors.yaml
index e476b42..7455fb1 100644
--- a/packages/eslint-plugin-svelte/tests/fixtures/rules/block-lang/invalid/style/null/null-as-script-lang01-errors.yaml
+++ b/packages/eslint-plugin-svelte/tests/fixtures/rules/block-lang/invalid/style/null/null-as-script-lang01-errors.yaml
@@ -1,4 +1,9 @@
 - message: The lang attribute of the <style> block should be omitted.
   line: 3
   column: 1
-  suggestions: null
+  suggestions:
+    - desc: Replace a <style> block with the lang attribute omitted.
+      output: |
+        <script></script>
+
+        <style></style>
diff --git a/packages/eslint-plugin-svelte/tests/fixtures/rules/block-lang/invalid/style/null/sass01-errors.yaml b/packages/eslint-plugin-svelte/tests/fixtures/rules/block-lang/invalid/style/null/sass01-errors.yaml
index 3685a4a..6766691 100644
--- a/packages/eslint-plugin-svelte/tests/fixtures/rules/block-lang/invalid/style/null/sass01-errors.yaml
+++ b/packages/eslint-plugin-svelte/tests/fixtures/rules/block-lang/invalid/style/null/sass01-errors.yaml
@@ -1,4 +1,9 @@
 - message: The lang attribute of the <style> block should be omitted.
   line: 1
   column: 1
-  suggestions: null
+  suggestions:
+    - desc: Replace a <style> block with the lang attribute omitted.
+      output: |
+        <style>
+
+        </style>
diff --git a/packages/eslint-plugin-svelte/tests/fixtures/rules/block-lang/invalid/style/null/scss01-errors.yaml b/packages/eslint-plugin-svelte/tests/fixtures/rules/block-lang/invalid/style/null/scss01-errors.yaml
index 3685a4a..691a404 100644
--- a/packages/eslint-plugin-svelte/tests/fixtures/rules/block-lang/invalid/style/null/scss01-errors.yaml
+++ b/packages/eslint-plugin-svelte/tests/fixtures/rules/block-lang/invalid/style/null/scss01-errors.yaml
@@ -1,4 +1,7 @@
 - message: The lang attribute of the <style> block should be omitted.
   line: 1
   column: 1
-  suggestions: null
+  suggestions:
+    - desc: Replace a <style> block with the lang attribute omitted.
+      output: |
+        <style></style>
diff --git a/packages/eslint-plugin-svelte/tests/fixtures/rules/block-lang/invalid/style/sass/null01-errors.yaml b/packages/eslint-plugin-svelte/tests/fixtures/rules/block-lang/invalid/style/sass/null01-errors.yaml
index 9eec703..5721fb5 100644
--- a/packages/eslint-plugin-svelte/tests/fixtures/rules/block-lang/invalid/style/sass/null01-errors.yaml
+++ b/packages/eslint-plugin-svelte/tests/fixtures/rules/block-lang/invalid/style/sass/null01-errors.yaml
@@ -1,4 +1,7 @@
 - message: The lang attribute of the <style> block should be "sass".
   line: 1
   column: 1
-  suggestions: null
+  suggestions:
+    - desc: Add lang attribute to a <style> block with the value "sass".
+      output: |
+        <style lang="sass"></style>
diff --git a/packages/eslint-plugin-svelte/tests/fixtures/rules/block-lang/invalid/style/sass/sass-as-script-lang01-errors.yaml b/packages/eslint-plugin-svelte/tests/fixtures/rules/block-lang/invalid/style/sass/sass-as-script-lang01-errors.yaml
index 3cd86cb..d08f517 100644
--- a/packages/eslint-plugin-svelte/tests/fixtures/rules/block-lang/invalid/style/sass/sass-as-script-lang01-errors.yaml
+++ b/packages/eslint-plugin-svelte/tests/fixtures/rules/block-lang/invalid/style/sass/sass-as-script-lang01-errors.yaml
@@ -1,4 +1,11 @@
 - message: The lang attribute of the <style> block should be "sass".
   line: 5
   column: 1
-  suggestions: null
+  suggestions:
+    - desc: Add lang attribute to a <style> block with the value "sass".
+      output: |
+        <script lang="sass">
+
+        </script>
+
+        <style lang="sass"></style>
diff --git a/packages/eslint-plugin-svelte/tests/fixtures/rules/block-lang/invalid/style/sass/scss01-errors.yaml b/packages/eslint-plugin-svelte/tests/fixtures/rules/block-lang/invalid/style/sass/scss01-errors.yaml
index 9eec703..e4f5b57 100644
--- a/packages/eslint-plugin-svelte/tests/fixtures/rules/block-lang/invalid/style/sass/scss01-errors.yaml
+++ b/packages/eslint-plugin-svelte/tests/fixtures/rules/block-lang/invalid/style/sass/scss01-errors.yaml
@@ -1,4 +1,7 @@
 - message: The lang attribute of the <style> block should be "sass".
   line: 1
   column: 1
-  suggestions: null
+  suggestions:
+    - desc: Replace a <style> block with the lang attribute set to "sass".
+      output: |
+        <style lang="sass"></style>
diff --git a/packages/eslint-plugin-svelte/tests/fixtures/rules/block-lang/invalid/style/scss/null01-errors.yaml b/packages/eslint-plugin-svelte/tests/fixtures/rules/block-lang/invalid/style/scss/null01-errors.yaml
index 7663cab..2d800e2 100644
--- a/packages/eslint-plugin-svelte/tests/fixtures/rules/block-lang/invalid/style/scss/null01-errors.yaml
+++ b/packages/eslint-plugin-svelte/tests/fixtures/rules/block-lang/invalid/style/scss/null01-errors.yaml
@@ -1,4 +1,7 @@
 - message: The lang attribute of the <style> block should be "scss".
   line: 1
   column: 1
-  suggestions: null
+  suggestions:
+    - desc: Add lang attribute to a <style> block with the value "scss".
+      output: |
+        <style lang="scss"></style>
diff --git a/packages/eslint-plugin-svelte/tests/fixtures/rules/block-lang/invalid/style/scss/sass01-errors.yaml b/packages/eslint-plugin-svelte/tests/fixtures/rules/block-lang/invalid/style/scss/sass01-errors.yaml
index 7663cab..6560001 100644
--- a/packages/eslint-plugin-svelte/tests/fixtures/rules/block-lang/invalid/style/scss/sass01-errors.yaml
+++ b/packages/eslint-plugin-svelte/tests/fixtures/rules/block-lang/invalid/style/scss/sass01-errors.yaml
@@ -1,4 +1,9 @@
 - message: The lang attribute of the <style> block should be "scss".
   line: 1
   column: 1
-  suggestions: null
+  suggestions:
+    - desc: Replace a <style> block with the lang attribute set to "scss".
+      output: |
+        <style lang="scss">
+
+        </style>
diff --git a/packages/eslint-plugin-svelte/tests/fixtures/rules/block-lang/invalid/style/scss/scss-as-script-lang01-errors.yaml b/packages/eslint-plugin-svelte/tests/fixtures/rules/block-lang/invalid/style/scss/scss-as-script-lang01-errors.yaml
index 748d363..cd949e0 100644
--- a/packages/eslint-plugin-svelte/tests/fixtures/rules/block-lang/invalid/style/scss/scss-as-script-lang01-errors.yaml
+++ b/packages/eslint-plugin-svelte/tests/fixtures/rules/block-lang/invalid/style/scss/scss-as-script-lang01-errors.yaml
@@ -1,4 +1,9 @@
 - message: The lang attribute of the <style> block should be "scss".
   line: 3
   column: 1
-  suggestions: null
+  suggestions:
+    - desc: Add lang attribute to a <style> block with the value "scss".
+      output: |
+        <script lang="scss"></script>
+
+        <style lang="scss"></style>