Skip to content

Commit

Permalink
Fixup template devDependencies (#35372)
Browse files Browse the repository at this point in the history
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: #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
  • Loading branch information
NickGerleman authored and facebook-github-bot committed Nov 17, 2022
1 parent 1ec1785 commit 418e957
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 1 deletion.
11 changes: 11 additions & 0 deletions scripts/run-ci-e2e-tests.js
Original file line number Diff line number Diff line change
Expand Up @@ -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');
Expand Down Expand Up @@ -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 {
Expand Down
4 changes: 3 additions & 1 deletion template/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand All @@ -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"
Expand Down

0 comments on commit 418e957

Please sign in to comment.