Search code examples
node.jsecmascript-6babeljs

Babel ES6 unable to export function called new or delete


Babel and ESLint are throwing parsing errors when i try to export a function with the name "new" or "delete".

export function new () {}
export function delete () {}

Why is this happening? Is this a bug or is this not plausible because of babel?


Solution

  • Well new and delete are reserved words of JavaScript language. So they are not valid names for function.