Skip to content

Commit 68db509

Browse files
authored
Add codelyzer contextual-decorator converter (#986)
* Add codelyzer contextual-decorator converter * Add the rule to the converter list
1 parent 0c57192 commit 68db509

File tree

3 files changed

+32
-0
lines changed

3 files changed

+32
-0
lines changed

src/converters/lintConfigs/rules/ruleConverters.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -142,6 +142,7 @@ import { convertComponentClassSuffix } from "./ruleConverters/codelyzer/componen
142142
import { convertComponentMaxInlineDeclarations } from "./ruleConverters/codelyzer/component-max-inline-declarations";
143143
import { convertComponentSelector } from "./ruleConverters/codelyzer/component-selector";
144144
import { convertContextualLifecycle } from "./ruleConverters/codelyzer/contextual-lifecycle";
145+
import { convertContextualDecorator } from "./ruleConverters/codelyzer/contextual-decorator";
145146
import { convertDirectiveClassSuffix } from "./ruleConverters/codelyzer/directive-class-suffix";
146147
import { convertDirectiveSelector } from "./ruleConverters/codelyzer/directive-selector";
147148
import { convertNoAttributeDecorator } from "./ruleConverters/codelyzer/no-attribute-decorator";
@@ -237,6 +238,7 @@ export const ruleConverters = new Map([
237238
["component-max-inline-declarations", convertComponentMaxInlineDeclarations],
238239
["component-selector", convertComponentSelector],
239240
["contextual-lifecycle", convertContextualLifecycle],
241+
["contextual-decorator", convertContextualDecorator],
240242
["curly", convertCurly],
241243
["cyclomatic-complexity", convertCyclomaticComplexity],
242244
["deprecation", convertDeprecation],
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
import { RuleConverter } from "../../ruleConverter";
2+
3+
export const convertContextualDecorator: RuleConverter = () => {
4+
return {
5+
rules: [
6+
{
7+
ruleName: "@angular-eslint/contextual-decorator",
8+
},
9+
],
10+
plugins: ["@angular-eslint/eslint-plugin"],
11+
};
12+
};
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
import { convertContextualDecorator } from "../contextual-decorator";
2+
3+
describe(convertContextualDecorator, () => {
4+
test("conversion without arguments", () => {
5+
const result = convertContextualDecorator({
6+
ruleArguments: [],
7+
});
8+
9+
expect(result).toEqual({
10+
rules: [
11+
{
12+
ruleName: "@angular-eslint/contextual-decorator",
13+
},
14+
],
15+
plugins: ["@angular-eslint/eslint-plugin"],
16+
});
17+
});
18+
});

0 commit comments

Comments
 (0)