Skip to content

Commit f95643b

Browse files
committed
fix(rules): properly short-circuit AND logic to return RuleError instead of false
1 parent 2b64e0b commit f95643b

3 files changed

Lines changed: 11 additions & 10 deletions

File tree

package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,8 @@
5353
"devDependencies": {
5454
"@types/eslint-plugin-mocha": "^10",
5555
"eslint-plugin-mocha": "^11.2.0",
56-
"eslint-plugin-prettier": "^5.5.4"
56+
"eslint-plugin-prettier": "^5.5.4",
57+
"prettier": "^3.6.2"
5758
},
5859
"resolutions": {
5960
"form-data": ">=4.0.4",

packages/rules/src/rule-manager.ts

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -195,17 +195,16 @@ export class RuleManager implements RuleManagerInterface {
195195
) {
196196
for (let i = 0, l = rulesSubset.AND.length; i < l; i++) {
197197
match = this._processORWHEN(data, rulesSubset.AND[i]);
198-
if (match === false) {
199-
return false;
198+
// AND requires ALL to explicitly return true
199+
if (match !== true) {
200+
return match;
200201
}
201202
}
202-
if (match !== false) {
203-
this._loggerManager?.info?.(
204-
'RuleManager._processAND()',
205-
MESSAGES.RULE_MATCH_AND
206-
);
207-
}
208-
return match;
203+
this._loggerManager?.info?.(
204+
'RuleManager._processAND()',
205+
MESSAGES.RULE_MATCH_AND
206+
);
207+
return true;
209208
} else {
210209
this._loggerManager?.warn?.(
211210
'RuleManager._processAND()',

yarn.lock

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26013,6 +26013,7 @@ __metadata:
2601326013
"@types/eslint-plugin-mocha": "npm:^10"
2601426014
eslint-plugin-mocha: "npm:^11.2.0"
2601526015
eslint-plugin-prettier: "npm:^5.5.4"
26016+
prettier: "npm:^3.6.2"
2601626017
languageName: unknown
2601726018
linkType: soft
2601826019

0 commit comments

Comments
 (0)