Skip to content
This repository was archived by the owner on Jan 7, 2025. It is now read-only.

Commit 9e4fd7d

Browse files
authored
Fixes formatting error in the rules.md table (#206)
* Fixes formatting error in the rules.md table The content after the rule `invalid_runtime_check_with_js_interop_types` was not formatted in a table due to syntax error * Fix multiline descriptions formatting in markdown generation - Updated the `_createRuleTableRow` function to properly handle multiline descriptions by replacing line breaks with spaces - Trimmed leading/trailing whitespace and reduced consecutive spaces to a single space - This ensures that the generated markdown table rows in rules.md are correctly formatted, preventing description content from breaking across lines or having inconsistent spacing
1 parent 6580f83 commit 9e4fd7d

File tree

2 files changed

+5
-3
lines changed

2 files changed

+5
-3
lines changed

rules.md

+1-2
Original file line numberDiff line numberDiff line change
@@ -58,8 +58,7 @@
5858
| [`empty_statements`](https://dart.dev/lints/empty_statements) | Avoid empty statements. ||
5959
| [`exhaustive_cases`](https://dart.dev/lints/exhaustive_cases) | Define case clauses for all constants in enum-like classes. ||
6060
| [`implementation_imports`](https://dart.dev/lints/implementation_imports) | Don't import implementation files from another package. | |
61-
| [`invalid_runtime_check_with_js_interop_types`](https://dart.dev/lints/invalid_runtime_check_with_js_interop_types) | Avoid runtime type tests with JS interop types where the result may not
62-
be platform-consistent. | |
61+
| [`invalid_runtime_check_with_js_interop_types`](https://dart.dev/lints/invalid_runtime_check_with_js_interop_types) | Avoid runtime type tests with JS interop types where the result may not be platform-consistent. | |
6362
| [`library_prefixes`](https://dart.dev/lints/library_prefixes) | Use `lowercase_with_underscores` when specifying a library prefix. | |
6463
| [`library_private_types_in_public_api`](https://dart.dev/lints/library_private_types_in_public_api) | Avoid using private types in public APIs. | |
6564
| [`no_leading_underscores_for_library_prefixes`](https://dart.dev/lints/no_leading_underscores_for_library_prefixes) | Avoid leading underscores for library prefixes. ||

tool/gen_docs.dart

+4-1
Original file line numberDiff line numberDiff line change
@@ -171,7 +171,10 @@ String _createRuleTableRow(
171171
if (ruleMeta == null) {
172172
stderr.writeln("WARNING: Missing rule information for rule: $rule");
173173
}
174-
final description = ruleMeta?['description'] ?? '';
174+
final description = (ruleMeta?['description'] ?? '')
175+
.replaceAll('\n', ' ')
176+
.replaceAll(RegExp(r'\s+'), ' ')
177+
.trim();
175178
final hasFix = ruleMeta?['fixStatus'] == 'hasFix';
176179
final fixDesc = hasFix ? '✅' : '';
177180

0 commit comments

Comments
 (0)