Skip to content

Commit 933ebb8

Browse files
author
Josh Goldberg
authored
Added converter for no-empty-line-after-opening-brace (#1067)
1 parent d70969f commit 933ebb8

File tree

3 files changed

+48
-1
lines changed

3 files changed

+48
-1
lines changed

src/converters/lintConfigs/rules/ruleConverters.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,7 @@ import { convertNoDuplicateVariable } from "./ruleConverters/no-duplicate-variab
5757
import { convertNoDynamicDelete } from './ruleConverters/no-dynamic-delete';
5858
import { convertNoEmpty } from "./ruleConverters/no-empty";
5959
import { convertNoEmptyInterface } from "./ruleConverters/no-empty-interface";
60+
import { convertNoEmptyLineAfterOpeningBrace } from "./ruleConverters/no-empty-line-after-opening-brace";
6061
import { convertNoEval } from "./ruleConverters/no-eval";
6162
import { convertNoExplicitAny } from "./ruleConverters/no-explicit-any";
6263
import { convertNoFloatingPromises } from "./ruleConverters/no-floating-promises";
@@ -309,6 +310,7 @@ export const ruleConverters = new Map([
309310
["no-duplicate-variable", convertNoDuplicateVariable],
310311
["no-dynamic-delete", convertNoDynamicDelete],
311312
["no-empty-interface", convertNoEmptyInterface],
313+
["no-empty-line-after-opening-brace", convertNoEmptyLineAfterOpeningBrace], // padded-blocks
312314
["no-empty", convertNoEmpty],
313315
["no-eval", convertNoEval],
314316
["no-floating-promises", convertNoFloatingPromises],
@@ -465,7 +467,6 @@ export const ruleConverters = new Map([
465467

466468
// tslint-microsoft-contrib rules:
467469
// ["max-func-body-length", convertMaxFuncBodyLength],
468-
// ["no-empty-line-after-opening-brace", convertNoEmptyLineAfterOpeningBrace], // padded-blocks
469470
// ["no-function-expression", convertNoFunctionExpression], // ban-syntax config
470471
// ["no-suspicious-comment", convertNoSuspiciousComment],
471472
// ["no-with-statement", convertNoWithStatement],
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
import { RuleConverter } from "../ruleConverter";
2+
3+
export const convertNoEmptyLineAfterOpeningBrace: RuleConverter = () => {
4+
return {
5+
rules: [
6+
{
7+
notices: ["ESLint's padded-blocks rule also bans a blank line before a closing brace."],
8+
ruleArguments: [
9+
{
10+
blocks: "never",
11+
},
12+
{
13+
"allowSingleLineBlocks": true,
14+
}
15+
],
16+
ruleName: "padded-blocks",
17+
},
18+
],
19+
};
20+
};
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
import { convertNoEmptyLineAfterOpeningBrace } from "../no-empty-line-after-opening-brace";
2+
3+
describe(convertNoEmptyLineAfterOpeningBrace, () => {
4+
test("conversion ", () => {
5+
const result = convertNoEmptyLineAfterOpeningBrace({
6+
ruleArguments: [],
7+
});
8+
9+
expect(result).toEqual({
10+
rules: [
11+
{
12+
notices: ["ESLint's padded-blocks rule also bans a blank line before a closing brace."],
13+
ruleArguments: [
14+
{
15+
blocks: "never",
16+
},
17+
{
18+
"allowSingleLineBlocks": true,
19+
}
20+
],
21+
ruleName: "padded-blocks",
22+
},
23+
],
24+
});
25+
});
26+
});

0 commit comments

Comments
 (0)