From ee90fdb90b3ea3f4d3f3c9fa484b0fb9d0bf8cc7 Mon Sep 17 00:00:00 2001 From: Alexander Date: Sun, 4 Aug 2019 08:43:27 +0300 Subject: [PATCH] change eslint tests formatting --- scripts/eslint/tests/boolean-trivia.test.ts | 93 ++++--- scripts/eslint/tests/debug-assert.test.ts | 64 +++-- scripts/eslint/tests/no-double-space.test.ts | 246 +++++++++++------- scripts/eslint/tests/no-in-operator.test.ts | 20 +- scripts/eslint/tests/no-keywords.test.ts | 104 +++++--- .../no-type-assertion-whitespace.test.ts | 44 ++-- .../object-literal-surrounding-space.test.ts | 63 +++-- .../eslint/tests/only-arrow-functions.test.ts | 168 +++++++----- .../tests/type-operator-spacing.test.ts | 54 ++-- 9 files changed, 500 insertions(+), 356 deletions(-) diff --git a/scripts/eslint/tests/boolean-trivia.test.ts b/scripts/eslint/tests/boolean-trivia.test.ts index 79f35d94cb..189ae4dbef 100644 --- a/scripts/eslint/tests/boolean-trivia.test.ts +++ b/scripts/eslint/tests/boolean-trivia.test.ts @@ -14,67 +14,78 @@ const ruleTester = new RuleTester({ }); ruleTester.run("boolean-trivia", rule, { - valid: [{ - filename: FILENAME, - code: ` + valid: [ + { + filename: FILENAME, + code: ` const fn = (prop: boolean) => {}; fn(/* boolean prop */ true); - `, - }, { - filename: FILENAME, - code: ` + `, + }, + { + filename: FILENAME, + code: ` const fn = (prop: null) => {}; fn(/* null prop */ null); - `, - }, { - filename: FILENAME, - code: ` + `, + }, + { + filename: FILENAME, + code: ` const fn = (prop: null) => {}; fn(/*null prop*/ null); - `, - }, { - filename: FILENAME, - code: ` + `, + }, + { + filename: FILENAME, + code: ` const fn = (prop: boolean) => {}; fn(/* comment */ false ); - `, - }, { - filename: FILENAME, - code: ` + `, + }, + { + filename: FILENAME, + code: ` const fn = (prop: boolean) => {}; fn.apply(null, true); `, - }], + }, + ], - invalid: [{ - filename: FILENAME, - code: ` + invalid: [ + { + filename: FILENAME, + code: ` const fn = (prop: null) => {}; fn(null); - `, - errors: [{ messageId: "booleanTriviaArgumentError" }], - }, { - filename: FILENAME, - code: ` + `, + errors: [{ messageId: "booleanTriviaArgumentError" }], + }, + { + filename: FILENAME, + code: ` const fn = (prop: boolean) => {}; fn(false); - `, - errors: [{ messageId: "booleanTriviaArgumentError" }], - }, { - filename: FILENAME, - code: ` + `, + errors: [{ messageId: "booleanTriviaArgumentError" }], + }, + { + filename: FILENAME, + code: ` const fn = (prop: boolean) => {}; fn(/* boolean arg */false); - `, - errors: [{ messageId: "booleanTriviaArgumentSpaceError" }], - }, { - filename: FILENAME, - code: ` + `, + errors: [{ messageId: "booleanTriviaArgumentSpaceError" }], + }, + { + filename: FILENAME, + code: ` const fn = (prop: boolean) => {}; fn(/* first comment */ /* second comment */ false); - `, - errors: [{ messageId: "booleanTriviaArgumentError" }], - }], + `, + errors: [{ messageId: "booleanTriviaArgumentError" }], + }, + ], }); diff --git a/scripts/eslint/tests/debug-assert.test.ts b/scripts/eslint/tests/debug-assert.test.ts index f6cbbca856..d0400507dc 100644 --- a/scripts/eslint/tests/debug-assert.test.ts +++ b/scripts/eslint/tests/debug-assert.test.ts @@ -9,32 +9,42 @@ const ruleTester = new RuleTester({ }); ruleTester.run("debug-assert", rule, { - valid: [{ - code: `Debug.assert(true)`, - }, { - code: `Debug.assert(true, 'error message')`, - }, { - code: `Debug.assert(true, 'error message 1', 'error message 2')`, - }, { - code: `Debug.assert(true, 'error message 1', () => {})`, - }, { - code: "Debug.assert(true, `error message 1`, () => {})", - }, { - code: `Debug.assert(true, "error message 1", () => {})`, - }], + valid: [ + { + code: `Debug.assert(true)`, + }, + { + code: `Debug.assert(true, 'error message')`, + }, + { + code: `Debug.assert(true, 'error message 1', 'error message 2')`, + }, + { + code: `Debug.assert(true, 'error message 1', () => {})`, + }, + { + code: "Debug.assert(true, `error message 1`, () => {})", + }, + { + code: `Debug.assert(true, "error message 1", () => {})`, + }, + ], - invalid: [{ - code: `Debug.assert(true, 1)`, - errors: [{ messageId: "secondArgumentDebugAssertError" }], - }, { - code: `Debug.assert(true, 'error message', 1)`, - errors: [{ messageId: "thirdArgumentDebugAssertError" }], - }, { - code: `Debug.assert(true, null, 1)`, - errors: [{ - messageId: "secondArgumentDebugAssertError", - }, { - messageId: "thirdArgumentDebugAssertError", - }], - }], + invalid: [ + { + code: `Debug.assert(true, 1)`, + errors: [{ messageId: "secondArgumentDebugAssertError" }], + }, + { + code: `Debug.assert(true, 'error message', 1)`, + errors: [{ messageId: "thirdArgumentDebugAssertError" }], + }, + { + code: `Debug.assert(true, null, 1)`, + errors: [ + { messageId: "secondArgumentDebugAssertError" }, + { messageId: "thirdArgumentDebugAssertError" }, + ], + } + ], }); diff --git a/scripts/eslint/tests/no-double-space.test.ts b/scripts/eslint/tests/no-double-space.test.ts index 6d5ea4aa08..7d4b0e24f1 100644 --- a/scripts/eslint/tests/no-double-space.test.ts +++ b/scripts/eslint/tests/no-double-space.test.ts @@ -14,130 +14,174 @@ const ruleTester = new RuleTester({ }); ruleTester.run("no-double-space", rule, { - valid: [{ - filename: FILENAME, - code: `const a = {};`, - }, { - filename: FILENAME, - code: `function fn() {}`, - }, { - filename: FILENAME, - code: `const a = " ";`, - }, { - filename: FILENAME, - code: `// ^ ^`, - }, { - filename: FILENAME, - code: `class Cl {}`, - }, { - filename: FILENAME, - code: `// comment `, - }, { - filename: FILENAME, - code: `/* comment */`, - }, { - filename: FILENAME, - code: `" string ";`, - }, { - filename: FILENAME, - code: `/ regexp /g;`, - }, { - filename: FILENAME, - code: `const rgx = / regexp /g;`, - }, { - filename: FILENAME, - code: "const str = ` string template`;", - }, { - filename: FILENAME, - code: ` // comment`, - }, { - filename: FILENAME, - code: ` /* comment */`, - }, { - filename: FILENAME, - code: `// `, - }, { - filename: FILENAME, - code: ` + valid: [ + { + filename: FILENAME, + code: `const a = {};`, + }, + { + filename: FILENAME, + code: `function fn() {}`, + }, + { + filename: FILENAME, + code: `const a = " ";`, + }, + { + filename: FILENAME, + code: `// ^ ^`, + }, + { + filename: FILENAME, + code: `class Cl {}`, + }, + { + filename: FILENAME, + code: `// comment `, + }, + { + filename: FILENAME, + code: `/* comment */`, + }, + { + filename: FILENAME, + code: `" string ";`, + }, + { + filename: FILENAME, + code: `/ regexp /g;`, + }, + { + filename: FILENAME, + code: `const rgx = / regexp /g;`, + }, + { + filename: FILENAME, + code: "const str = ` string template`;", + }, + { + filename: FILENAME, + code: ` // comment`, + }, + { + filename: FILENAME, + code: ` /* comment */`, + }, + { + filename: FILENAME, + code: `// `, + }, + { + filename: FILENAME, + code: ` const a = 1; - `, - }, { - filename: FILENAME, - code: ` + `, + }, + { + filename: FILENAME, + code: ` /** * comment */ - `, - }, { - filename: FILENAME, - code: ` + `, + }, + { + filename: FILENAME, + code: ` // comment // - comment // - comment - `, - }, { - filename: FILENAME, - code: ` + `, + }, + { + filename: FILENAME, + code: ` interface Props { prop: string[]; // comment prop propB: string[]; // comment propB } - `, - }, { - filename: FILENAME, - code: ` + `, + }, + { + filename: FILENAME, + code: ` /** * Returns a JSON-encoded value of the type: string[] * * @param exclude A JSON encoded string[] containing the paths to exclude * when enumerating the directory. */ - `, - }, { - filename: FILENAME, - code: ` + `, + }, + { + filename: FILENAME, + code: ` const obj = { content: "function f() { 1; }", }; - `, - }], + `, + }, + ], - invalid: [{ - filename: FILENAME, - code: `const a = {};`, - errors: [{ messageId: "noDoubleSpaceError", line: 1, column: 6 }], - }, { - filename: FILENAME, - code: `function fn() {}`, - errors: [{ messageId: "noDoubleSpaceError", line: 1, column: 9 }], - }, { - filename: FILENAME, - code: `class Cl {}`, - errors: [{ messageId: "noDoubleSpaceError", line: 1, column: 6 }], - }, { - filename: FILENAME, - code: "const str = ` string template`;", - errors: [{ messageId: "noDoubleSpaceError", line: 1, column: 12 }], - }, { - filename: FILENAME, - code: `/** comment */`, - errors: [{ messageId: "noDoubleSpaceError", line: 1, column: 12 }], - }, { - filename: FILENAME, - code: `/** comment with many spaces */`, - errors: [{ messageId: "noDoubleSpaceError", line: 1, column: 12 }], - }, { - filename: FILENAME, - code: `// comment with many spaces`, - errors: [{ messageId: "noDoubleSpaceError", line: 1, column: 11 }], - }, { - filename: FILENAME, - code: ` + invalid: [ + { + filename: FILENAME, + code: `const a = {};`, + errors: [ + { messageId: "noDoubleSpaceError", line: 1, column: 6 }, + ], + }, + { + filename: FILENAME, + code: `function fn() {}`, + errors: [ + { messageId: "noDoubleSpaceError", line: 1, column: 9 }, + ], + }, + { + filename: FILENAME, + code: `class Cl {}`, + errors: [{ messageId: "noDoubleSpaceError", line: 1, column: 6 }], + }, + { + filename: FILENAME, + code: "const str = ` string template`;", + errors: [ + { messageId: "noDoubleSpaceError", line: 1, column: 12 }, + ], + }, + { + filename: FILENAME, + code: `/** comment */`, + errors: [ + { messageId: "noDoubleSpaceError", line: 1, column: 12 }, + ], + }, + { + filename: FILENAME, + code: `/** comment with many spaces */`, + errors: [ + { messageId: "noDoubleSpaceError", line: 1, column: 12 }, + ], + }, + { + filename: FILENAME, + code: `// comment with many spaces`, + errors: [ + { messageId: "noDoubleSpaceError", line: 1, column: 11 }, + ], + }, + { + filename: FILENAME, + code: ` const a = 1; const b = 2; const c = 3; -`.trim(), - errors: [{ messageId: "noDoubleSpaceError", line: 3, column: 10 }], - }], + `, + errors: [ + { messageId: "noDoubleSpaceError", line: 4, column: 10 }, + ], + }, + ], }); diff --git a/scripts/eslint/tests/no-in-operator.test.ts b/scripts/eslint/tests/no-in-operator.test.ts index 6cd5b43b2e..aef915670f 100644 --- a/scripts/eslint/tests/no-in-operator.test.ts +++ b/scripts/eslint/tests/no-in-operator.test.ts @@ -9,18 +9,22 @@ const ruleTester = new RuleTester({ }); ruleTester.run("no-in-operator", rule, { - valid: [{ - code: ` + valid: [ + { + code: ` const prop = {}; prop.hasProperty('a'); `, - }], + }, + ], - invalid: [{ - code: ` + invalid: [ + { + code: ` const prop = {}; prop in 'a'; - `, - errors: [{ messageId: "noInOperatorError" }], - }], + `, + errors: [{ messageId: "noInOperatorError" }], + }, + ], }); diff --git a/scripts/eslint/tests/no-keywords.test.ts b/scripts/eslint/tests/no-keywords.test.ts index 5b6e0819b3..e2b75838b5 100644 --- a/scripts/eslint/tests/no-keywords.test.ts +++ b/scripts/eslint/tests/no-keywords.test.ts @@ -9,32 +9,40 @@ const ruleTester = new RuleTester({ }); ruleTester.run("no-keywords", rule, { - valid: [{ - code: `const a = {};`, - }, { - code: `function a() {};`, - }, { - code: `const x = function string() {};`, - }, { - code: `const y = function () {};`, - }, { - code: `const y = () => {};`, - }, { - code: ` + valid: [ + { + code: `const a = {};`, + }, + { + code: `function a() {};`, + }, + { + code: `const x = function string() {};`, + }, + { + code: `const y = function () {};`, + }, + { + code: `const y = () => {};`, + }, + { + code: ` class A { b = () => {} a() {} number() {} } - `, - }, { - code: ` + `, + }, + { + code: ` interface A { b(): void; } - `, - }, { - code: ` + `, + }, + { + code: ` const obj = { a: null, b() {}, @@ -42,36 +50,50 @@ const obj = { string: function d (d: string) {}, e: () => {}, }; - `, - }], + `, + }, + ], - invalid: [{ - code: `const number = 1;`, - errors: [{ messageId: "noKeywordsError" }], - }, { - code: `function x(number: number) {};`, - errors: [{ messageId: "noKeywordsError" }], - }, { - code: `const y = function (number: number) {};`, - errors: [{ messageId: "noKeywordsError" }], - }, { - code: `const y = (number: number) => {};`, - errors: [{ messageId: "noKeywordsError" }], - }, { - code: ` + invalid: [ + { + code: `const number = 1;`, + errors: [{ messageId: "noKeywordsError" }], + }, + { + code: `function x(number: number) {};`, + errors: [{ messageId: "noKeywordsError" }], + }, + { + code: `const y = function (number: number) {};`, + errors: [{ messageId: "noKeywordsError" }], + }, + { + code: `const y = (number: number) => {};`, + errors: [{ messageId: "noKeywordsError" }], + }, + { + code: ` class A { b = function (any: any) {}; a(number: number) {} } - `, - errors: [{ messageId: "noKeywordsError" }, { messageId: "noKeywordsError" }], - }, { - code: ` + `, + errors: [ + { messageId: "noKeywordsError" }, + { messageId: "noKeywordsError" }, + ], + }, + { + code: ` interface A { a(number: number): void; b: (any: any) => void; } - `, - errors: [{ messageId: "noKeywordsError" }, { messageId: "noKeywordsError" }], - }], + `, + errors: [ + { messageId: "noKeywordsError" }, + { messageId: "noKeywordsError" }, + ], + }, + ], }); diff --git a/scripts/eslint/tests/no-type-assertion-whitespace.test.ts b/scripts/eslint/tests/no-type-assertion-whitespace.test.ts index d37968214e..4cc68fd3a0 100644 --- a/scripts/eslint/tests/no-type-assertion-whitespace.test.ts +++ b/scripts/eslint/tests/no-type-assertion-whitespace.test.ts @@ -9,23 +9,31 @@ const ruleTester = new RuleTester({ }); ruleTester.run("no-type-assertion-whitespace", rule, { - valid: [{ - code: `const a = 1`, - }, { - code: `const s = (new Symbol(1, 'name'));`, - }], + valid: [ + { + code: `const a = 1`, + }, + { + code: `const s = (new Symbol(1, 'name'));`, + }, + ], - invalid: [{ - code: `const a = 1`, - errors: [{ messageId: "noTypeAssertionWhitespace", column: 19, line: 1 }], - }, { - code: `const a = 1`, - errors: [{ messageId: "noTypeAssertionWhitespace", column: 19, line: 1 }], - }, { - code: `const a = 1`, - errors: [{ messageId: "noTypeAssertionWhitespace", column: 19, line: 1 }], - }, { - code: `const s = (new Symbol(1, 'name'));`, - errors: [{ messageId: "noTypeAssertionWhitespace", column: 17, line: 1 }], - }], + invalid: [ + { + code: `const a = 1`, + errors: [{ messageId: "noTypeAssertionWhitespace", column: 19, line: 1 }], + }, + { + code: `const a = 1`, + errors: [{ messageId: "noTypeAssertionWhitespace", column: 19, line: 1 }], + }, + { + code: `const a = 1`, + errors: [{ messageId: "noTypeAssertionWhitespace", column: 19, line: 1 }], + }, + { + code: `const s = (new Symbol(1, 'name'));`, + errors: [{ messageId: "noTypeAssertionWhitespace", column: 17, line: 1 }], + }, + ], }); diff --git a/scripts/eslint/tests/object-literal-surrounding-space.test.ts b/scripts/eslint/tests/object-literal-surrounding-space.test.ts index 16ec59cdd1..2e94a2b61f 100644 --- a/scripts/eslint/tests/object-literal-surrounding-space.test.ts +++ b/scripts/eslint/tests/object-literal-surrounding-space.test.ts @@ -9,32 +9,41 @@ const ruleTester = new RuleTester({ }); ruleTester.run("object-literal-surrounding-space", rule, { - valid: [{ - code: `const prop = {}`, - }, { - code: `const prop = { }`, - }, { - code: `const prop = { x: 1 }`, - }], + valid: [ + { + code: `const prop = {}`, + }, + { + code: `const prop = { }`, + }, + { + code: `const prop = { x: 1 }`, + }, + ], - invalid: [{ - code: `const prop = {x: 1}`, - errors: [{ - messageId: "leadingStringError", - }, { - messageId: "trailingStringError", - }], - }, { - code: `const prop = { x: 1 }`, - errors: [{ messageId: "leadingExcessStringError" }], - }, { - code: `const prop = { x: 1 }`, - errors: [{ messageId: "trailingExcessStringError" }], - }, { - code: `const prop = { x: 1}`, - errors: [{ messageId: "trailingStringError" }], - }, { - code: `const prop = {x: 1 }`, - errors: [{ messageId: "leadingStringError" }], - }], + invalid: [ + { + code: `const prop = {x: 1}`, + errors: [ + { messageId: "leadingStringError" }, + { messageId: "trailingStringError" } + ], + }, + { + code: `const prop = { x: 1 }`, + errors: [{ messageId: "leadingExcessStringError" }], + }, + { + code: `const prop = { x: 1 }`, + errors: [{ messageId: "trailingExcessStringError" }], + }, + { + code: `const prop = { x: 1}`, + errors: [{ messageId: "trailingStringError" }], + }, + { + code: `const prop = {x: 1 }`, + errors: [{ messageId: "leadingStringError" }], + }, + ], }); diff --git a/scripts/eslint/tests/only-arrow-functions.test.ts b/scripts/eslint/tests/only-arrow-functions.test.ts index 0f1e70a43a..0909e5b586 100644 --- a/scripts/eslint/tests/only-arrow-functions.test.ts +++ b/scripts/eslint/tests/only-arrow-functions.test.ts @@ -9,93 +9,119 @@ const ruleTester = new RuleTester({ }); ruleTester.run("only-arrow-functions", rule, { - valid: [{ - code: `const a = () => {};`, - }, { - code: `((func) => func())(() => {});`, - }, { - code: `function* generator() {}`, - }, { - code: `let generator = function*() {}`, - }, { - code: `function hasThisParameter(this) {}`, - }, { - code: `let hasThisParameter = function(this) {}`, - }, { - code: `let usesThis = function() { this; }`, - }, { - code: `let usesThis2 = function(foo = this) {}`, - }, { - code: ` - let fn = function fn() {}; - function z() {}; - `, - options: [{ allowNamedFunctions: true }], - }, { - code: ` + valid: [ + { + code: `const a = () => {};`, + }, + { + code: `((func) => func())(() => {});`, + }, + { + code: `function* generator() {}`, + }, + { + code: `let generator = function*() {}`, + }, + { + code: `function hasThisParameter(this) {}`, + }, + { + code: `let hasThisParameter = function(this) {}`, + }, + { + code: `let usesThis = function() { this; }`, + }, + { + code: `let usesThis2 = function(foo = this) {}`, + }, + { + code: ` +let fn = function fn() {}; +function z() {}; + `, + options: [{ allowNamedFunctions: true }], + }, + { + code: ` function fn() {}; let generator = function*() {} function hasThisParameter(this) {} let hasThisParameter = function(this) {} - `, - options: [{ allowDeclarations: true }], - }, { - code: ` + `, + options: [{ allowDeclarations: true }], + }, + { + code: ` class A { test() {} } `, - }, { - code: ` + }, + { + code: ` const obj = { test() {} } - `, - }], + `, + }, + ], - invalid: [{ - code: `function foo(a: any): any {}`, - errors: [{ messageId: "onlyArrowFunctionsError" }], - }, { - code: `let b = function () {};`, - errors: [{ messageId: "onlyArrowFunctionsError" }], - }, { - code: `function c() {}`, - errors: [{ messageId: "onlyArrowFunctionsError" }], - }, { - code: `((func) => func())(function e(): void {});`, - errors: [{ messageId: "onlyArrowFunctionsError" }], - }, { - code: ` + invalid: [ + { + code: `function foo(a: any): any {}`, + errors: [{ messageId: "onlyArrowFunctionsError" }], + }, + { + code: `let b = function () {};`, + errors: [{ messageId: "onlyArrowFunctionsError" }], + }, + { + code: `function c() {}`, + errors: [{ messageId: "onlyArrowFunctionsError" }], + }, + { + code: `((func) => func())(function e(): void {});`, + errors: [{ messageId: "onlyArrowFunctionsError" }], + }, + { + code: ` let notUsesThis = function() { function f() { this; } } - `, - errors: [{ messageId: "onlyArrowFunctionsError" }], - }, { - code: ` + `, + errors: [{ messageId: "onlyArrowFunctionsError" }], + }, + { + code: ` let notUsesThis2 = function() { return class { method() { this; } } } - `, - errors: [{ messageId: "onlyArrowFunctionsError" }], - }, { - code: `export function exported() {}`, - errors: [{ messageId: "onlyArrowFunctionsError" }], - }, { - code: `async function asyncFunction() {}`, - errors: [{ messageId: "onlyArrowFunctionsError" }], - }, { - code: ` - let b = function () {}; - ((func) => func())(function e(): void {}); - `, - options: [{ allowDeclarations: true }], - errors: [{ messageId: "onlyArrowFunctionsError" }, { messageId: "onlyArrowFunctionsError" }], - }, { - code: `const x = function() {}`, - options: [{ allowNamedFunctions: true }], - errors: [{ messageId: "onlyArrowFunctionsError" }], - }], + `, + errors: [{ messageId: "onlyArrowFunctionsError" }], + }, + { + code: `export function exported() {}`, + errors: [{ messageId: "onlyArrowFunctionsError" }], + }, + { + code: `async function asyncFunction() {}`, + errors: [{ messageId: "onlyArrowFunctionsError" }], + }, + { + code: ` +let b = function () {}; +((func) => func())(function e(): void {}); + `, + options: [{ allowDeclarations: true }], + errors: [ + { messageId: "onlyArrowFunctionsError" }, + { messageId: "onlyArrowFunctionsError" }, + ], + }, + { + code: `const x = function() {}`, + options: [{ allowNamedFunctions: true }], + errors: [{ messageId: "onlyArrowFunctionsError" }], + }, + ], }); - diff --git a/scripts/eslint/tests/type-operator-spacing.test.ts b/scripts/eslint/tests/type-operator-spacing.test.ts index 9e18d5796a..7654dfc9c5 100644 --- a/scripts/eslint/tests/type-operator-spacing.test.ts +++ b/scripts/eslint/tests/type-operator-spacing.test.ts @@ -9,27 +9,37 @@ const ruleTester = new RuleTester({ }); ruleTester.run("type-operator-spacing", rule, { - valid: [{ - code: `type T = string | number`, - }, { - code: `type T = string & number`, - }, { - code: `function fn(): string | number {}`, - }, { - code: `function fn(): string & number {}`, - }], + valid: [ + { + code: `type T = string | number`, + }, + { + code: `type T = string & number`, + }, + { + code: `function fn(): string | number {}`, + }, + { + code: `function fn(): string & number {}`, + }, + ], - invalid: [{ - code: `type T = string|number`, - errors: [{ messageId: "typeOperatorSpacingError" }], - }, { - code: `type T = string&number`, - errors: [{ messageId: "typeOperatorSpacingError" }], - }, { - code: `function fn(): string|number {}`, - errors: [{ messageId: "typeOperatorSpacingError" }], - }, { - code: `function fn(): string&number {}`, - errors: [{ messageId: "typeOperatorSpacingError" }], - }], + invalid: [ + { + code: `type T = string|number`, + errors: [{ messageId: "typeOperatorSpacingError" }], + }, + { + code: `type T = string&number`, + errors: [{ messageId: "typeOperatorSpacingError" }], + }, + { + code: `function fn(): string|number {}`, + errors: [{ messageId: "typeOperatorSpacingError" }], + }, + { + code: `function fn(): string&number {}`, + errors: [{ messageId: "typeOperatorSpacingError" }], + }, + ], });