Repository: eslint/eslint
File: tests/lib/rules/logical-assignment-operators.js (JavaScript)

Code before:
        }, {
            code: "a += b",
            options: ["never"]
        }, {
            code: "a -= b",
            options: ["never"]
        }, {
            code: "a.b = a.b || c",
            options: ["never"]
        },

        // 3 or more operands
        {
            code: "a = a && b || c",
            options: ["always"]
        },
        {
            code: "a = a && b && c || d",
            options: ["always"]
        },
        {
            code: "a = (a || b) || c", // Ignore parentheses if used.
            options: ["always"]
        },
        {
            code: "a = (a && b) && c", // Ignore parentheses if used.
            options: ["always"]
        }
    ],
    invalid: [

        // Assignment
        {
            code: "a = a || b",
            output: "a ||= b",
            errors: [{ messageId: "assignment", type: "AssignmentExpression", data: { operator: "||=" }, suggestions: [] }]
        }, {
            code: "a = a && b",
            output: "a &&= b",
            errors: [{ messageId: "assignment", type: "AssignmentExpression", data: { operator: "&&=" }, suggestions: [] }]
        }, {
            code: "a = a ?? b",
            output: "a ??= b",
            errors: [{ messageId: "assignment", type: "AssignmentExpression", data: { operator: "??=" }, suggestions: [] }]
        }, {
            code: "foo = foo || bar",
            output: "foo ||= bar",
            errors: [{ messageId: "assignment", type: "AssignmentExpression", data: { operator: "||=" }, suggestions: [] }]
        },

        // > Right

Review comment (suggestion):
```suggestion
            code: "a = (a && b) && c", // Allow if parentheses are used.
```

Code after:
        }, {
            code: "a += b",
            options: ["never"]
        }, {
            code: "a -= b",
            options: ["never"]
        }, {
            code: "a.b = a.b || c",
            options: ["never"]
        },

        // 3 or more operands
        {
            code: "a = a && b || c",
            options: ["always"]
        },
        {
            code: "a = a && b && c || d",
            options: ["always"]
        },
        {
            code: "a = (a || b) || c", // Allow if parentheses are used.
            options: ["always"]
        },
        {
            code: "a = (a && b) && c", // Allow if parentheses are used.
            options: ["always"]
        },
        {
            code: "a = (a ?? b) ?? c", // Allow if parentheses are used.
            options: ["always"]
        }
    ],
    invalid: [

        // Assignment
        {
            code: "a = a || b",
            output: "a ||= b",
            errors: [{ messageId: "assignment", type: "AssignmentExpression", data: { operator: "||=" }, suggestions: [] }]
        }, {
            code: "a = a && b",
            output: "a &&= b",
            errors: [{ messageId: "assignment", type: "AssignmentExpression", data: { operator: "&&=" }, suggestions: [] }]
        }, {
            code: "a = a ?? b",
            output: "a ??= b",
            errors: [{ messageId: "assignment", type: "AssignmentExpression", data: { operator: "??=" }, suggestions: [] }]
        }, {
            code: "foo = foo || bar",
            output: "foo ||= bar",