Fixup template devDependencies (#35372)

Summary:
Fixes missing/incorrect devDependencies in a newly built app. The previous set did not pull in prettier, causing linting to fail.  There was a peerDependency warning on yarn install. We also saw a separate lint warning at runtime specific to TS 4.9 being pulled in now, so we constrain in that version a bit.

Prettier and preset-env versions match the constraints and lockfiles of other RN packages.

## Changelog

[General] [Fixed] - Fixup template devDependencies

Pull Request resolved: https://github.com/facebook/react-native/pull/35372

Test Plan:
Created a new app targeting 0.71 via `react-native init`.

1. `yarn install --force` no longer shows warnings
2. `prettier` is installed, `yarn lint` no longer fails, and shows no warnings or errors
3. ~Tentatively a test step to add tests against linting in new app, but last time doing that in CircleCI led to timeouts with no output  that I didn't have time to debug, so maybe that's fixed now? �‍♀️.~ (edit: still hangs)

Reviewed By: NickGerleman

Differential Revision: D41363021

Pulled By: lunaleaps

fbshipit-source-id: d6163b01e8934d75a231fa0fd849d7bde7b3500c
This commit is contained in:
Nick Gerleman
2022-11-22 11:28:46 +00:00
committed by Lorenzo Sciandra
parent adfd21e035
commit ea22ee6bf6
2 changed files with 14 additions and 1 deletions
+11
View File
@@ -91,6 +91,7 @@ try {
mv('_bundle', '.bundle');
mv('_eslintrc.js', '.eslintrc.js');
mv('_prettierrc.js', '.prettierrc.js');
mv('_watchmanconfig', '.watchmanconfig');
describe('Install React Native package');
@@ -282,6 +283,16 @@ try {
exitCode = 1;
throw Error(exitCode);
}
// TODO: ESLint infinitely hangs when running in the environment created by
// this script, but not projects generated by `react-native init`.
/*
describe('Test: ESLint/Prettier linting and formatting');
if (exec('yarn lint').code) {
echo('linting errors were found');
exitCode = 1;
throw Error(exitCode);
}*/
}
exitCode = 0;
} finally {