Rename anonymous default export functions ⇒ main

JavaScript pattern

Replaces export default function () { } with export default function main () { } and export default () => { } with const main = () => { }; export default main


Apply with the Grit CLI
grit apply no_anonymous_default_export

Name synchronous function declaration main

BEFORE
export default function () {
  console.log('test');
}
AFTER
export default function main() {
  console.log('test');
}

Name asynchronous function declaration main

BEFORE
export default async function (test) {
  console.log(test);
}
AFTER
export default async function main(test) {
  console.log(test);
}

Name arrow function main

BEFORE
export default async (test) => {
  console.log('test');
};
AFTER
const main = async (test) => {
  console.log('test');
};
export default main;