Skip to content

Commit 31c57bc

Browse files
kbrillaKrzysztof Brilla
andauthored
Adding the rule, mapping it and writing the tests (#799)
Co-authored-by: Krzysztof Brilla <[email protected]>
1 parent dd26a4c commit 31c57bc

File tree

3 files changed

+33
-1
lines changed

3 files changed

+33
-1
lines changed

src/converters/lintConfigs/rules/ruleConverters.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -183,8 +183,9 @@ import { convertJsxKey } from "./ruleConverters/eslint-plugin-react/jsx-key";
183183
import { convertJsxNoBind } from "./ruleConverters/eslint-plugin-react/jsx-no-bind";
184184
import { convertJsxWrapMultiline } from "./ruleConverters/eslint-plugin-react/jsx-wrap-multiline";
185185

186-
//eslint-plugin-rxjs converters
186+
// eslint-plugin-rxjs converters
187187
import { convertNoAsyncSubscribe } from "./ruleConverters/eslint-plugin-rxjs/no-async-subscribe";
188+
import { convertNoUnsafeSubjectNext } from "./ruleConverters/eslint-plugin-rxjs/no-unsafe-subject-next";
188189

189190
/**
190191
* Keys TSLint rule names to their ESLint rule converters.
@@ -372,6 +373,7 @@ export const ruleConverters = new Map([
372373
["use-pipe-transform-interface", convertUsePipeTransformInterface],
373374
["variable-name", convertVariableName],
374375
["rxjs-no-async-subscribe", convertNoAsyncSubscribe],
376+
["rxjs-no-unsafe-subject-next", convertNoUnsafeSubjectNext],
375377

376378
// These converters are all for rules that need more complex option conversions.
377379
// 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 convertNoUnsafeSubjectNext: RuleConverter = () => {
4+
return {
5+
rules: [
6+
{
7+
ruleName: "rxjs/no-unsafe-subject-next",
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 { convertNoUnsafeSubjectNext } from "../no-unsafe-subject-next";
2+
3+
describe(convertNoUnsafeSubjectNext, () => {
4+
test("conversion without arguments", () => {
5+
const result = convertNoUnsafeSubjectNext({
6+
ruleArguments: [],
7+
});
8+
9+
expect(result).toEqual({
10+
rules: [
11+
{
12+
ruleName: "rxjs/no-unsafe-subject-next",
13+
},
14+
],
15+
plugins: ["eslint-plugin-rxjs"],
16+
});
17+
});
18+
});

0 commit comments

Comments
 (0)