Skip to content

Commit 3a4c53e

Browse files
authored
Fix codelyzer template-conditional-complexity converter (#985)
Was missing the "maxComplexity" property at the output rule
1 parent 0aa64e5 commit 3a4c53e

File tree

2 files changed

+28
-1
lines changed

2 files changed

+28
-1
lines changed

src/converters/lintConfigs/rules/ruleConverters/codelyzer/template-conditional-complexity.ts

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,16 @@
11
import { RuleConverter } from "../../ruleConverter";
22

3-
export const convertTemplateConditionalComplexity: RuleConverter = () => {
3+
export const convertTemplateConditionalComplexity: RuleConverter = (tslintRule) => {
44
return {
55
rules: [
66
{
7+
...(tslintRule.ruleArguments.length === 1 && {
8+
ruleArguments: [
9+
{
10+
maxComplexity: tslintRule.ruleArguments[0],
11+
},
12+
],
13+
}),
714
ruleName: "@angular-eslint/template/conditional-complexity",
815
},
916
],

src/converters/lintConfigs/rules/ruleConverters/codelyzer/tests/template-conditional-complexity.test.ts

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,4 +15,24 @@ describe(convertTemplateConditionalComplexity, () => {
1515
plugins: ["@angular-eslint/eslint-plugin-template"],
1616
});
1717
});
18+
19+
test("conversion with arguments", () => {
20+
const result = convertTemplateConditionalComplexity({
21+
ruleArguments: [4],
22+
});
23+
24+
expect(result).toEqual({
25+
rules: [
26+
{
27+
ruleArguments: [
28+
{
29+
maxComplexity: 4,
30+
},
31+
],
32+
ruleName: "@angular-eslint/template/conditional-complexity",
33+
},
34+
],
35+
plugins: ["@angular-eslint/eslint-plugin-template"],
36+
});
37+
});
1838
});

0 commit comments

Comments
 (0)