This symbol table implementation includes a method that needs some adjustments:
public getAllSymbols(type?: typeof Symbol, localOnly = false): Promise<Set<Symbol>> {
const promise = super.getAllSymbols(type ?? Symbol, localOnly);
return new Promise(async (resolve, reject) => {
try {
let result = await promise;
if (!localOnly) {
this.dependencies.forEach(async (dependency) => {
result = new Set([...result, ...await dependency.getAllSymbols(type, localOnly)]);
});
}
resolve(result);
} catch (reason) {
reject(reason);
}
});
}
Although this code is functional, ESLint raises concerns about 2 promise misuses:
https://i.stack.imgur.com/1Z2fF.png
The linter error indicates a "Promise returned in function argument where a void return was expected.
no-misused-promises
".
To address this issue and eliminate the linting error, we need to make some modifications to the code structure.