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-16 18:47:42 -08:00 коммит произвёл Facebook GitHub Bot
Родитель 1ec1785e32
Коммит 418e95799f
2 изменённых файлов: 14 добавлений и 1 удалений

Просмотреть файл

@ -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 {

Просмотреть файл

@ -15,6 +15,7 @@
},
"devDependencies": {
"@babel/core": "^7.12.9",
"@babel/preset-env": "^7.14.0",
"@babel/runtime": "^7.12.5",
"@react-native-community/eslint-config": "^3.0.0",
"@tsconfig/react-native": "^2.0.2",
@ -27,8 +28,9 @@
"eslint": "^8.19.0",
"jest": "^29.2.1",
"metro-react-native-babel-preset": "0.73.3",
"prettier": "^2.4.1",
"react-test-renderer": "18.2.0",
"typescript": "^4.8.3"
"typescript": "4.8.4"
},
"jest": {
"preset": "react-native"