It’s telling you to give the object being exported a name before exporting, to make it more likely that the name used is consistent throughout the codebase. For example, change to:
function init() {}
function log(error) {
console.error(error);
}
const logger = {
init,
log,
};
export default logger;
(Give it whatever name makes most sense in context – logger
is just an example)
But if you’re going to export multiple things, using named exports would make a bit more sense IMO. Another option is to do:
export function init() {}
export function log(error) {
console.error(error);
}
and then import them as:
import { init, log } from './foo.js';