Skip to content

Commit 207c061

Browse files
author
Josh Goldberg
authored
Added mocha-avoid-only converter (#1008)
* Added mocha-avoid-only converter * Fix source to include plugins * I had updated the wrong test file
1 parent b513d71 commit 207c061

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
@@ -31,6 +31,7 @@ import { convertMaxFileLineCount } from "./ruleConverters/max-file-line-count";
3131
import { convertMaxLineLength } from "./ruleConverters/max-line-length";
3232
import { convertMemberAccess } from "./ruleConverters/member-access";
3333
import { convertMemberOrdering } from "./ruleConverters/member-ordering";
34+
import { convertMochaAvoidOnly } from "./ruleConverters/mocha-avoid-only";
3435
import { convertNewlineBeforeReturn } from "./ruleConverters/newline-before-return";
3536
import { convertNewlinePerChainedCall } from "./ruleConverters/newline-per-chained-call";
3637
import { convertNewParens } from "./ruleConverters/new-parens";
@@ -272,6 +273,7 @@ export const ruleConverters = new Map([
272273
["max-line-length", convertMaxLineLength],
273274
["member-access", convertMemberAccess],
274275
["member-ordering", convertMemberOrdering],
276+
["mocha-avoid-only", convertMochaAvoidOnly],
275277
["new-parens", convertNewParens],
276278
["newline-before-return", convertNewlineBeforeReturn],
277279
["newline-per-chained-call", convertNewlinePerChainedCall],
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 convertMochaAvoidOnly: RuleConverter = () => {
4+
return {
5+
plugins: ["eslint-plugin-jest"],
6+
rules: [
7+
{
8+
ruleName: "jest/no-focused-tests",
9+
},
10+
],
11+
};
12+
};
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
import { convertMochaAvoidOnly } from "../mocha-avoid-only";
2+
3+
describe(convertMochaAvoidOnly, () => {
4+
test("conversion without arguments", () => {
5+
const result = convertMochaAvoidOnly({
6+
ruleArguments: [],
7+
});
8+
9+
expect(result).toEqual({
10+
plugins: ["eslint-plugin-jest"],
11+
rules: [
12+
{
13+
ruleName: "jest/no-focused-tests",
14+
},
15+
],
16+
});
17+
});
18+
});

0 commit comments

Comments
 (0)