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

Code before:
                Object()
                `,
                languageOptions: { parserOptions: { ecmaFeatures: { jsx: true } } }
            },
            {
                code: `
                <foo></foo>
                Object()
                `,
                languageOptions: { parserOptions: { ecmaFeatures: { jsx: true } } }
            }
        ].map(props => ({
            ...props,
            errors: [{
                messageId: "preferLiteral",
                suggestions: [{
                    messageId: "useLiteralAfterSemicolon",
                    output: props.code.replace(/(new )?Object\(\)/u, ";({})")
                }]
            }]
        })),

        ...[
            {
                code: `
                {}
                Object()
                `
            },
            {
                code: `
                function foo() {}
                Object()
                `
            },
            {
                code: `
                class Foo {}
                Object()
                `
            },
            { code: "foo: Object();" },
            { code: "foo();Object();" },
            { code: "{ Object(); }" },
            { code: "if (a) Object();" },
            { code: "if (a); else Object();" },
            { code: "while (a) Object();" },
            {
                code: `
                do Object();
                while (a);

Review comment (suggestion):
```suggestion
            // No semicolon required before `({})` because ASI does not occur
            {
```

I think this comment should stay because it applies to all the items below it (until the next comment), not just to the one that has been removed now.

Code after:
                Object()
                `,
                languageOptions: { parserOptions: { ecmaFeatures: { jsx: true } } }
            },
            {
                code: `
                <foo></foo>
                Object()
                `,
                languageOptions: { parserOptions: { ecmaFeatures: { jsx: true } } }
            }
        ].map(props => ({
            ...props,
            errors: [{
                messageId: "preferLiteral",
                suggestions: [{
                    messageId: "useLiteralAfterSemicolon",
                    output: props.code.replace(/(new )?Object\(\)/u, ";({})")
                }]
            }]
        })),

        ...[

            // No semicolon required before `({})` because ASI does not occur
            {
                code: `
                {}
                Object()
                `
            },
            {
                code: `
                function foo() {}
                Object()
                `
            },
            {
                code: `
                class Foo {}
                Object()
                `
            },
            { code: "foo: Object();" },
            { code: "foo();Object();" },
            { code: "{ Object(); }" },
            { code: "if (a) Object();" },
            { code: "if (a); else Object();" },
            { code: "while (a) Object();" },
            {
                code: `