As of the date of this answer, I recommend to use the ruff extension of VSCode (using the ruff package without VSCode is also possible). The ruff FAQ state:
Ruff can be used as a drop-in replacement for Flake8 when used (1) without or with a small number of plugins, (2) alongside Black, and (3) on Python 3 code.
(with plugins, they mean flake8 plugins, e.g. flake8-use-pathlib.)
The advantage is that linting with ruff is faster and more common than with flake8.