+ },
+ {
+ code: "f /*comment*/ ()",
+ output: null, // Don't remove comments
+ options: ["never"],
+ errors: [{ messageId: "unexpectedWhitespace" }]
+ },
+ {
+ code: "f /*\n*/ ()",
+ output: null, // Don't remove comments
+ options: ["never"],
+ errors: [{ messageId: "unexpectedWhitespace" }]
+ },
+ {
+ code: "f/*comment*/()",
+ output: "f/*comment*/ ()",
+ options: ["always"],
+ errors: [{ messageId: "missing" }]
+ },
+
+ // Optional chaining
+ {
+ code: "func ?.()",
+ output: "func?.()",
+ options: ["never"],
+ parserOptions: { ecmaVersion: 2020 },
+ errors: [{ messageId: "unexpectedWhitespace" }]
+ },
+ {
+ code: "func?. ()",
+ output: "func?.()",
+ options: ["never"],
+ parserOptions: { ecmaVersion: 2020 },
+ errors: [{ messageId: "unexpectedWhitespace" }]
+ },
+ {
+ code: "func ?. ()",
+ output: "func?.()",
+ options: ["never"],
+ parserOptions: { ecmaVersion: 2020 },
+ errors: [{ messageId: "unexpectedWhitespace" }]
+ },
+ {
+ code: "func\n?.()",
+ output: "func?.()",
+ options: ["never"],
+ parserOptions: { ecmaVersion: 2020 },
+ errors: [{ messageId: "unexpectedWhitespace" }]
+ },
+ {
+ code: "func\n//comment\n?.()",
+ output: null, // Don't remove comments
+ options: ["never"],
+ parserOptions: { ecmaVersion: 2020 },
+ errors: [{ messageId: "unexpectedWhitespace" }]
+ },
+ {
+ code: "func?.()",
+ output: null, // Not sure inserting a space into either before/after `?.`.
+ options: ["always"],
+ parserOptions: { ecmaVersion: 2020 },
+ errors: [{ messageId: "missing" }]
+ },
+ {
+ code: "func\n ?.()",
+ output: "func ?.()",
+ options: ["always"],
+ parserOptions: { ecmaVersion: 2020 },
+ errors: [{ messageId: "unexpectedNewline" }]
+ },
+ {
+ code: "func?.\n ()",
+ output: "func?. ()",
+ options: ["always"],
+ parserOptions: { ecmaVersion: 2020 },
+ errors: [{ messageId: "unexpectedNewline" }]
+ },
+ {
+ code: "func ?.\n ()",
+ output: "func ?. ()",
+ options: ["always"],
+ parserOptions: { ecmaVersion: 2020 },
+ errors: [{ messageId: "unexpectedNewline" }]
+ },
+ {
+ code: "func\n /*comment*/ ?.()",
+ output: null, // Don't remove comments
+ options: ["always"],
+ parserOptions: { ecmaVersion: 2020 },
+ errors: [{ messageId: "unexpectedNewline" }]