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

Code before:
            languageOptions: {
                parserOptions: {
                    ecmaFeatures: {
                        jsx: true
                    }
                }
            }
        }
    ],
    invalid: [
        {
            code:
            `let v = 'used';
            console.log(v);
            v = 'unused'`,
            errors: [
                {
                    messageId: "unnecessaryAssignment",
                    line: 3,
                    column: 13
                }
            ]
        },
        {
            code:
            `function foo() {
                let v = 'used';
                console.log(v);
                v = 'unused';
            }`,
            errors: [
                {
                    messageId: "unnecessaryAssignment",
                    line: 4,
                    column: 17
                }
            ]
        },
        {
            code:
            `function foo() {
                let v = 'used';
                if (condition) {
                    v = 'unused';
                    return
                }
                console.log(v);
            }`,
            errors: [
                {
                    messageId: "unnecessaryAssignment",

Review comment (suggestion):
```suggestion
        },
        {
            code: `/*eslint test/jsx:1*/
                function App() {
                    let A = "a";
                    A = "b";
                    A = "c";
                    foo(A);
                    return <A/>;
                }
            `,
            languageOptions: {
                parserOptions: {
                    ecmaFeatures: {
                        jsx: true
                    }
                }
            }
        }
```

One more test to confirm that these variables are entirely ignored.

Code after:
            languageOptions: {
                parserOptions: {
                    ecmaFeatures: {
                        jsx: true
                    }
                }
            }
        },
        {
            code: `/*eslint test/jsx:1*/
                function App() {
                    let A = "a";
                    A = "b";
                    A = "c";
                    foo(A);
                    return <A/>;
                }
            `,
            languageOptions: {
                parserOptions: {
                    ecmaFeatures: {
                        jsx: true
                    }
                }
            }
        }
    ],
    invalid: [
        {
            code:
            `let v = 'used';
            console.log(v);
            v = 'unused'`,
            errors: [
                {
                    messageId: "unnecessaryAssignment",
                    line: 3,
                    column: 13
                }
            ]
        },
        {
            code:
            `function foo() {
                let v = 'used';
                console.log(v);
                v = 'unused';
            }`,
            errors: [
                {
                    messageId: "unnecessaryAssignment",