You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Improve markdown formatting and line length consistency in writing-rules.md
- Removed unnecessary markdownlint-disable comment
- Fixed inconsistent indentation in nested lists (changed 2-space to 4-space indentation)
- Wrapped long lines to improve readability
- Added blank lines before nested lists for better markdown structure
- Split long message template strings across multiple lines
- Improved consistency in formatting throughout the document
Copy file name to clipboardExpand all lines: docs/writing-rules.md
+35-26Lines changed: 35 additions & 26 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,4 +1,3 @@
1
-
<!-- markdownlint-disable -->
2
1
# Writing Linter Rules
3
2
4
3
This guide explains how to write custom linter rules for AGLint. AGLint uses a visitor pattern similar to ESLint,
@@ -78,21 +77,21 @@ The `meta` object contains information about the rule:
78
77
### Required Fields
79
78
80
79
-**`type`**: One of:
81
-
-`LinterRuleType.Problem` - Identifies code that will cause errors or confusing behavior
82
-
-`LinterRuleType.Suggestion` - Identifies code that could be improved but isn't necessarily wrong
83
-
-`LinterRuleType.Layout` - Concerns formatting and whitespace
80
+
-`LinterRuleType.Problem` - Identifies code that will cause errors or confusing behavior
81
+
-`LinterRuleType.Suggestion` - Identifies code that could be improved but isn't necessarily wrong
82
+
-`LinterRuleType.Layout` - Concerns formatting and whitespace
84
83
85
84
-**`docs`**: Documentation object with:
86
-
-`name` - The rule name (kebab-case)
87
-
-`description` - Short description of what the rule checks
88
-
-`recommended` - Whether the rule is enabled in the recommended config
89
-
-`url` - (Optional) Link to full documentation
85
+
-`name` - The rule name (kebab-case)
86
+
-`description` - Short description of what the rule checks
87
+
-`recommended` - Whether the rule is enabled in the recommended config
88
+
-`url` - (Optional) Link to full documentation
90
89
91
90
### Optional Fields
92
91
93
92
-**`messages`**: Object mapping message IDs to template strings
94
-
- Use `{{placeholder}}` syntax for dynamic values
95
-
- Provides type-safe message references in `context.report()`
93
+
- Use `{{placeholder}}` syntax for dynamic values
94
+
- Provides type-safe message references in `context.report()`
96
95
97
96
-**`hasFix`**: Set to `true` if the rule can automatically fix problems
98
97
@@ -120,7 +119,8 @@ export default defineRule({
120
119
recommended: true,
121
120
},
122
121
messages: {
123
-
tooShortRule: 'Rule is too short, its length is {{length}}, but at least {{minLength}} characters are required',
122
+
tooShortRule: 'Rule is too short, its length is {{length}}, '
123
+
+'but at least {{minLength}} characters are required',
124
124
},
125
125
configSchema: v.tuple([
126
126
v.strictObject({
@@ -189,7 +189,8 @@ create: (context) => {
189
189
190
190
## Writing Visitors with Selectors
191
191
192
-
AGLint uses **esquery** for selecting AST nodes, similar to how CSS selectors work with DOM elements. The `create` function returns an object mapping selectors to visitor functions.
192
+
AGLint uses **esquery** for selecting AST nodes, similar to how CSS selectors work with DOM elements.
193
+
The `create` function returns an object mapping selectors to visitor functions.
193
194
194
195
### Exploring the AST
195
196
@@ -198,13 +199,14 @@ To understand the structure of the AST and what node types are available, use th
0 commit comments