Repository: eslint/eslint
File: tests/lib/rules/prefer-named-capture-group.js (JavaScript)

Code before:
        {
            code: "new RegExp('\u1234\u5678(?:a)(b)');",
            errors: [{
                messageId: "required",
                type: "NewExpression",
                data: { group: "(b)" },
                suggestions: [
                    {
                        messageId: "addGroupName",
                        output: "new RegExp('\u1234\u5678(?:a)(?<temp1>b)');"
                    },
                    {
                        messageId: "addNonCapture",
                        output: "new RegExp('\u1234\u5678(?:a)(?:b)');"
                    }
                ]
            }]
        },
        {
            code: "new RegExp('\\u1234\\u5678(?:a)(b)');",
            errors: [{
                messageId: "required",
                type: "NewExpression",
                data: { group: "(b)" }
            }]
        },
        {
            code: "/([0-9]{4})-(\\w{5})/",
            errors: [
                {
                    messageId: "required",
                    type: "Literal",
                    data: { group: "([0-9]{4})" },
                    line: 1,
                    column: 1,
                    endColumn: 21
                },
                {
                    messageId: "required",
                    type: "Literal",
                    data: { group: "(\\w{5})" },
                    line: 1,
                    column: 1,
                    endColumn: 21
                }
            ]
        },
        {
            code: "/([0-9]{4})-(5)/",
            errors: [
                {

Review comment (suggestion):
Can you also add `suggestions: null` in test cases where we're expecting no suggestions so that all tests have a `suggestions` property? Omitting ` suggestions` does not assert that there were no suggestions provided, it just doesn't check anything related to suggestions. This will be improved per [RFC #84](https://github.com/eslint/rfcs/tree/main/designs/2021-stricter-rule-test-validation) in the next major version, but at the moment we have to add `suggestions: null` if we want to check that the rule didn't provide suggestions.

Code after:
        {
            code: "new RegExp('\u1234\u5678(?:a)(b)');",
            errors: [{
                messageId: "required",
                type: "NewExpression",
                data: { group: "(b)" },
                suggestions: [
                    {
                        messageId: "addGroupName",
                        output: "new RegExp('\u1234\u5678(?:a)(?<temp1>b)');"
                    },
                    {
                        messageId: "addNonCapture",
                        output: "new RegExp('\u1234\u5678(?:a)(?:b)');"
                    }
                ]
            }]
        },
        {
            code: "new RegExp('\\u1234\\u5678(?:a)(b)');",
            errors: [{
                messageId: "required",
                type: "NewExpression",
                data: { group: "(b)" },
                suggestions: null
            }]
        },
        {
            code: "/([0-9]{4})-(\\w{5})/",
            errors: [
                {
                    messageId: "required",
                    type: "Literal",
                    data: { group: "([0-9]{4})" },
                    line: 1,
                    column: 1,
                    endColumn: 21,
                    suggestions: [
                        {
                            messageId: "addGroupName",
                            output: "/(?<temp1>[0-9]{4})-(\\w{5})/"
                        },
                        {
                            messageId: "addNonCapture",
                            output: "/(?:[0-9]{4})-(\\w{5})/"
                        }
                    ]
                },
                {
                    messageId: "required",
                    type: "Literal",