Skip to content

Commit bc4d678

Browse files
kbrillaKrzysztof Brilla
andauthored
Add rxjs-no-async-subscribe converter (#775)
* Adding the rule, mapping it and writing the tests * added import comment * typo in rule name Co-authored-by: Krzysztof Brilla <brilla.krzysztof@gmail.com>
1 parent cdf1afd commit bc4d678

File tree

3 files changed

+34
-0
lines changed

3 files changed

+34
-0
lines changed

src/converters/lintConfigs/rules/ruleConverters.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -181,6 +181,9 @@ import { convertJsxKey } from "./ruleConverters/eslint-plugin-react/jsx-key";
181181
import { convertJsxNoBind } from "./ruleConverters/eslint-plugin-react/jsx-no-bind";
182182
import { convertJsxWrapMultiline } from "./ruleConverters/eslint-plugin-react/jsx-wrap-multiline";
183183

184+
//eslint-plugin-rxjs converters
185+
import { convertNoAsyncSubscribe } from "./ruleConverters/eslint-plugin-rxjs/no-async-subscribe";
186+
184187
/**
185188
* Keys TSLint rule names to their ESLint rule converters.
186189
*/
@@ -364,6 +367,7 @@ export const ruleConverters = new Map([
364367
["use-pipe-decorator", convertUsePipeDecorator],
365368
["use-pipe-transform-interface", convertUsePipeTransformInterface],
366369
["variable-name", convertVariableName],
370+
["rxjs-no-async-subscribe", convertNoAsyncSubscribe],
367371

368372
// These converters are all for rules that need more complex option conversions.
369373
// Some of them will likely need to have notices about changed lint behaviors...
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 convertNoAsyncSubscribe: RuleConverter = () => {
4+
return {
5+
rules: [
6+
{
7+
ruleName: "no-async-subscribe",
8+
},
9+
],
10+
plugins: ["eslint-plugin-rxjs"],
11+
};
12+
};
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
import { convertNoAsyncSubscribe } from "../no-async-subscribe";
2+
3+
describe(convertNoAsyncSubscribe, () => {
4+
test("conversion without arguments", () => {
5+
const result = convertNoAsyncSubscribe({
6+
ruleArguments: [],
7+
});
8+
9+
expect(result).toEqual({
10+
rules: [
11+
{
12+
ruleName: "no-async-subscribe",
13+
},
14+
],
15+
plugins: ["eslint-plugin-rxjs"],
16+
});
17+
});
18+
});

0 commit comments

Comments
 (0)