This seems to be the no-shadow
rule. The problem is that it doesn’t like that you have defined two variables with the same name: isSavingNonPostEntityChanges
(see code comments below).
const { isSaving, isSavingNonPostEntityChanges } = useSelect((select) => { // <-- here
const { isSavingPost, isSavingNonPostEntityChanges } = select(editorStore); // <-- and here
return {
isSaving: isSavingPost(),
isSavingNonPostEntityChanges: isSavingNonPostEntityChanges(),
};
});
There’s nothing technically wrong with using the same name in different scopes like this. There’s no actual conflict and your code will work just fine. This rule is just discouraging it because:
This can cause confusion while reading the code and it’s impossible to access the global variable.
A solution would be giving the properties you’re returning a unique name:
const { uniqueName, anotherUniqueName } = useSelect((select) => {
const { isSavingPost, isSavingNonPostEntityChanges } = select(editorStore);
return {
uniqueName: isSavingPost(),
anotherUniqueName: isSavingNonPostEntityChanges(),
};
});