Skip to content

Commit

Permalink
Add more tests
Browse files Browse the repository at this point in the history
  • Loading branch information
zachkirsch committed Apr 22, 2022
1 parent 64699f5 commit 58c1391
Showing 1 changed file with 302 additions and 0 deletions.
302 changes: 302 additions & 0 deletions packages/eslint-plugin/tests/rules/no-namespace.test.ts
Expand Up @@ -261,5 +261,307 @@ namespace Foo.Bar {
},
],
},
{
code: `
namespace A {
namespace B {
declare namespace C {}
}
}
`,
errors: [
{
messageId: 'moduleSyntaxIsPreferred',
line: 2,
column: 1,
},
{
messageId: 'moduleSyntaxIsPreferred',
line: 3,
column: 3,
},
],
options: [{ allowDeclarations: true }],
},
{
code: `
namespace A {
namespace B {
export declare namespace C {}
}
}
`,
errors: [
{
messageId: 'moduleSyntaxIsPreferred',
line: 2,
column: 1,
},
{
messageId: 'moduleSyntaxIsPreferred',
line: 3,
column: 3,
},
],
options: [{ allowDeclarations: true }],
},
{
code: `
namespace A {
declare namespace B {
namespace C {}
}
}
`,
errors: [
{
messageId: 'moduleSyntaxIsPreferred',
line: 2,
column: 1,
},
],
options: [{ allowDeclarations: true }],
},
{
code: `
namespace A {
export declare namespace B {
namespace C {}
}
}
`,
errors: [
{
messageId: 'moduleSyntaxIsPreferred',
line: 2,
column: 1,
},
],
options: [{ allowDeclarations: true }],
},
{
code: `
namespace A {
export declare namespace B {
declare namespace C {}
}
}
`,
errors: [
{
messageId: 'moduleSyntaxIsPreferred',
line: 2,
column: 1,
},
],
options: [{ allowDeclarations: true }],
},
{
code: `
namespace A {
export declare namespace B {
export declare namespace C {}
}
}
`,
errors: [
{
messageId: 'moduleSyntaxIsPreferred',
line: 2,
column: 1,
},
],
options: [{ allowDeclarations: true }],
},
{
code: `
namespace A {
declare namespace B {
export declare namespace C {}
}
}
`,
errors: [
{
messageId: 'moduleSyntaxIsPreferred',
line: 2,
column: 1,
},
],
options: [{ allowDeclarations: true }],
},
{
code: `
namespace A {
export namespace B {
export declare namespace C {}
}
}
`,
errors: [
{
messageId: 'moduleSyntaxIsPreferred',
line: 2,
column: 1,
},
{
messageId: 'moduleSyntaxIsPreferred',
line: 3,
column: 10,
},
],
options: [{ allowDeclarations: true }],
},
{
code: `
export namespace A {
namespace B {
declare namespace C {}
}
}
`,
errors: [
{
messageId: 'moduleSyntaxIsPreferred',
line: 2,
column: 8,
},
{
messageId: 'moduleSyntaxIsPreferred',
line: 3,
column: 3,
},
],
options: [{ allowDeclarations: true }],
},
{
code: `
export namespace A {
namespace B {
export declare namespace C {}
}
}
`,
errors: [
{
messageId: 'moduleSyntaxIsPreferred',
line: 2,
column: 8,
},
{
messageId: 'moduleSyntaxIsPreferred',
line: 3,
column: 3,
},
],
options: [{ allowDeclarations: true }],
},
{
code: `
export namespace A {
declare namespace B {
namespace C {}
}
}
`,
errors: [
{
messageId: 'moduleSyntaxIsPreferred',
line: 2,
column: 8,
},
],
options: [{ allowDeclarations: true }],
},
{
code: `
export namespace A {
export declare namespace B {
namespace C {}
}
}
`,
errors: [
{
messageId: 'moduleSyntaxIsPreferred',
line: 2,
column: 8,
},
],
options: [{ allowDeclarations: true }],
},
{
code: `
export namespace A {
export declare namespace B {
declare namespace C {}
}
}
`,
errors: [
{
messageId: 'moduleSyntaxIsPreferred',
line: 2,
column: 8,
},
],
options: [{ allowDeclarations: true }],
},
{
code: `
export namespace A {
export declare namespace B {
export declare namespace C {}
}
}
`,
errors: [
{
messageId: 'moduleSyntaxIsPreferred',
line: 2,
column: 8,
},
],
options: [{ allowDeclarations: true }],
},
{
code: `
export namespace A {
declare namespace B {
export declare namespace C {}
}
}
`,
errors: [
{
messageId: 'moduleSyntaxIsPreferred',
line: 2,
column: 8,
},
],
options: [{ allowDeclarations: true }],
},
{
code: `
export namespace A {
export namespace B {
export declare namespace C {}
}
}
`,
errors: [
{
messageId: 'moduleSyntaxIsPreferred',
line: 2,
column: 8,
},
{
messageId: 'moduleSyntaxIsPreferred',
line: 3,
column: 10,
},
],
options: [{ allowDeclarations: true }],
},
],
});

0 comments on commit 58c1391

Please sign in to comment.