Repository: eslint/eslint
File: tests/lib/rules/no-empty.js (JavaScript)

Code before:
        { code: "var foo = () => {};", parserOptions: { ecmaVersion: 6 } },
        "function foo() { }",
        "if (foo) {/* empty */}",
        "while (foo) {/* empty */}",
        "for (;foo;) {/* empty */}",
        "try { foo() } catch (ex) {/* empty */}",
        "try { foo() } catch (ex) {// empty\n}",
        "try { foo() } finally {// empty\n}",
        "try { foo() } finally {// test\n}",
        "try { foo() } finally {\n \n // hi i am off no use\n}",
        "try { foo() } catch (ex) {/* test111 */}",
        "if (foo) { bar() } else { // nothing in me \n}",
        "if (foo) { bar() } else { /**/ \n}",
        "if (foo) { bar() } else { // \n}",
        { code: "try { foo(); } catch (ex) {}", options: [{ allowEmptyCatch: true }] },
        { code: "try { foo(); } catch (ex) {} finally { bar(); }", options: [{ allowEmptyCatch: true }] }
    ],
    invalid: [
        {
            code: "try {} catch (ex) {throw ex}",
            errors: [{
                messageId: "unexpected",
                data: { type: "block" },
                type: "BlockStatement",
                suggestions: [{
                    messageId: "suggestComment",
                    output: "try { /* empty */ } catch (ex) {throw ex}"
                }]
            }]
        },
        {
            code: "try { foo() } catch (ex) {}",
            errors: [{
                messageId: "unexpected",
                data: { type: "block" },
                type: "BlockStatement",
                suggestions: [{
                    messageId: "suggestComment",
                    output: "try { foo() } catch (ex) { /* empty */ }"
                }]
            }]
        },
        {
            code: "try { foo() } catch (ex) {throw ex} finally {}",
            errors: [{
                messageId: "unexpected",
                data: { type: "block" },
                type: "BlockStatement",
                suggestions: [{
                    messageId: "suggestComment",
                    output: "try { foo() } catch (ex) {throw ex} finally { /* empty */ }"

Review comment (suggestion):
Since we are using `data` with these suggestion messages, we should also add `data` to suggestion objects in the test cases.

Code after:
        { code: "var foo = () => {};", parserOptions: { ecmaVersion: 6 } },
        "function foo() { }",
        "if (foo) {/* empty */}",
        "while (foo) {/* empty */}",
        "for (;foo;) {/* empty */}",
        "try { foo() } catch (ex) {/* empty */}",
        "try { foo() } catch (ex) {// empty\n}",
        "try { foo() } finally {// empty\n}",
        "try { foo() } finally {// test\n}",
        "try { foo() } finally {\n \n // hi i am off no use\n}",
        "try { foo() } catch (ex) {/* test111 */}",
        "if (foo) { bar() } else { // nothing in me \n}",
        "if (foo) { bar() } else { /**/ \n}",
        "if (foo) { bar() } else { // \n}",
        { code: "try { foo(); } catch (ex) {}", options: [{ allowEmptyCatch: true }] },
        { code: "try { foo(); } catch (ex) {} finally { bar(); }", options: [{ allowEmptyCatch: true }] }
    ],
    invalid: [
        {
            code: "try {} catch (ex) {throw ex}",
            errors: [{
                messageId: "unexpected",
                data: { type: "block" },
                type: "BlockStatement",
                suggestions: [{
                    messageId: "suggestComment",
                    data: { type: "block" },
                    output: "try { /* empty */ } catch (ex) {throw ex}"
                }]
            }]
        },
        {
            code: "try { foo() } catch (ex) {}",
            errors: [{
                messageId: "unexpected",
                data: { type: "block" },
                type: "BlockStatement",
                suggestions: [{
                    messageId: "suggestComment",
                    data: { type: "block" },
                    output: "try { foo() } catch (ex) { /* empty */ }"
                }]
            }]
        },
        {
            code: "try { foo() } catch (ex) {throw ex} finally {}",
            errors: [{
                messageId: "unexpected",
                data: { type: "block" },
                type: "BlockStatement",
                suggestions: [{