HomePhabricator
Diffusion Comm 3eb025816e94

[RN72][skip-ci] Update Babel config for monorepo setup

Description

[RN72][skip-ci] Update Babel config for monorepo setup

Summary:
In the next diff, we update ESLint, which necessitates replacing the deprecated babel-eslint with the new @babel/eslint-parser.

The new @babel/eslint-parser appears to break yarn eslint:fix from the repo root, since it can't find a Babel config file.

To address this, I had to update our Babel config to work from the root. Some relevant docs I had to read:

In short, Babel's docs recommend that for a monorepo setup, you use a single babel.config.cjs file in the root, and then specify .babelrc.cjs files for individual workspaces. However, this didn't work with Jest, which was ignoring the .babelrc.cjs files. This is documented in issues on the Jest repo, but there are no official solutions. To get around this, I ended up also specifying babel.config.cjs files for the individual workspaces, that simply reference the .babelrc.cjs files.

Depends on D10536

Test Plan: In combination with the next diff, run yarn eslint:fix from the repo root

Reviewers: atul

Reviewed By: atul

Subscribers: tomek

Differential Revision: https://phab.comm.dev/D10537

Details

Provenance
ashoatAuthored on Jan 3 2024, 10:48 AM
Reviewer
atul
Differential Revision
D10537: [RN72][skip-ci] Update Babel config for monorepo setup
Parents
rCOMMeb98149eabb4: [RN72][skip-ci] Update Jest to 29
Branches
Unknown
Tags
Unknown