// err
for (const key of Object.keys(mapping)) {
const value = mapping[key];
// ...
}
for (const key of Object.keys(mapping) as (keyof MappingType)[]) {
const value = mapping[key];
// ...
}
// ok
for (const value of Object.values(mapping)) {
// ...
}
I think we need to check if someone ids calling Object.keys() and then indexing into the variable they called Object.keys() on. Also need to check that they don't use key later in the block
I think we need to check if someone ids calling
Object.keys()
and then indexing into the variable they calledObject.keys()
on. Also need to check that they don't usekey
later in the blocksimilar: https://github.com/sbdchd/flake8-pie/issues/87