Skip to content

Commit 2d21efc

Browse files
committed
Fix off-by-one error in parameter count validation for scriptlets without parameters in no-invalid-scriptlets rule
- Changed condition from `parameterIndex > 1` to `parameterIndex > 0` when checking for extra parameters - Ensures scriptlets with no defined parameters correctly reject any parameters beyond scriptlet name - Fixes duplicate error reporting where first parameter was incorrectly validated twice - Updated documentation example to show correct single error for missing 'property' parameter
1 parent 52f58d3 commit 2d21efc

File tree

2 files changed

+1
-2
lines changed

2 files changed

+1
-2
lines changed

docs/rules/no-invalid-scriptlets.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -312,7 +312,6 @@ should be reported as:
312312

313313
```shell
314314
1:3 Scriptlet 'set-constant' should have parameter 'property'
315-
1:3 Scriptlet 'set-constant' should have parameter 'property'
316315
1:3 Scriptlet 'set-constant' should have parameter 'value'
317316
```
318317

src/rules/no-invalid-scriptlets.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -180,7 +180,7 @@ export default defineRule({
180180

181181
if (!scriptletData.parameters) {
182182
// any other parameters are not allowed, only scriptlet name
183-
if (parameterIndex > 1) {
183+
if (parameterIndex > 0) {
184184
context.report({
185185
messageId: 'scriptletShouldNotHaveParameters',
186186
data: {

0 commit comments

Comments
 (0)