Skip to content

Conversation

@cclauss
Copy link
Contributor

@cclauss cclauss commented Sep 12, 2025

https://github.com/astral-sh/ruff/releases

% ruff rule RUF059

unused-unpacked-variable (RUF059)

Derived from the Ruff-specific rules linter.

Fix is sometimes available.

What it does

Checks for the presence of unused variables in unpacked assignments.

Why is this bad?

A variable that is defined but never used can confuse readers.

If a variable is intentionally defined-but-not-used, it should be
prefixed with an underscore, or some other value that adheres to the
[lint.dummy-variable-rgx] pattern.

Example

def get_pair():
    return 1, 2


def foo():
    x, y = get_pair()
    return x

Use instead:

def foo():
    x, _ = get_pair()
    return x

See also

This rule applies only to unpacked assignments. For regular assignments, see
unused-variable.

Options

  • lint.dummy-variable-rgx

BEGIN_COMMIT_OVERRIDE
fix: Fix ruff v0.13.0 adds ruff rule RUF059
END_COMMIT_OVERRIDE

@cclauss cclauss merged commit bd4491a into nodejs:main Sep 12, 2025
42 checks passed
@cclauss cclauss deleted the ruff-0.13.0 branch September 12, 2025 16:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants