Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions src/converters/lintConfigs/rules/ruleConverters.ts
Original file line number Diff line number Diff line change
Expand Up @@ -183,6 +183,7 @@ import { convertJsxWrapMultiline } from "./ruleConverters/eslint-plugin-react/js

//eslint-plugin-rxjs converters
import { convertNoAsyncSubscribe } from "./ruleConverters/eslint-plugin-rxjs/no-async-subscribe";
import { convertNoShareReplay } from "./ruleConverters/eslint-plugin-rxjs/no-sharereplay";

/**
* Keys TSLint rule names to their ESLint rule converters.
Expand Down Expand Up @@ -368,6 +369,7 @@ export const ruleConverters = new Map([
["use-pipe-transform-interface", convertUsePipeTransformInterface],
["variable-name", convertVariableName],
["rxjs-no-async-subscribe", convertNoAsyncSubscribe],
["rxjs-no-sharereplay", convertNoShareReplay],

// These converters are all for rules that need more complex option conversions.
// Some of them will likely need to have notices about changed lint behaviors...
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
import { RuleConverter } from "../../ruleConverter";

export const convertNoShareReplay: RuleConverter = (tslintRule) => {
return {
rules: [
{
...(tslintRule.ruleArguments.length !== 0 && {
ruleArguments: tslintRule.ruleArguments,
}),
ruleName: "rxjs/no-sharereplay",
},
],
plugins: ["eslint-plugin-rxjs"],
};
};
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
import { convertNoShareReplay } from "../no-sharereplay";

describe(convertNoShareReplay, () => {
test("conversion without arguments", () => {
const result = convertNoShareReplay({
ruleArguments: [],
});

expect(result).toEqual({
rules: [
{
ruleName: "rxjs/no-sharereplay",
},
],
plugins: ["eslint-plugin-rxjs"],
});
});

test("conversion without arguments", () => {
const result = convertNoShareReplay({
ruleArguments: [
{
allowConfig: true,
},
],
});

expect(result).toEqual({
rules: [
{
ruleName: "rxjs/no-sharereplay",
ruleArguments: [
{
allowConfig: true,
},
],
},
],
plugins: ["eslint-plugin-rxjs"],
});
});
});