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

Code before:
            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
                },
                {
                    messageId: "required",
                    type: "Literal",
                    data: { group: "(\\w{5})" },
                    line: 1,
                    column: 1,
                    endColumn: 21
                }
            ]
        },
        {
            code: "/([0-9]{4})-(5)/",
            errors: [
                {
                    messageId: "required",

Review comment (suggestion):
Can you also add `suggestions` to this test case? (below, `code: "/([0-9]{4})-(\\w{5})/"`)

Code after:
            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",
                    data: { group: "(\\w{5})" },
                    line: 1,