Skip to content

Commit 8c4a3bd

Browse files
authored
Add codelyzer contextual-lifecycle converter (#456)
1 parent fce2822 commit 8c4a3bd

File tree

3 files changed

+32
-0
lines changed

3 files changed

+32
-0
lines changed
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
import { RuleConverter } from "../../converter";
2+
3+
export const convertContextualLifecycle: RuleConverter = () => {
4+
return {
5+
rules: [
6+
{
7+
ruleName: "@angular-eslint/contextual-lifecycle",
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 { convertContextualLifecycle } from "../contextual-lifecycle";
2+
3+
describe(convertContextualLifecycle, () => {
4+
test("conversion without arguments", () => {
5+
const result = convertContextualLifecycle({
6+
ruleArguments: [],
7+
});
8+
9+
expect(result).toEqual({
10+
rules: [
11+
{
12+
ruleName: "@angular-eslint/contextual-lifecycle",
13+
},
14+
],
15+
plugins: ["@angular-eslint/eslint-plugin"],
16+
});
17+
});
18+
});

src/rules/rulesConverters.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -141,6 +141,7 @@ import { convertVariableName } from "./converters/variable-name";
141141
import { convertComponentClassSuffix } from "./converters/codelyzer/component-class-suffix";
142142
import { convertComponentMaxInlineDeclarations } from "./converters/codelyzer/component-max-inline-declarations";
143143
import { convertComponentSelector } from "./converters/codelyzer/component-selector";
144+
import { convertContextualLifecycle } from "./converters/codelyzer/contextual-lifecycle";
144145

145146
/**
146147
* Keys TSLint rule names to their ESLint rule converters.
@@ -162,6 +163,7 @@ export const rulesConverters = new Map([
162163
["component-class-suffix", convertComponentClassSuffix],
163164
["component-max-inline-declarations", convertComponentMaxInlineDeclarations],
164165
["component-selector", convertComponentSelector],
166+
["contextual-lifecycle", convertContextualLifecycle],
165167
["curly", convertCurly],
166168
["cyclomatic-complexity", convertCyclomaticComplexity],
167169
["deprecation", convertDeprecation],

0 commit comments

Comments
 (0)