Issue 1:
(I don't know if it's really a bug or if we're not supposed to do this, but it works fine when using jsx)

When using the arrow function as a module exports, the generated code is wrong.

The following (useless but minimal) example

module.exports = () => arguments;

will lead to the generated code

var _arguments = arguments;
module.exports = function () {
return _arguments;
};

while

module.exports = function () { return arguments; };

leads to the correct version.

Issue 2:
Bug Report

I would like to work on a fix!

Current behavior

TypeError: Cannot read property 'range' of null
Occurred while linting /home/jayen/docs/work/ridethewaverley/ride-the-waverley/src/util/writeresource.js:1
at OffsetStorage.setDesiredOffset (/home/jayen/docs/work/ridethewaverley/ride-the-waverley/node_modules/eslint/lib/rules/indent.js:341:45)
at /home/jayen/docs/work/ridethewaverley/ride-the-waverley/node_modules/eslint/lib/rules/indent.js:1397:29
at Array.forEach (<anonymous>)
at Object.TemplateLiteral [as listener] (/home/jayen/docs/work/ridethewaverley/ride-the-waverley/node_modules/eslint/lib/rules/indent.js:1389:34)
at /home/jayen/docs/work/ridethewaverley/ride-the-waverley/node_modules/eslint/lib/rules/indent.js:1635:55
at Array.forEach (<anonymous>)
at Program:exit (/home/jayen/docs/work/ridethewaverley/ride-the-waverley/node_modules/eslint/lib/rules/indent.js:1635:26)
at /home/jayen/docs/work/ridethewaverley/ride-the-waverley/node_modules/eslint/lib/linter/safe-emitter.js:45:58
at Array.forEach (<anonymous>)
at Object.emit (/home/jayen/docs/work/ridethewaverley/ride-the-waverley/node_modules/eslint/lib/linter/safe-emitter.js:45:38)

Was not able to reproduce in codesandbox.

Input Code

const foo = '';
require(`${foo}`)?.bar;

Expected behavior

Expected an assignment or function call and instead saw an expression. (no-unused-expressions)

Babel Configuration (babel.config.js, .babelrc, package.json#babel, cli command, .eslintrc)

Filename: eslintrc-that-CRA4-wont-find.json

{
"extends": "react-app",
"rules": {
"array-bracket-spacing": [
"error",
"never"
],
"comma-dangle": [
"error",
"always-multiline"
],
"indent": [
"error",
2,
{
"CallExpression": {
"arguments": "first"
},
"MemberExpression": "off",
"flatTernaryExpressions": true,
"ignoredNodes": [
"JSXElement *"
]
}
],
"object-curly-spacing": [
"error",
"never"
],
"react/jsx-indent-props": [
"error",
"first"
],
"react/jsx-tag-spacing": [
"error",
{
"beforeSelfClosing": "never",
"beforeClosing": "never"
}
],
"react/self-closing-comp": [
"error",
{
"component": true,
"html": true
}
],
"sort-keys": [
"error",
"asc",
{
"caseSensitive": false,
"natural": true
}
],
"sort-vars": "error"
}
}

Environment

System:
OS: Linux 4.19 Debian GNU/Linux 10 (buster) 10 (buster)
Binaries:
Node: 14.16.0 - /usr/bin/node
Yarn: 1.22.5 - /usr/bin/yarn
npm: 6.14.11 - /usr/bin/npm
npmPackages:
@babel/eslint-parser: ^7.13.10 => 7.13.10
eslint: ^7.23.0 => 7.23.0

Babel version(s): [7.12.3]

Node/npm version: [Node 14.16.0/npm 6.14.11]

OS: [Linux 4.19 Debian GNU/Linux 10 (buster) 10 (buster)]

Monorepo: [no]

How you are using Babel: [eslint]

Possible Solution

No but my workaround is to separate the require from the optional chaining.

Additional context