Skip to content

Commit baf6230

Browse files
committed
add tests
1 parent 9dfcb5e commit baf6230

File tree

1 file changed

+38
-0
lines changed

1 file changed

+38
-0
lines changed

tests/lib/rules/func-style.js

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -422,6 +422,26 @@ ruleTester.run("func-style", rule, {
422422
},
423423
],
424424
},
425+
{
426+
code: "$1: function $2() { }",
427+
languageOptions: { sourceType: "script" },
428+
errors: [
429+
{
430+
messageId: "expression",
431+
type: "FunctionDeclaration",
432+
},
433+
],
434+
},
435+
{
436+
code: "if (foo) function bar() {}",
437+
languageOptions: { sourceType: "script" },
438+
errors: [
439+
{
440+
messageId: "expression",
441+
type: "FunctionDeclaration",
442+
},
443+
],
444+
},
425445
],
426446
});
427447

@@ -796,6 +816,24 @@ ruleTesterTypeScript.run("func-style", rule, {
796816
},
797817
],
798818
},
819+
{
820+
code: "$1: function $2(): void { }",
821+
errors: [
822+
{
823+
messageId: "expression",
824+
type: "FunctionDeclaration",
825+
},
826+
],
827+
},
828+
{
829+
code: "if (foo) function bar(): string {}",
830+
errors: [
831+
{
832+
messageId: "expression",
833+
type: "FunctionDeclaration",
834+
},
835+
],
836+
},
799837
{
800838
code: `
801839
function test1(a: string): string;

0 commit comments

Comments
 (0)