diff --git a/.eslintignore b/.eslintignore index 27c694cea55..2628bc87bab 100644 --- a/.eslintignore +++ b/.eslintignore @@ -1,6 +1,4 @@ node_modules/ -build -my-app* -packages/react-scripts/template -packages/react-scripts/fixtures -fixtures/ +build/ +test/fixtures/webpack-message-formatting/src/AppBabel.js +packages/react-error-overlay/lib/ diff --git a/.eslintrc.json b/.eslintrc.json index 40029410cce..7d6e9efcca0 100644 --- a/.eslintrc.json +++ b/.eslintrc.json @@ -14,5 +14,39 @@ "no-console": "off", "strict": ["error", "global"], "curly": "warn" - } + }, + "overrides": [ + { + "files": [ + "docusaurus/website/src/**/*.js", + "packages/cra-template/**/*.js", + "packages/react-error-overlay/**/*.js", + "packages/react-scripts/fixtures/kitchensink/template/{src,integration}/**/*.js", + "test/fixtures/*/src/*.js" + ], + "excludedFiles": ["packages/react-error-overlay/*.js"], + "extends": ["react-app", "react-app/jest"] + }, + { + "files": [ + "test/fixtures/webpack-message-formatting/src/{AppLintError,AppLintWarning,AppUnknownFile}.js" + ], + "rules": { + "no-unused-vars": "off", + "no-undef": "off" + } + }, + { + "files": ["test/fixtures/webpack-message-formatting/src/Export5.js"], + "rules": { + "import/no-anonymous-default-export": "off" + } + }, + { + "files": ["test/fixtures/issue-5176-flow-class-properties/src/App.js"], + "rules": { + "no-dupe-class-members": "off" + } + } + ] } diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 3ebb67c48e9..c5fea8809f2 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -1,6 +1,6 @@ name: Build -on: [push] +on: [push, pull_request] jobs: build: diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index d9835010a9c..456951bc671 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -1,6 +1,6 @@ name: Lint -on: [push] +on: [push, pull_request] jobs: lint: @@ -15,5 +15,11 @@ jobs: run: npm i -g npm@8 - name: Install run: npm ci --prefer-offline + - name: Build + run: npm run build - name: Alex run: npm run alex + - name: Prettier + run: npm run prettier -- --list-different + - name: Eslint + run: npm run eslint -- --max-warnings 0 diff --git a/.gitignore b/.gitignore index ffa71fafc6d..3ae88f84d8b 100644 --- a/.gitignore +++ b/.gitignore @@ -1,7 +1,7 @@ .idea/ .vscode/ node_modules/ -build +build/ .DS_Store *.tgz my-app* diff --git a/.prettierignore b/.prettierignore new file mode 100644 index 00000000000..18a58d393ef --- /dev/null +++ b/.prettierignore @@ -0,0 +1,9 @@ +build/ +package-lock.json +test/fixtures/webpack-message-formatting/src/AppBabel.js +test/fixtures/webpack-message-formatting/src/AppCss.css +packages/react-error-overlay/fixtures/bundle* +packages/react-error-overlay/fixtures/inline* +packages/react-error-overlay/fixtures/junk* +packages/react-error-overlay/lib/ +packages/react-error-overlay/coverage/ diff --git a/CHANGELOG.md b/CHANGELOG.md index b6e2fa0bfd5..28110503bc4 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,63 @@ +## 5.0.1 (2022-04-12) + +Create React App 5.0.1 is a maintenance release that improves compatibility with React 18. We've also updated our templates to use `createRoot` and relaxed our check for older versions of Create React App. + +# Migrating from 5.0.0 to 5.0.1 + +Inside any created project that has not been ejected, run: + +``` +npm install --save --save-exact react-scripts@5.0.1 +``` + +or + +``` +yarn add --exact react-scripts@5.0.1 +``` + +#### :bug: Bug Fix + +- `react-scripts` + - [#12245](https://github.com/facebook/create-react-app/pull/12245) fix: webpack noise printed only if error or warning ([@Andrew47](https://github.com/Andrew47)) +- `create-react-app` + - [#11915](https://github.com/facebook/create-react-app/pull/11915) Warn when not using the latest version of create-react-app but do not exit ([@iansu](https://github.com/iansu)) +- `react-dev-utils` + - [#11640](https://github.com/facebook/create-react-app/pull/11640) Ensure posix compliant joins for urls in middleware ([@psiservices-justin-sullard](https://github.com/psiservices-justin-sullard)) + +#### :nail_care: Enhancement + +- `cra-template-typescript`, `cra-template`, `react-scripts` + - [#12220](https://github.com/facebook/create-react-app/pull/12220) Update templates to use React 18 `createRoot` ([@kyletsang](https://github.com/kyletsang)) +- `cra-template-typescript`, `cra-template` + - [#12223](https://github.com/facebook/create-react-app/pull/12223) chore: upgrade rtl version to support react 18 ([@MatanBobi](https://github.com/MatanBobi)) +- `eslint-config-react-app` + - [#11622](https://github.com/facebook/create-react-app/pull/11622) updated deprecated rules ([@wisammechano](https://github.com/wisammechano)) + +#### :memo: Documentation + +- [#11594](https://github.com/facebook/create-react-app/pull/11594) Fix a typo in deployment.md ([@fishmandev](https://github.com/fishmandev)) +- [#11805](https://github.com/facebook/create-react-app/pull/11805) docs: Changelog 5.0.0 ([@jafin](https://github.com/jafin)) +- [#11757](https://github.com/facebook/create-react-app/pull/11757) prevent both npm and yarn commands from being copied ([@mubarakn](https://github.com/mubarakn)) + +#### :house: Internal + +- [#11985](https://github.com/facebook/create-react-app/pull/11985) Ignore docs when publishing ([@iansu](https://github.com/iansu)) + +#### Committers: 11 + +- Andrew Burnie ([@Andrew47](https://github.com/Andrew47)) +- ClΓ©ment Vannicatte ([@shortcuts](https://github.com/shortcuts)) +- Dmitriy Fishman ([@fishmandev](https://github.com/fishmandev)) +- Dmitry Vinnik ([@dmitryvinn](https://github.com/dmitryvinn)) +- Ian Sutherland ([@iansu](https://github.com/iansu)) +- Jason Finch ([@jafin](https://github.com/jafin)) +- Kyle Tsang ([@kyletsang](https://github.com/kyletsang)) +- Matan Borenkraout ([@MatanBobi](https://github.com/MatanBobi)) +- Wisam Naji ([@wisammechano](https://github.com/wisammechano)) +- [@mubarakn](https://github.com/mubarakn) +- [@psiservices-justin-sullard](https://github.com/psiservices-justin-sullard) + ## 5.0.0 (2021-12-14) Create React App 5.0 is a major release with several new features and the latest version of all major dependencies. diff --git a/docusaurus/docs/adding-typescript.md b/docusaurus/docs/adding-typescript.md index 75ebe493a3e..4a745707cc2 100644 --- a/docusaurus/docs/adding-typescript.md +++ b/docusaurus/docs/adding-typescript.md @@ -14,7 +14,9 @@ To start a new Create React App project with [TypeScript](https://www.typescript ```sh npx create-react-app my-app --template typescript ``` + or + ```sh yarn create react-app my-app --template typescript ``` @@ -28,7 +30,9 @@ To add [TypeScript](https://www.typescriptlang.org/) to an existing Create React ```sh npm install --save typescript @types/node @types/react @types/react-dom @types/jest ``` + or + ```sh yarn add typescript @types/node @types/react @types/react-dom @types/jest ``` diff --git a/docusaurus/docs/advanced-configuration.md b/docusaurus/docs/advanced-configuration.md index 34144ce6040..1e5358e537b 100644 --- a/docusaurus/docs/advanced-configuration.md +++ b/docusaurus/docs/advanced-configuration.md @@ -15,7 +15,7 @@ You can adjust various development and production settings by setting environmen | PORT | βœ… Used | 🚫 Ignored | By default, the development web server will attempt to listen on port 3000 or prompt you to attempt the next available port. You may use this variable to specify a different port. | | HTTPS | βœ… Used | 🚫 Ignored | When set to `true`, Create React App will run the development server in `https` mode. | | WDS_SOCKET_HOST | βœ… Used | 🚫 Ignored | When set, Create React App will run the development server with a custom websocket hostname for hot module reloading. Normally, `webpack-dev-server` defaults to `window.location.hostname` for the SockJS hostname. You may use this variable to start local development on more than one Create React App project at a time. See [webpack-dev-server documentation](https://webpack.js.org/configuration/dev-server/#devserversockhost) for more details. | -| WDS_SOCKET_PATH | βœ… Used | 🚫 Ignored | When set, Create React App will run the development server with a custom websocket path for hot module reloading. Normally, `webpack-dev-server` defaults to `/ws` for the SockJS pathname. You may use this variable to start local development on more than one Create React App project at a time. See [webpack-dev-server documentation](https://webpack.js.org/configuration/dev-server/#devserversockpath) for more details. | +| WDS_SOCKET_PATH | βœ… Used | 🚫 Ignored | When set, Create React App will run the development server with a custom websocket path for hot module reloading. Normally, `webpack-dev-server` defaults to `/ws` for the SockJS pathname. You may use this variable to start local development on more than one Create React App project at a time. See [webpack-dev-server documentation](https://webpack.js.org/configuration/dev-server/#devserversockpath) for more details. | | WDS_SOCKET_PORT | βœ… Used | 🚫 Ignored | When set, Create React App will run the development server with a custom websocket port for hot module reloading. Normally, `webpack-dev-server` defaults to `window.location.port` for the SockJS port. You may use this variable to start local development on more than one Create React App project at a time. See [webpack-dev-server documentation](https://webpack.js.org/configuration/dev-server/#devserversockport) for more details. | | PUBLIC_URL | βœ… Used | βœ… Used | Create React App assumes your application is hosted at the serving web server's root or a subpath as specified in [`package.json` (`homepage`)](deployment#building-for-relative-paths). Normally, Create React App ignores the hostname. You may use this variable to force assets to be referenced verbatim to the url you provide (hostname included). This may be particularly useful when using a CDN to host your application. | | BUILD_PATH | 🚫 Ignored | βœ… Used | By default, Create React App will output compiled assets to a `/build` directory adjacent to your `/src`. You may use this variable to specify a new path for Create React App to output assets. BUILD_PATH should be specified as a path relative to the root of your project. | @@ -24,7 +24,7 @@ You can adjust various development and production settings by setting environmen | CHOKIDAR_USEPOLLING | βœ… Used | 🚫 Ignored | When set to `true`, the watcher runs in polling mode, as necessary inside a VM. Use this option if `npm start` isn't detecting changes. | | GENERATE_SOURCEMAP | 🚫 Ignored | βœ… Used | When set to `false`, source maps are not generated for a production build. This solves out of memory (OOM) issues on some smaller machines. | | INLINE_RUNTIME_CHUNK | 🚫 Ignored | βœ… Used | By default, Create React App will embed the runtime script into `index.html` during the production build. When set to `false`, the script will not be embedded and will be imported as usual. This is normally required when dealing with CSP. | -| IMAGE_INLINE_SIZE_LIMIT | βœ… Used | βœ… Used | By default, images smaller than 10,000 bytes are encoded as a data URI in base64 and inlined in the CSS or JS build artifact. Set this to control the size limit in bytes. Setting it to `0` will disable the inlining of images. | +| IMAGE_INLINE_SIZE_LIMIT | βœ… Used | βœ… Used | By default, images smaller than 10,000 bytes are encoded as a data URI in base64 and inlined in the CSS or JS build artifact. Set this to control the size limit in bytes. Setting it to `0` will disable the inlining of images. | | FAST_REFRESH | βœ… Used | 🚫 Ignored | When set to `false`, disables experimental support for Fast Refresh to allow you to tweak your components in real time without reloading the page. | | TSC_COMPILE_ON_ERROR | βœ… Used | βœ… Used | When set to `true`, you can run and properly build TypeScript projects even if there are TypeScript type check errors. These errors are printed as warnings in the terminal and/or browser console. | | ESLINT_NO_DEV_ERRORS | βœ… Used | 🚫 Ignored | When set to `true`, ESLint errors are converted to warnings during development. As a result, ESLint output will no longer appear in the error overlay. | diff --git a/docusaurus/docs/loading-graphql-files.md b/docusaurus/docs/loading-graphql-files.md index 1d50dcc9875..aa72e5af475 100644 --- a/docusaurus/docs/loading-graphql-files.md +++ b/docusaurus/docs/loading-graphql-files.md @@ -57,7 +57,7 @@ You can also use the `gql` template tag the same way you would use the non-macro ```js import { gql } from 'graphql.macro'; - + const query = gql` query User { user(id: 5) { diff --git a/docusaurus/docs/proxying-api-requests-in-development.md b/docusaurus/docs/proxying-api-requests-in-development.md index 66563e25e45..11cf1198265 100644 --- a/docusaurus/docs/proxying-api-requests-in-development.md +++ b/docusaurus/docs/proxying-api-requests-in-development.md @@ -87,7 +87,7 @@ Next, create `src/setupProxy.js` and place the following contents in it: ```js const { createProxyMiddleware } = require('http-proxy-middleware'); -module.exports = function(app) { +module.exports = function (app) { // ... }; ``` @@ -97,7 +97,7 @@ You can now register proxies as you wish! Here's an example using the above `htt ```js const { createProxyMiddleware } = require('http-proxy-middleware'); -module.exports = function(app) { +module.exports = function (app) { app.use( '/api', createProxyMiddleware({ diff --git a/docusaurus/website/docusaurus.config.js b/docusaurus/website/docusaurus.config.js index ff233930156..9c9893a9042 100644 --- a/docusaurus/website/docusaurus.config.js +++ b/docusaurus/website/docusaurus.config.js @@ -4,6 +4,7 @@ * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. */ +'use strict'; const siteConfig = { title: 'Create React App', @@ -43,8 +44,8 @@ const siteConfig = { isCloseable: false, }, algolia: { - appId: 'create-react-app', - apiKey: '3be60f4f8ffc24c75da84857d6323791', + appId: 'AUJYIQ70HN', + apiKey: '25243dbf9049cf036e87f64b361bd2b9', indexName: 'create-react-app', }, navbar: { @@ -88,8 +89,7 @@ const siteConfig = { items: [ { label: 'Stack Overflow', - href: - 'https://stackoverflow.com/questions/tagged/create-react-app', + href: 'https://stackoverflow.com/questions/tagged/create-react-app', }, { label: 'GitHub Discussions', @@ -101,8 +101,7 @@ const siteConfig = { }, { label: 'Contributor Covenant', - href: - 'https://www.contributor-covenant.org/version/1/4/code-of-conduct', + href: 'https://www.contributor-covenant.org/version/1/4/code-of-conduct', }, ], }, diff --git a/docusaurus/website/src/css/custom.css b/docusaurus/website/src/css/custom.css index 18b886fc4a7..0e0750571b4 100644 --- a/docusaurus/website/src/css/custom.css +++ b/docusaurus/website/src/css/custom.css @@ -32,31 +32,30 @@ max-width: 100%; } - /* Announcement banner */ :root { --docusaurus-announcement-bar-height: auto !important; } -div[class^="announcementBar"][role="banner"] { +div[class^='announcementBar'][role='banner'] { border-bottom-color: var(--deepdark); } -div[class^="announcementBarContent"] { +div[class^='announcementBarContent'] { line-height: 40px; font-size: 20px; font-weight: bold; padding: 8px 30px; } -div[class^="announcementBarContent"] a { +div[class^='announcementBarContent'] a { text-decoration: underline; display: inline-block; color: var(--ifm-color-primary) !important; } -div[class^="announcementBarContent"] a:hover { +div[class^='announcementBarContent'] a:hover { color: var(--brand) !important; } diff --git a/docusaurus/website/src/pages/index.js b/docusaurus/website/src/pages/index.js index feda132f3c1..5efc1fa9856 100644 --- a/docusaurus/website/src/pages/index.js +++ b/docusaurus/website/src/pages/index.js @@ -68,10 +68,7 @@ function Home() {
{features.map(({ title, content }, idx) => ( -
+

{title}

{content}

diff --git a/package-lock.json b/package-lock.json index c3624593b97..9dcdf0f1df6 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,5 +1,5 @@ { - "name": "create-react-app-main", + "name": "create-react-app", "lockfileVersion": 2, "requires": true, "packages": { @@ -36,6 +36,7 @@ } }, "docusaurus/website": { + "name": "cra-docs", "dependencies": { "@docusaurus/core": "^2.0.0-alpha.64", "@docusaurus/preset-classic": "^2.0.0-alpha.64", @@ -11360,6 +11361,10 @@ "node": ">=10" } }, + "node_modules/cra-docs": { + "resolved": "docusaurus/website", + "link": true + }, "node_modules/cra-template": { "resolved": "packages/cra-template", "link": true @@ -28928,10 +28933,6 @@ "webpack": "3 || 4 || 5" } }, - "node_modules/website": { - "resolved": "docusaurus/website", - "link": true - }, "node_modules/websocket-driver": { "version": "0.7.4", "resolved": "https://registry.npmjs.org/websocket-driver/-/websocket-driver-0.7.4.tgz", @@ -29947,6 +29948,15 @@ "cross-env": "^7.0.3", "eslint": "^8.3.0", "eslint-config-react-app": "^7.0.0", +<<<<<<< HEAD +======= +======= +<<<<<<< HEAD +>>>>>>> f21e2137 (Publish) +======= +>>>>>>> 9f8d75e5 (chore(lint): lint all files) +>>>>>>> fb003998 (chore(lint): lint all files) +>>>>>>> f301bfe4 (chore(lint): lint all files) "flow-bin": "^0.116.0", "html-entities": "^2.3.2", "jest": "^27.4.3", @@ -30028,8 +30038,8 @@ "react-scripts": "bin/react-scripts.js" }, "devDependencies": { - "react": "^17.0.2", - "react-dom": "^17.0.2" + "react": "^18.0.0", + "react-dom": "^18.0.0" }, "engines": { "node": ">=14.0.0" @@ -30047,6 +30057,40 @@ } } }, + "packages/react-scripts/node_modules/react": { + "version": "18.0.0", + "resolved": "https://registry.npmjs.org/react/-/react-18.0.0.tgz", + "integrity": "sha512-x+VL6wbT4JRVPm7EGxXhZ8w8LTROaxPXOqhlGyVSrv0sB1jkyFGgXxJ8LVoPRLvPR6/CIZGFmfzqUa2NYeMr2A==", + "dev": true, + "dependencies": { + "loose-envify": "^1.1.0" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "packages/react-scripts/node_modules/react-dom": { + "version": "18.0.0", + "resolved": "https://registry.npmjs.org/react-dom/-/react-dom-18.0.0.tgz", + "integrity": "sha512-XqX7uzmFo0pUceWFCt7Gff6IyIMzFUn7QMZrbrQfGxtaxXZIcGQzoNpRLE3fQLnS4XzLLPMZX2T9TRcSrasicw==", + "dev": true, + "dependencies": { + "loose-envify": "^1.1.0", + "scheduler": "^0.21.0" + }, + "peerDependencies": { + "react": "^18.0.0" + } + }, + "packages/react-scripts/node_modules/scheduler": { + "version": "0.21.0", + "resolved": "https://registry.npmjs.org/scheduler/-/scheduler-0.21.0.tgz", + "integrity": "sha512-1r87x5fz9MXqswA2ERLo0EbOAU74DpIUO090gIasYTqlVoJeMcl+Z1Rg7WHz+qtPujhS/hGIt9kxZOYBV3faRQ==", + "dev": true, + "dependencies": { + "loose-envify": "^1.1.0" + } + }, "packages/react-scripts/node_modules/semver": { "version": "7.3.5", "resolved": "https://registry.npmjs.org/semver/-/semver-7.3.5.tgz", @@ -38551,6 +38595,48 @@ "yaml": "^1.10.0" } }, + "cra-docs": { + "version": "file:docusaurus/website", + "requires": { + "@docusaurus/core": "^2.0.0-alpha.64", + "@docusaurus/preset-classic": "^2.0.0-alpha.64", + "clsx": "^1.1.1", + "react": "^16.12.0", + "react-dom": "^16.12.0" + }, + "dependencies": { + "react": { + "version": "16.14.0", + "resolved": "https://registry.npmjs.org/react/-/react-16.14.0.tgz", + "integrity": "sha512-0X2CImDkJGApiAlcf0ODKIneSwBPhqJawOa5wCtKbu7ZECrmS26NvtSILynQ66cgkT/RJ4LidJOc3bUESwmU8g==", + "requires": { + "loose-envify": "^1.1.0", + "object-assign": "^4.1.1", + "prop-types": "^15.6.2" + } + }, + "react-dom": { + "version": "16.14.0", + "resolved": "https://registry.npmjs.org/react-dom/-/react-dom-16.14.0.tgz", + "integrity": "sha512-1gCeQXDLoIqMgqD3IO2Ah9bnf0w9kzhwN5q4FGnHZ67hBm9yePzB5JJAIQCc8x3pFnNlwFq4RidZggNAAkzWWw==", + "requires": { + "loose-envify": "^1.1.0", + "object-assign": "^4.1.1", + "prop-types": "^15.6.2", + "scheduler": "^0.19.1" + } + }, + "scheduler": { + "version": "0.19.1", + "resolved": "https://registry.npmjs.org/scheduler/-/scheduler-0.19.1.tgz", + "integrity": "sha512-n/zwRWRYSUj0/3g/otKDRPMh6qv2SYMWNq85IEa8iZyAv8od9zDYpGSnpBEjNgcMNq6Scbu5KfIPxNF72R/2EA==", + "requires": { + "loose-envify": "^1.1.0", + "object-assign": "^4.1.1" + } + } + } + }, "cra-template": { "version": "file:packages/cra-template" }, @@ -47251,8 +47337,19 @@ "chalk": "^4.1.2", "chokidar": "^3.5.2", "cross-env": "^7.0.3", +<<<<<<< HEAD + "eslint": "^8.3.0", + "eslint-config-react-app": "^7.0.0", +======= +<<<<<<< HEAD +======= +<<<<<<< HEAD "eslint": "^8.3.0", "eslint-config-react-app": "^7.0.0", +======= +>>>>>>> 9f8d75e5 (chore(lint): lint all files) +>>>>>>> fb003998 (chore(lint): lint all files) +>>>>>>> f301bfe4 (chore(lint): lint all files) "flow-bin": "^0.116.0", "html-entities": "^2.3.2", "jest": "^27.4.3", @@ -47426,10 +47523,10 @@ "postcss-normalize": "^10.0.1", "postcss-preset-env": "^7.0.1", "prompts": "^2.4.2", - "react": "^17.0.2", + "react": "^18.0.0", "react-app-polyfill": "^3.0.0", "react-dev-utils": "^12.0.0", - "react-dom": "^17.0.2", + "react-dom": "^18.0.0", "react-refresh": "^0.11.0", "resolve": "^1.20.0", "resolve-url-loader": "^4.0.0", @@ -47445,6 +47542,34 @@ "workbox-webpack-plugin": "^6.4.1" }, "dependencies": { + "react": { + "version": "18.0.0", + "resolved": "https://registry.npmjs.org/react/-/react-18.0.0.tgz", + "integrity": "sha512-x+VL6wbT4JRVPm7EGxXhZ8w8LTROaxPXOqhlGyVSrv0sB1jkyFGgXxJ8LVoPRLvPR6/CIZGFmfzqUa2NYeMr2A==", + "dev": true, + "requires": { + "loose-envify": "^1.1.0" + } + }, + "react-dom": { + "version": "18.0.0", + "resolved": "https://registry.npmjs.org/react-dom/-/react-dom-18.0.0.tgz", + "integrity": "sha512-XqX7uzmFo0pUceWFCt7Gff6IyIMzFUn7QMZrbrQfGxtaxXZIcGQzoNpRLE3fQLnS4XzLLPMZX2T9TRcSrasicw==", + "dev": true, + "requires": { + "loose-envify": "^1.1.0", + "scheduler": "^0.21.0" + } + }, + "scheduler": { + "version": "0.21.0", + "resolved": "https://registry.npmjs.org/scheduler/-/scheduler-0.21.0.tgz", + "integrity": "sha512-1r87x5fz9MXqswA2ERLo0EbOAU74DpIUO090gIasYTqlVoJeMcl+Z1Rg7WHz+qtPujhS/hGIt9kxZOYBV3faRQ==", + "dev": true, + "requires": { + "loose-envify": "^1.1.0" + } + }, "semver": { "version": "7.3.5", "resolved": "https://registry.npmjs.org/semver/-/semver-7.3.5.tgz", @@ -51985,48 +52110,6 @@ "std-env": "^3.0.1" } }, - "website": { - "version": "file:docusaurus/website", - "requires": { - "@docusaurus/core": "^2.0.0-alpha.64", - "@docusaurus/preset-classic": "^2.0.0-alpha.64", - "clsx": "^1.1.1", - "react": "^16.12.0", - "react-dom": "^16.12.0" - }, - "dependencies": { - "react": { - "version": "16.14.0", - "resolved": "https://registry.npmjs.org/react/-/react-16.14.0.tgz", - "integrity": "sha512-0X2CImDkJGApiAlcf0ODKIneSwBPhqJawOa5wCtKbu7ZECrmS26NvtSILynQ66cgkT/RJ4LidJOc3bUESwmU8g==", - "requires": { - "loose-envify": "^1.1.0", - "object-assign": "^4.1.1", - "prop-types": "^15.6.2" - } - }, - "react-dom": { - "version": "16.14.0", - "resolved": "https://registry.npmjs.org/react-dom/-/react-dom-16.14.0.tgz", - "integrity": "sha512-1gCeQXDLoIqMgqD3IO2Ah9bnf0w9kzhwN5q4FGnHZ67hBm9yePzB5JJAIQCc8x3pFnNlwFq4RidZggNAAkzWWw==", - "requires": { - "loose-envify": "^1.1.0", - "object-assign": "^4.1.1", - "prop-types": "^15.6.2", - "scheduler": "^0.19.1" - } - }, - "scheduler": { - "version": "0.19.1", - "resolved": "https://registry.npmjs.org/scheduler/-/scheduler-0.19.1.tgz", - "integrity": "sha512-n/zwRWRYSUj0/3g/otKDRPMh6qv2SYMWNq85IEa8iZyAv8od9zDYpGSnpBEjNgcMNq6Scbu5KfIPxNF72R/2EA==", - "requires": { - "loose-envify": "^1.1.0", - "object-assign": "^4.1.1" - } - } - } - }, "websocket-driver": { "version": "0.7.4", "resolved": "https://registry.npmjs.org/websocket-driver/-/websocket-driver-0.7.4.tgz", diff --git a/package.json b/package.json index 9e6f050be2f..d4217526b63 100644 --- a/package.json +++ b/package.json @@ -18,7 +18,9 @@ "alex": "alex .", "test:integration": "jest test/integration", "test": "cd packages/react-scripts && node bin/react-scripts.js test", - "format": "prettier --write 'packages/*/*.js' 'packages/*/!(node_modules)/**/*.js'" + "eslint": "eslint .", + "prettier": "prettier .", + "format": "npm run prettier -- --write" }, "devDependencies": { "@testing-library/jest-dom": "^5.15.1", diff --git a/packages/babel-plugin-named-asset-import/index.test.js b/packages/babel-plugin-named-asset-import/index.test.js index 2457a41b816..fff2c28894e 100644 --- a/packages/babel-plugin-named-asset-import/index.test.js +++ b/packages/babel-plugin-named-asset-import/index.test.js @@ -1,3 +1,5 @@ +'use strict'; + const pluginTester = require('babel-plugin-tester/pure'); const namedAssetImport = require('./index'); @@ -39,8 +41,7 @@ pluginTester.default({ 'import { ReactComponent as logo } from "@svgr/webpack?-svgo!logo.svg";', }, svgMultipleImport: { - code: - 'import logo, { logoUrl , ReactComponent as Logo } from "logo.svg";', + code: 'import logo, { logoUrl , ReactComponent as Logo } from "logo.svg";', output: 'import logo from "logo.svg";\n' + 'import { logoUrl } from "logo.svg";\n' + diff --git a/packages/cra-template-typescript/package.json b/packages/cra-template-typescript/package.json index 4a56592128e..2dbd39d9fd9 100644 --- a/packages/cra-template-typescript/package.json +++ b/packages/cra-template-typescript/package.json @@ -1,6 +1,6 @@ { "name": "cra-template-typescript", - "version": "1.1.3", + "version": "1.2.0", "keywords": [ "react", "create-react-app", diff --git a/packages/cra-template-typescript/template.json b/packages/cra-template-typescript/template.json index 5119fb26f18..db2d4761047 100644 --- a/packages/cra-template-typescript/template.json +++ b/packages/cra-template-typescript/template.json @@ -2,12 +2,12 @@ "package": { "dependencies": { "@testing-library/jest-dom": "^5.14.1", - "@testing-library/react": "^12.0.0", + "@testing-library/react": "^13.0.0", "@testing-library/user-event": "^13.2.1", "@types/jest": "^27.0.1", "@types/node": "^16.7.13", - "@types/react": "^17.0.20", - "@types/react-dom": "^17.0.9", + "@types/react": "^18.0.0", + "@types/react-dom": "^18.0.0", "typescript": "^4.4.2", "web-vitals": "^2.1.0" }, diff --git a/packages/cra-template-typescript/template/src/index.tsx b/packages/cra-template-typescript/template/src/index.tsx index ef2edf8ea3f..032464fb6ec 100644 --- a/packages/cra-template-typescript/template/src/index.tsx +++ b/packages/cra-template-typescript/template/src/index.tsx @@ -1,14 +1,16 @@ import React from 'react'; -import ReactDOM from 'react-dom'; +import ReactDOM from 'react-dom/client'; import './index.css'; import App from './App'; import reportWebVitals from './reportWebVitals'; -ReactDOM.render( +const root = ReactDOM.createRoot( + document.getElementById('root') as HTMLElement +); +root.render( - , - document.getElementById('root') + ); // If you want to start measuring performance in your app, pass a function diff --git a/packages/cra-template/package.json b/packages/cra-template/package.json index 687e19c5a19..a8d51d72810 100644 --- a/packages/cra-template/package.json +++ b/packages/cra-template/package.json @@ -1,6 +1,6 @@ { "name": "cra-template", - "version": "1.1.3", + "version": "1.2.0", "keywords": [ "react", "create-react-app", diff --git a/packages/cra-template/template.json b/packages/cra-template/template.json index 6094aa8d4c8..7610e572c16 100644 --- a/packages/cra-template/template.json +++ b/packages/cra-template/template.json @@ -2,7 +2,7 @@ "package": { "dependencies": { "@testing-library/jest-dom": "^5.14.1", - "@testing-library/react": "^12.0.0", + "@testing-library/react": "^13.0.0", "@testing-library/user-event": "^13.2.1", "web-vitals": "^2.1.0" }, diff --git a/packages/cra-template/template/src/index.js b/packages/cra-template/template/src/index.js index ef2edf8ea3f..d563c0fb10b 100644 --- a/packages/cra-template/template/src/index.js +++ b/packages/cra-template/template/src/index.js @@ -1,14 +1,14 @@ import React from 'react'; -import ReactDOM from 'react-dom'; +import ReactDOM from 'react-dom/client'; import './index.css'; import App from './App'; import reportWebVitals from './reportWebVitals'; -ReactDOM.render( +const root = ReactDOM.createRoot(document.getElementById('root')); +root.render( - , - document.getElementById('root') + ); // If you want to start measuring performance in your app, pass a function diff --git a/packages/create-react-app/createReactApp.js b/packages/create-react-app/createReactApp.js index 6a2bb06b76e..b3c7ca7c1d6 100755 --- a/packages/create-react-app/createReactApp.js +++ b/packages/create-react-app/createReactApp.js @@ -209,22 +209,15 @@ function init() { console.error( chalk.yellow( `You are running \`create-react-app\` ${packageJson.version}, which is behind the latest release (${latest}).\n\n` + - 'We no longer support global installation of Create React App.' + 'We recommend always using the latest version of create-react-app if possible.' ) ); console.log(); - console.log( - 'Please remove any global installs with one of the following commands:\n' + - '- npm uninstall -g create-react-app\n' + - '- yarn global remove create-react-app' - ); - console.log(); console.log( 'The latest instructions for creating a new app can be found here:\n' + 'https://create-react-app.dev/docs/getting-started/' ); console.log(); - process.exit(1); } else { const useYarn = isUsingYarn(); createApp( diff --git a/packages/create-react-app/package.json b/packages/create-react-app/package.json index f10768fa9a6..0624a442834 100644 --- a/packages/create-react-app/package.json +++ b/packages/create-react-app/package.json @@ -1,6 +1,6 @@ { "name": "create-react-app", - "version": "5.0.0", + "version": "5.0.1", "keywords": [ "react" ], diff --git a/packages/eslint-config-react-app/package.json b/packages/eslint-config-react-app/package.json index 62d9a768ee2..a658e95648d 100644 --- a/packages/eslint-config-react-app/package.json +++ b/packages/eslint-config-react-app/package.json @@ -1,6 +1,6 @@ { "name": "eslint-config-react-app", - "version": "7.0.0", + "version": "7.0.1", "description": "ESLint configuration used by Create React App", "repository": { "type": "git", diff --git a/packages/react-dev-utils/ModuleScopePlugin.js b/packages/react-dev-utils/ModuleScopePlugin.js index e2c16ffd819..ee4aa685570 100644 --- a/packages/react-dev-utils/ModuleScopePlugin.js +++ b/packages/react-dev-utils/ModuleScopePlugin.js @@ -15,7 +15,9 @@ class ModuleScopePlugin { constructor(appSrc, allowedFiles = []) { this.appSrcs = Array.isArray(appSrc) ? appSrc : [appSrc]; this.allowedFiles = new Set(allowedFiles); - this.allowedPaths = [...allowedFiles].map(path.dirname).filter(p => path.relative(p, process.cwd()) !== ''); + this.allowedPaths = [...allowedFiles] + .map(path.dirname) + .filter(p => path.relative(p, process.cwd()) !== ''); } apply(resolver) { @@ -54,9 +56,11 @@ class ModuleScopePlugin { if (this.allowedFiles.has(requestFullPath)) { return callback(); } - if (this.allowedPaths.some((allowedFile) => { - return requestFullPath.startsWith(allowedFile); - })) { + if ( + this.allowedPaths.some(allowedFile => { + return requestFullPath.startsWith(allowedFile); + }) + ) { return callback(); } // Find path from src to the requested file diff --git a/packages/react-dev-utils/evalSourceMapMiddleware.js b/packages/react-dev-utils/evalSourceMapMiddleware.js index 2e6c9a1c4d4..e6c57d0d618 100644 --- a/packages/react-dev-utils/evalSourceMapMiddleware.js +++ b/packages/react-dev-utils/evalSourceMapMiddleware.js @@ -15,7 +15,7 @@ function base64SourceMap(source) { function getSourceById(server, id) { const module = Array.from(server._stats.compilation.modules).find( - (m) => server._stats.compilation.chunkGraph.getModuleId(m) == id, + m => server._stats.compilation.chunkGraph.getModuleId(m) == id ); return module.originalSource(); } diff --git a/packages/react-dev-utils/getProcessForPort.js b/packages/react-dev-utils/getProcessForPort.js index a2e3f7c4a06..b83477edf4e 100644 --- a/packages/react-dev-utils/getProcessForPort.js +++ b/packages/react-dev-utils/getProcessForPort.js @@ -26,7 +26,11 @@ function isProcessAReactApp(processCommand) { } function getProcessIdOnPort(port) { - return execFileSync('lsof', ['-i:' + port, '-P', '-t', '-sTCP:LISTEN'], execOptions) + return execFileSync( + 'lsof', + ['-i:' + port, '-P', '-t', '-sTCP:LISTEN'], + execOptions + ) .split('\n')[0] .trim(); } diff --git a/packages/react-dev-utils/launchEditor.js b/packages/react-dev-utils/launchEditor.js index 3f298f6cf2b..0db0ca5fe58 100644 --- a/packages/react-dev-utils/launchEditor.js +++ b/packages/react-dev-utils/launchEditor.js @@ -112,7 +112,8 @@ const COMMON_EDITORS_WIN = [ // Transpiled version of: /^([A-Za-z]:[/\\])?[\p{L}0-9/.\-_\\]+$/u // Non-transpiled version requires support for Unicode property regex. Allows // alphanumeric characters, periods, dashes, slashes, and underscores. -const WINDOWS_FILE_NAME_WHITELIST = /^([A-Za-z]:[/\\])?(?:[\x2D-9A-Z\\_a-z\xAA\xB5\xBA\xC0-\xD6\xD8-\xF6\xF8-\u02C1\u02C6-\u02D1\u02E0-\u02E4\u02EC\u02EE\u0370-\u0374\u0376\u0377\u037A-\u037D\u037F\u0386\u0388-\u038A\u038C\u038E-\u03A1\u03A3-\u03F5\u03F7-\u0481\u048A-\u052F\u0531-\u0556\u0559\u0560-\u0588\u05D0-\u05EA\u05EF-\u05F2\u0620-\u064A\u066E\u066F\u0671-\u06D3\u06D5\u06E5\u06E6\u06EE\u06EF\u06FA-\u06FC\u06FF\u0710\u0712-\u072F\u074D-\u07A5\u07B1\u07CA-\u07EA\u07F4\u07F5\u07FA\u0800-\u0815\u081A\u0824\u0828\u0840-\u0858\u0860-\u086A\u08A0-\u08B4\u08B6-\u08BD\u0904-\u0939\u093D\u0950\u0958-\u0961\u0971-\u0980\u0985-\u098C\u098F\u0990\u0993-\u09A8\u09AA-\u09B0\u09B2\u09B6-\u09B9\u09BD\u09CE\u09DC\u09DD\u09DF-\u09E1\u09F0\u09F1\u09FC\u0A05-\u0A0A\u0A0F\u0A10\u0A13-\u0A28\u0A2A-\u0A30\u0A32\u0A33\u0A35\u0A36\u0A38\u0A39\u0A59-\u0A5C\u0A5E\u0A72-\u0A74\u0A85-\u0A8D\u0A8F-\u0A91\u0A93-\u0AA8\u0AAA-\u0AB0\u0AB2\u0AB3\u0AB5-\u0AB9\u0ABD\u0AD0\u0AE0\u0AE1\u0AF9\u0B05-\u0B0C\u0B0F\u0B10\u0B13-\u0B28\u0B2A-\u0B30\u0B32\u0B33\u0B35-\u0B39\u0B3D\u0B5C\u0B5D\u0B5F-\u0B61\u0B71\u0B83\u0B85-\u0B8A\u0B8E-\u0B90\u0B92-\u0B95\u0B99\u0B9A\u0B9C\u0B9E\u0B9F\u0BA3\u0BA4\u0BA8-\u0BAA\u0BAE-\u0BB9\u0BD0\u0C05-\u0C0C\u0C0E-\u0C10\u0C12-\u0C28\u0C2A-\u0C39\u0C3D\u0C58-\u0C5A\u0C60\u0C61\u0C80\u0C85-\u0C8C\u0C8E-\u0C90\u0C92-\u0CA8\u0CAA-\u0CB3\u0CB5-\u0CB9\u0CBD\u0CDE\u0CE0\u0CE1\u0CF1\u0CF2\u0D05-\u0D0C\u0D0E-\u0D10\u0D12-\u0D3A\u0D3D\u0D4E\u0D54-\u0D56\u0D5F-\u0D61\u0D7A-\u0D7F\u0D85-\u0D96\u0D9A-\u0DB1\u0DB3-\u0DBB\u0DBD\u0DC0-\u0DC6\u0E01-\u0E30\u0E32\u0E33\u0E40-\u0E46\u0E81\u0E82\u0E84\u0E87\u0E88\u0E8A\u0E8D\u0E94-\u0E97\u0E99-\u0E9F\u0EA1-\u0EA3\u0EA5\u0EA7\u0EAA\u0EAB\u0EAD-\u0EB0\u0EB2\u0EB3\u0EBD\u0EC0-\u0EC4\u0EC6\u0EDC-\u0EDF\u0F00\u0F40-\u0F47\u0F49-\u0F6C\u0F88-\u0F8C\u1000-\u102A\u103F\u1050-\u1055\u105A-\u105D\u1061\u1065\u1066\u106E-\u1070\u1075-\u1081\u108E\u10A0-\u10C5\u10C7\u10CD\u10D0-\u10FA\u10FC-\u1248\u124A-\u124D\u1250-\u1256\u1258\u125A-\u125D\u1260-\u1288\u128A-\u128D\u1290-\u12B0\u12B2-\u12B5\u12B8-\u12BE\u12C0\u12C2-\u12C5\u12C8-\u12D6\u12D8-\u1310\u1312-\u1315\u1318-\u135A\u1380-\u138F\u13A0-\u13F5\u13F8-\u13FD\u1401-\u166C\u166F-\u167F\u1681-\u169A\u16A0-\u16EA\u16F1-\u16F8\u1700-\u170C\u170E-\u1711\u1720-\u1731\u1740-\u1751\u1760-\u176C\u176E-\u1770\u1780-\u17B3\u17D7\u17DC\u1820-\u1878\u1880-\u1884\u1887-\u18A8\u18AA\u18B0-\u18F5\u1900-\u191E\u1950-\u196D\u1970-\u1974\u1980-\u19AB\u19B0-\u19C9\u1A00-\u1A16\u1A20-\u1A54\u1AA7\u1B05-\u1B33\u1B45-\u1B4B\u1B83-\u1BA0\u1BAE\u1BAF\u1BBA-\u1BE5\u1C00-\u1C23\u1C4D-\u1C4F\u1C5A-\u1C7D\u1C80-\u1C88\u1C90-\u1CBA\u1CBD-\u1CBF\u1CE9-\u1CEC\u1CEE-\u1CF1\u1CF5\u1CF6\u1D00-\u1DBF\u1E00-\u1F15\u1F18-\u1F1D\u1F20-\u1F45\u1F48-\u1F4D\u1F50-\u1F57\u1F59\u1F5B\u1F5D\u1F5F-\u1F7D\u1F80-\u1FB4\u1FB6-\u1FBC\u1FBE\u1FC2-\u1FC4\u1FC6-\u1FCC\u1FD0-\u1FD3\u1FD6-\u1FDB\u1FE0-\u1FEC\u1FF2-\u1FF4\u1FF6-\u1FFC\u2071\u207F\u2090-\u209C\u2102\u2107\u210A-\u2113\u2115\u2119-\u211D\u2124\u2126\u2128\u212A-\u212D\u212F-\u2139\u213C-\u213F\u2145-\u2149\u214E\u2183\u2184\u2C00-\u2C2E\u2C30-\u2C5E\u2C60-\u2CE4\u2CEB-\u2CEE\u2CF2\u2CF3\u2D00-\u2D25\u2D27\u2D2D\u2D30-\u2D67\u2D6F\u2D80-\u2D96\u2DA0-\u2DA6\u2DA8-\u2DAE\u2DB0-\u2DB6\u2DB8-\u2DBE\u2DC0-\u2DC6\u2DC8-\u2DCE\u2DD0-\u2DD6\u2DD8-\u2DDE\u2E2F\u3005\u3006\u3031-\u3035\u303B\u303C\u3041-\u3096\u309D-\u309F\u30A1-\u30FA\u30FC-\u30FF\u3105-\u312F\u3131-\u318E\u31A0-\u31BA\u31F0-\u31FF\u3400-\u4DB5\u4E00-\u9FEF\uA000-\uA48C\uA4D0-\uA4FD\uA500-\uA60C\uA610-\uA61F\uA62A\uA62B\uA640-\uA66E\uA67F-\uA69D\uA6A0-\uA6E5\uA717-\uA71F\uA722-\uA788\uA78B-\uA7B9\uA7F7-\uA801\uA803-\uA805\uA807-\uA80A\uA80C-\uA822\uA840-\uA873\uA882-\uA8B3\uA8F2-\uA8F7\uA8FB\uA8FD\uA8FE\uA90A-\uA925\uA930-\uA946\uA960-\uA97C\uA984-\uA9B2\uA9CF\uA9E0-\uA9E4\uA9E6-\uA9EF\uA9FA-\uA9FE\uAA00-\uAA28\uAA40-\uAA42\uAA44-\uAA4B\uAA60-\uAA76\uAA7A\uAA7E-\uAAAF\uAAB1\uAAB5\uAAB6\uAAB9-\uAABD\uAAC0\uAAC2\uAADB-\uAADD\uAAE0-\uAAEA\uAAF2-\uAAF4\uAB01-\uAB06\uAB09-\uAB0E\uAB11-\uAB16\uAB20-\uAB26\uAB28-\uAB2E\uAB30-\uAB5A\uAB5C-\uAB65\uAB70-\uABE2\uAC00-\uD7A3\uD7B0-\uD7C6\uD7CB-\uD7FB\uF900-\uFA6D\uFA70-\uFAD9\uFB00-\uFB06\uFB13-\uFB17\uFB1D\uFB1F-\uFB28\uFB2A-\uFB36\uFB38-\uFB3C\uFB3E\uFB40\uFB41\uFB43\uFB44\uFB46-\uFBB1\uFBD3-\uFD3D\uFD50-\uFD8F\uFD92-\uFDC7\uFDF0-\uFDFB\uFE70-\uFE74\uFE76-\uFEFC\uFF21-\uFF3A\uFF41-\uFF5A\uFF66-\uFFBE\uFFC2-\uFFC7\uFFCA-\uFFCF\uFFD2-\uFFD7\uFFDA-\uFFDC]|\uD800[\uDC00-\uDC0B\uDC0D-\uDC26\uDC28-\uDC3A\uDC3C\uDC3D\uDC3F-\uDC4D\uDC50-\uDC5D\uDC80-\uDCFA\uDE80-\uDE9C\uDEA0-\uDED0\uDF00-\uDF1F\uDF2D-\uDF40\uDF42-\uDF49\uDF50-\uDF75\uDF80-\uDF9D\uDFA0-\uDFC3\uDFC8-\uDFCF]|\uD801[\uDC00-\uDC9D\uDCB0-\uDCD3\uDCD8-\uDCFB\uDD00-\uDD27\uDD30-\uDD63\uDE00-\uDF36\uDF40-\uDF55\uDF60-\uDF67]|\uD802[\uDC00-\uDC05\uDC08\uDC0A-\uDC35\uDC37\uDC38\uDC3C\uDC3F-\uDC55\uDC60-\uDC76\uDC80-\uDC9E\uDCE0-\uDCF2\uDCF4\uDCF5\uDD00-\uDD15\uDD20-\uDD39\uDD80-\uDDB7\uDDBE\uDDBF\uDE00\uDE10-\uDE13\uDE15-\uDE17\uDE19-\uDE35\uDE60-\uDE7C\uDE80-\uDE9C\uDEC0-\uDEC7\uDEC9-\uDEE4\uDF00-\uDF35\uDF40-\uDF55\uDF60-\uDF72\uDF80-\uDF91]|\uD803[\uDC00-\uDC48\uDC80-\uDCB2\uDCC0-\uDCF2\uDD00-\uDD23\uDF00-\uDF1C\uDF27\uDF30-\uDF45]|\uD804[\uDC03-\uDC37\uDC83-\uDCAF\uDCD0-\uDCE8\uDD03-\uDD26\uDD44\uDD50-\uDD72\uDD76\uDD83-\uDDB2\uDDC1-\uDDC4\uDDDA\uDDDC\uDE00-\uDE11\uDE13-\uDE2B\uDE80-\uDE86\uDE88\uDE8A-\uDE8D\uDE8F-\uDE9D\uDE9F-\uDEA8\uDEB0-\uDEDE\uDF05-\uDF0C\uDF0F\uDF10\uDF13-\uDF28\uDF2A-\uDF30\uDF32\uDF33\uDF35-\uDF39\uDF3D\uDF50\uDF5D-\uDF61]|\uD805[\uDC00-\uDC34\uDC47-\uDC4A\uDC80-\uDCAF\uDCC4\uDCC5\uDCC7\uDD80-\uDDAE\uDDD8-\uDDDB\uDE00-\uDE2F\uDE44\uDE80-\uDEAA\uDF00-\uDF1A]|\uD806[\uDC00-\uDC2B\uDCA0-\uDCDF\uDCFF\uDE00\uDE0B-\uDE32\uDE3A\uDE50\uDE5C-\uDE83\uDE86-\uDE89\uDE9D\uDEC0-\uDEF8]|\uD807[\uDC00-\uDC08\uDC0A-\uDC2E\uDC40\uDC72-\uDC8F\uDD00-\uDD06\uDD08\uDD09\uDD0B-\uDD30\uDD46\uDD60-\uDD65\uDD67\uDD68\uDD6A-\uDD89\uDD98\uDEE0-\uDEF2]|\uD808[\uDC00-\uDF99]|\uD809[\uDC80-\uDD43]|[\uD80C\uD81C-\uD820\uD840-\uD868\uD86A-\uD86C\uD86F-\uD872\uD874-\uD879][\uDC00-\uDFFF]|\uD80D[\uDC00-\uDC2E]|\uD811[\uDC00-\uDE46]|\uD81A[\uDC00-\uDE38\uDE40-\uDE5E\uDED0-\uDEED\uDF00-\uDF2F\uDF40-\uDF43\uDF63-\uDF77\uDF7D-\uDF8F]|\uD81B[\uDE40-\uDE7F\uDF00-\uDF44\uDF50\uDF93-\uDF9F\uDFE0\uDFE1]|\uD821[\uDC00-\uDFF1]|\uD822[\uDC00-\uDEF2]|\uD82C[\uDC00-\uDD1E\uDD70-\uDEFB]|\uD82F[\uDC00-\uDC6A\uDC70-\uDC7C\uDC80-\uDC88\uDC90-\uDC99]|\uD835[\uDC00-\uDC54\uDC56-\uDC9C\uDC9E\uDC9F\uDCA2\uDCA5\uDCA6\uDCA9-\uDCAC\uDCAE-\uDCB9\uDCBB\uDCBD-\uDCC3\uDCC5-\uDD05\uDD07-\uDD0A\uDD0D-\uDD14\uDD16-\uDD1C\uDD1E-\uDD39\uDD3B-\uDD3E\uDD40-\uDD44\uDD46\uDD4A-\uDD50\uDD52-\uDEA5\uDEA8-\uDEC0\uDEC2-\uDEDA\uDEDC-\uDEFA\uDEFC-\uDF14\uDF16-\uDF34\uDF36-\uDF4E\uDF50-\uDF6E\uDF70-\uDF88\uDF8A-\uDFA8\uDFAA-\uDFC2\uDFC4-\uDFCB]|\uD83A[\uDC00-\uDCC4\uDD00-\uDD43]|\uD83B[\uDE00-\uDE03\uDE05-\uDE1F\uDE21\uDE22\uDE24\uDE27\uDE29-\uDE32\uDE34-\uDE37\uDE39\uDE3B\uDE42\uDE47\uDE49\uDE4B\uDE4D-\uDE4F\uDE51\uDE52\uDE54\uDE57\uDE59\uDE5B\uDE5D\uDE5F\uDE61\uDE62\uDE64\uDE67-\uDE6A\uDE6C-\uDE72\uDE74-\uDE77\uDE79-\uDE7C\uDE7E\uDE80-\uDE89\uDE8B-\uDE9B\uDEA1-\uDEA3\uDEA5-\uDEA9\uDEAB-\uDEBB]|\uD869[\uDC00-\uDED6\uDF00-\uDFFF]|\uD86D[\uDC00-\uDF34\uDF40-\uDFFF]|\uD86E[\uDC00-\uDC1D\uDC20-\uDFFF]|\uD873[\uDC00-\uDEA1\uDEB0-\uDFFF]|\uD87A[\uDC00-\uDFE0]|\uD87E[\uDC00-\uDE1D])+$/; +const WINDOWS_FILE_NAME_WHITELIST = + /^([A-Za-z]:[/\\])?(?:[\x2D-9A-Z\\_a-z\xAA\xB5\xBA\xC0-\xD6\xD8-\xF6\xF8-\u02C1\u02C6-\u02D1\u02E0-\u02E4\u02EC\u02EE\u0370-\u0374\u0376\u0377\u037A-\u037D\u037F\u0386\u0388-\u038A\u038C\u038E-\u03A1\u03A3-\u03F5\u03F7-\u0481\u048A-\u052F\u0531-\u0556\u0559\u0560-\u0588\u05D0-\u05EA\u05EF-\u05F2\u0620-\u064A\u066E\u066F\u0671-\u06D3\u06D5\u06E5\u06E6\u06EE\u06EF\u06FA-\u06FC\u06FF\u0710\u0712-\u072F\u074D-\u07A5\u07B1\u07CA-\u07EA\u07F4\u07F5\u07FA\u0800-\u0815\u081A\u0824\u0828\u0840-\u0858\u0860-\u086A\u08A0-\u08B4\u08B6-\u08BD\u0904-\u0939\u093D\u0950\u0958-\u0961\u0971-\u0980\u0985-\u098C\u098F\u0990\u0993-\u09A8\u09AA-\u09B0\u09B2\u09B6-\u09B9\u09BD\u09CE\u09DC\u09DD\u09DF-\u09E1\u09F0\u09F1\u09FC\u0A05-\u0A0A\u0A0F\u0A10\u0A13-\u0A28\u0A2A-\u0A30\u0A32\u0A33\u0A35\u0A36\u0A38\u0A39\u0A59-\u0A5C\u0A5E\u0A72-\u0A74\u0A85-\u0A8D\u0A8F-\u0A91\u0A93-\u0AA8\u0AAA-\u0AB0\u0AB2\u0AB3\u0AB5-\u0AB9\u0ABD\u0AD0\u0AE0\u0AE1\u0AF9\u0B05-\u0B0C\u0B0F\u0B10\u0B13-\u0B28\u0B2A-\u0B30\u0B32\u0B33\u0B35-\u0B39\u0B3D\u0B5C\u0B5D\u0B5F-\u0B61\u0B71\u0B83\u0B85-\u0B8A\u0B8E-\u0B90\u0B92-\u0B95\u0B99\u0B9A\u0B9C\u0B9E\u0B9F\u0BA3\u0BA4\u0BA8-\u0BAA\u0BAE-\u0BB9\u0BD0\u0C05-\u0C0C\u0C0E-\u0C10\u0C12-\u0C28\u0C2A-\u0C39\u0C3D\u0C58-\u0C5A\u0C60\u0C61\u0C80\u0C85-\u0C8C\u0C8E-\u0C90\u0C92-\u0CA8\u0CAA-\u0CB3\u0CB5-\u0CB9\u0CBD\u0CDE\u0CE0\u0CE1\u0CF1\u0CF2\u0D05-\u0D0C\u0D0E-\u0D10\u0D12-\u0D3A\u0D3D\u0D4E\u0D54-\u0D56\u0D5F-\u0D61\u0D7A-\u0D7F\u0D85-\u0D96\u0D9A-\u0DB1\u0DB3-\u0DBB\u0DBD\u0DC0-\u0DC6\u0E01-\u0E30\u0E32\u0E33\u0E40-\u0E46\u0E81\u0E82\u0E84\u0E87\u0E88\u0E8A\u0E8D\u0E94-\u0E97\u0E99-\u0E9F\u0EA1-\u0EA3\u0EA5\u0EA7\u0EAA\u0EAB\u0EAD-\u0EB0\u0EB2\u0EB3\u0EBD\u0EC0-\u0EC4\u0EC6\u0EDC-\u0EDF\u0F00\u0F40-\u0F47\u0F49-\u0F6C\u0F88-\u0F8C\u1000-\u102A\u103F\u1050-\u1055\u105A-\u105D\u1061\u1065\u1066\u106E-\u1070\u1075-\u1081\u108E\u10A0-\u10C5\u10C7\u10CD\u10D0-\u10FA\u10FC-\u1248\u124A-\u124D\u1250-\u1256\u1258\u125A-\u125D\u1260-\u1288\u128A-\u128D\u1290-\u12B0\u12B2-\u12B5\u12B8-\u12BE\u12C0\u12C2-\u12C5\u12C8-\u12D6\u12D8-\u1310\u1312-\u1315\u1318-\u135A\u1380-\u138F\u13A0-\u13F5\u13F8-\u13FD\u1401-\u166C\u166F-\u167F\u1681-\u169A\u16A0-\u16EA\u16F1-\u16F8\u1700-\u170C\u170E-\u1711\u1720-\u1731\u1740-\u1751\u1760-\u176C\u176E-\u1770\u1780-\u17B3\u17D7\u17DC\u1820-\u1878\u1880-\u1884\u1887-\u18A8\u18AA\u18B0-\u18F5\u1900-\u191E\u1950-\u196D\u1970-\u1974\u1980-\u19AB\u19B0-\u19C9\u1A00-\u1A16\u1A20-\u1A54\u1AA7\u1B05-\u1B33\u1B45-\u1B4B\u1B83-\u1BA0\u1BAE\u1BAF\u1BBA-\u1BE5\u1C00-\u1C23\u1C4D-\u1C4F\u1C5A-\u1C7D\u1C80-\u1C88\u1C90-\u1CBA\u1CBD-\u1CBF\u1CE9-\u1CEC\u1CEE-\u1CF1\u1CF5\u1CF6\u1D00-\u1DBF\u1E00-\u1F15\u1F18-\u1F1D\u1F20-\u1F45\u1F48-\u1F4D\u1F50-\u1F57\u1F59\u1F5B\u1F5D\u1F5F-\u1F7D\u1F80-\u1FB4\u1FB6-\u1FBC\u1FBE\u1FC2-\u1FC4\u1FC6-\u1FCC\u1FD0-\u1FD3\u1FD6-\u1FDB\u1FE0-\u1FEC\u1FF2-\u1FF4\u1FF6-\u1FFC\u2071\u207F\u2090-\u209C\u2102\u2107\u210A-\u2113\u2115\u2119-\u211D\u2124\u2126\u2128\u212A-\u212D\u212F-\u2139\u213C-\u213F\u2145-\u2149\u214E\u2183\u2184\u2C00-\u2C2E\u2C30-\u2C5E\u2C60-\u2CE4\u2CEB-\u2CEE\u2CF2\u2CF3\u2D00-\u2D25\u2D27\u2D2D\u2D30-\u2D67\u2D6F\u2D80-\u2D96\u2DA0-\u2DA6\u2DA8-\u2DAE\u2DB0-\u2DB6\u2DB8-\u2DBE\u2DC0-\u2DC6\u2DC8-\u2DCE\u2DD0-\u2DD6\u2DD8-\u2DDE\u2E2F\u3005\u3006\u3031-\u3035\u303B\u303C\u3041-\u3096\u309D-\u309F\u30A1-\u30FA\u30FC-\u30FF\u3105-\u312F\u3131-\u318E\u31A0-\u31BA\u31F0-\u31FF\u3400-\u4DB5\u4E00-\u9FEF\uA000-\uA48C\uA4D0-\uA4FD\uA500-\uA60C\uA610-\uA61F\uA62A\uA62B\uA640-\uA66E\uA67F-\uA69D\uA6A0-\uA6E5\uA717-\uA71F\uA722-\uA788\uA78B-\uA7B9\uA7F7-\uA801\uA803-\uA805\uA807-\uA80A\uA80C-\uA822\uA840-\uA873\uA882-\uA8B3\uA8F2-\uA8F7\uA8FB\uA8FD\uA8FE\uA90A-\uA925\uA930-\uA946\uA960-\uA97C\uA984-\uA9B2\uA9CF\uA9E0-\uA9E4\uA9E6-\uA9EF\uA9FA-\uA9FE\uAA00-\uAA28\uAA40-\uAA42\uAA44-\uAA4B\uAA60-\uAA76\uAA7A\uAA7E-\uAAAF\uAAB1\uAAB5\uAAB6\uAAB9-\uAABD\uAAC0\uAAC2\uAADB-\uAADD\uAAE0-\uAAEA\uAAF2-\uAAF4\uAB01-\uAB06\uAB09-\uAB0E\uAB11-\uAB16\uAB20-\uAB26\uAB28-\uAB2E\uAB30-\uAB5A\uAB5C-\uAB65\uAB70-\uABE2\uAC00-\uD7A3\uD7B0-\uD7C6\uD7CB-\uD7FB\uF900-\uFA6D\uFA70-\uFAD9\uFB00-\uFB06\uFB13-\uFB17\uFB1D\uFB1F-\uFB28\uFB2A-\uFB36\uFB38-\uFB3C\uFB3E\uFB40\uFB41\uFB43\uFB44\uFB46-\uFBB1\uFBD3-\uFD3D\uFD50-\uFD8F\uFD92-\uFDC7\uFDF0-\uFDFB\uFE70-\uFE74\uFE76-\uFEFC\uFF21-\uFF3A\uFF41-\uFF5A\uFF66-\uFFBE\uFFC2-\uFFC7\uFFCA-\uFFCF\uFFD2-\uFFD7\uFFDA-\uFFDC]|\uD800[\uDC00-\uDC0B\uDC0D-\uDC26\uDC28-\uDC3A\uDC3C\uDC3D\uDC3F-\uDC4D\uDC50-\uDC5D\uDC80-\uDCFA\uDE80-\uDE9C\uDEA0-\uDED0\uDF00-\uDF1F\uDF2D-\uDF40\uDF42-\uDF49\uDF50-\uDF75\uDF80-\uDF9D\uDFA0-\uDFC3\uDFC8-\uDFCF]|\uD801[\uDC00-\uDC9D\uDCB0-\uDCD3\uDCD8-\uDCFB\uDD00-\uDD27\uDD30-\uDD63\uDE00-\uDF36\uDF40-\uDF55\uDF60-\uDF67]|\uD802[\uDC00-\uDC05\uDC08\uDC0A-\uDC35\uDC37\uDC38\uDC3C\uDC3F-\uDC55\uDC60-\uDC76\uDC80-\uDC9E\uDCE0-\uDCF2\uDCF4\uDCF5\uDD00-\uDD15\uDD20-\uDD39\uDD80-\uDDB7\uDDBE\uDDBF\uDE00\uDE10-\uDE13\uDE15-\uDE17\uDE19-\uDE35\uDE60-\uDE7C\uDE80-\uDE9C\uDEC0-\uDEC7\uDEC9-\uDEE4\uDF00-\uDF35\uDF40-\uDF55\uDF60-\uDF72\uDF80-\uDF91]|\uD803[\uDC00-\uDC48\uDC80-\uDCB2\uDCC0-\uDCF2\uDD00-\uDD23\uDF00-\uDF1C\uDF27\uDF30-\uDF45]|\uD804[\uDC03-\uDC37\uDC83-\uDCAF\uDCD0-\uDCE8\uDD03-\uDD26\uDD44\uDD50-\uDD72\uDD76\uDD83-\uDDB2\uDDC1-\uDDC4\uDDDA\uDDDC\uDE00-\uDE11\uDE13-\uDE2B\uDE80-\uDE86\uDE88\uDE8A-\uDE8D\uDE8F-\uDE9D\uDE9F-\uDEA8\uDEB0-\uDEDE\uDF05-\uDF0C\uDF0F\uDF10\uDF13-\uDF28\uDF2A-\uDF30\uDF32\uDF33\uDF35-\uDF39\uDF3D\uDF50\uDF5D-\uDF61]|\uD805[\uDC00-\uDC34\uDC47-\uDC4A\uDC80-\uDCAF\uDCC4\uDCC5\uDCC7\uDD80-\uDDAE\uDDD8-\uDDDB\uDE00-\uDE2F\uDE44\uDE80-\uDEAA\uDF00-\uDF1A]|\uD806[\uDC00-\uDC2B\uDCA0-\uDCDF\uDCFF\uDE00\uDE0B-\uDE32\uDE3A\uDE50\uDE5C-\uDE83\uDE86-\uDE89\uDE9D\uDEC0-\uDEF8]|\uD807[\uDC00-\uDC08\uDC0A-\uDC2E\uDC40\uDC72-\uDC8F\uDD00-\uDD06\uDD08\uDD09\uDD0B-\uDD30\uDD46\uDD60-\uDD65\uDD67\uDD68\uDD6A-\uDD89\uDD98\uDEE0-\uDEF2]|\uD808[\uDC00-\uDF99]|\uD809[\uDC80-\uDD43]|[\uD80C\uD81C-\uD820\uD840-\uD868\uD86A-\uD86C\uD86F-\uD872\uD874-\uD879][\uDC00-\uDFFF]|\uD80D[\uDC00-\uDC2E]|\uD811[\uDC00-\uDE46]|\uD81A[\uDC00-\uDE38\uDE40-\uDE5E\uDED0-\uDEED\uDF00-\uDF2F\uDF40-\uDF43\uDF63-\uDF77\uDF7D-\uDF8F]|\uD81B[\uDE40-\uDE7F\uDF00-\uDF44\uDF50\uDF93-\uDF9F\uDFE0\uDFE1]|\uD821[\uDC00-\uDFF1]|\uD822[\uDC00-\uDEF2]|\uD82C[\uDC00-\uDD1E\uDD70-\uDEFB]|\uD82F[\uDC00-\uDC6A\uDC70-\uDC7C\uDC80-\uDC88\uDC90-\uDC99]|\uD835[\uDC00-\uDC54\uDC56-\uDC9C\uDC9E\uDC9F\uDCA2\uDCA5\uDCA6\uDCA9-\uDCAC\uDCAE-\uDCB9\uDCBB\uDCBD-\uDCC3\uDCC5-\uDD05\uDD07-\uDD0A\uDD0D-\uDD14\uDD16-\uDD1C\uDD1E-\uDD39\uDD3B-\uDD3E\uDD40-\uDD44\uDD46\uDD4A-\uDD50\uDD52-\uDEA5\uDEA8-\uDEC0\uDEC2-\uDEDA\uDEDC-\uDEFA\uDEFC-\uDF14\uDF16-\uDF34\uDF36-\uDF4E\uDF50-\uDF6E\uDF70-\uDF88\uDF8A-\uDFA8\uDFAA-\uDFC2\uDFC4-\uDFCB]|\uD83A[\uDC00-\uDCC4\uDD00-\uDD43]|\uD83B[\uDE00-\uDE03\uDE05-\uDE1F\uDE21\uDE22\uDE24\uDE27\uDE29-\uDE32\uDE34-\uDE37\uDE39\uDE3B\uDE42\uDE47\uDE49\uDE4B\uDE4D-\uDE4F\uDE51\uDE52\uDE54\uDE57\uDE59\uDE5B\uDE5D\uDE5F\uDE61\uDE62\uDE64\uDE67-\uDE6A\uDE6C-\uDE72\uDE74-\uDE77\uDE79-\uDE7C\uDE7E\uDE80-\uDE89\uDE8B-\uDE9B\uDEA1-\uDEA3\uDEA5-\uDEA9\uDEAB-\uDEBB]|\uD869[\uDC00-\uDED6\uDF00-\uDFFF]|\uD86D[\uDC00-\uDF34\uDF40-\uDFFF]|\uD86E[\uDC00-\uDC1D\uDC20-\uDFFF]|\uD873[\uDC00-\uDEA1\uDEB0-\uDFFF]|\uD87A[\uDC00-\uDFE0]|\uD87E[\uDC00-\uDE1D])+$/; function addWorkspaceToArgumentsIfExists(args, workspace) { if (workspace) { diff --git a/packages/react-dev-utils/package.json b/packages/react-dev-utils/package.json index 8d8a93676c4..154678a7dcd 100644 --- a/packages/react-dev-utils/package.json +++ b/packages/react-dev-utils/package.json @@ -1,6 +1,6 @@ { "name": "react-dev-utils", - "version": "12.0.0", + "version": "12.0.1", "description": "webpack utilities used by Create React App", "repository": { "type": "git", @@ -71,7 +71,7 @@ "open": "^8.4.0", "pkg-up": "^3.1.0", "prompts": "^2.4.2", - "react-error-overlay": "^6.0.10", + "react-error-overlay": "^6.0.11", "recursive-readdir": "^2.2.2", "shell-quote": "^1.7.3", "strip-ansi": "^6.0.1", diff --git a/packages/react-dev-utils/redirectServedPathMiddleware.js b/packages/react-dev-utils/redirectServedPathMiddleware.js index 2fda106b04d..38157c66e35 100644 --- a/packages/react-dev-utils/redirectServedPathMiddleware.js +++ b/packages/react-dev-utils/redirectServedPathMiddleware.js @@ -19,7 +19,10 @@ module.exports = function createRedirectServedPathMiddleware(servedPath) { ) { next(); } else { - const newPath = path.posix.join(servedPath, req.path !== '/' ? req.path : ''); + const newPath = path.posix.join( + servedPath, + req.path !== '/' ? req.path : '' + ); res.redirect(newPath); } }; diff --git a/packages/react-error-overlay/.eslintrc b/packages/react-error-overlay/.eslintrc deleted file mode 100644 index c0c3c776e93..00000000000 --- a/packages/react-error-overlay/.eslintrc +++ /dev/null @@ -1,6 +0,0 @@ -{ - "extends": ["react-app", "react-app/jest"], - "rules": { - "curly": "warn" - } -} diff --git a/packages/react-error-overlay/build.js b/packages/react-error-overlay/build.js index ccb9d08aa4e..3f036c41c3b 100644 --- a/packages/react-error-overlay/build.js +++ b/packages/react-error-overlay/build.js @@ -4,6 +4,8 @@ * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. */ +'use strict'; + const webpack = require('webpack'); const chalk = require('chalk'); const webpackConfig = require('./webpack.config.js'); diff --git a/packages/react-error-overlay/package.json b/packages/react-error-overlay/package.json index 877db51b8fc..c65a01ad0d5 100644 --- a/packages/react-error-overlay/package.json +++ b/packages/react-error-overlay/package.json @@ -1,6 +1,6 @@ { "name": "react-error-overlay", - "version": "6.0.10", + "version": "6.0.11", "description": "An overlay for displaying stack frames.", "main": "lib/index.js", "sideEffects": false, @@ -44,8 +44,6 @@ "chalk": "^4.1.2", "chokidar": "^3.5.2", "cross-env": "^7.0.3", - "eslint": "^8.3.0", - "eslint-config-react-app": "^7.0.0", "flow-bin": "^0.116.0", "html-entities": "^2.3.2", "jest": "^27.4.3", diff --git a/packages/react-error-overlay/src/__tests__/get-source-map.js b/packages/react-error-overlay/src/__tests__/get-source-map.js index 31a3a7a39c0..66e5dc195f6 100644 --- a/packages/react-error-overlay/src/__tests__/get-source-map.js +++ b/packages/react-error-overlay/src/__tests__/get-source-map.js @@ -3,7 +3,7 @@ * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. - * + * * @jest-environment jsdom */ diff --git a/packages/react-error-overlay/src/containers/StackFrame.js b/packages/react-error-overlay/src/containers/StackFrame.js index 527cd41c10e..5dc049eb1f8 100644 --- a/packages/react-error-overlay/src/containers/StackFrame.js +++ b/packages/react-error-overlay/src/containers/StackFrame.js @@ -62,10 +62,8 @@ function StackFrame(props: StackFramePropsType) { }; const getErrorLocation = (): ErrorLocation | null => { - const { - _originalFileName: fileName, - _originalLineNumber: lineNumber, - } = props.frame; + const { _originalFileName: fileName, _originalLineNumber: lineNumber } = + props.frame; // Unknown file if (!fileName) { return null; diff --git a/packages/react-error-overlay/src/index.js b/packages/react-error-overlay/src/index.js index 66da7cc267b..2832a5fc73b 100644 --- a/packages/react-error-overlay/src/index.js +++ b/packages/react-error-overlay/src/index.js @@ -80,29 +80,29 @@ export function startReportingRuntimeErrors(options: RuntimeReportingOptions) { ); } -const handleRuntimeError = (options: RuntimeReportingOptions) => ( - errorRecord: ErrorRecord -) => { - try { - if (typeof options.onError === 'function') { - options.onError.call(null); - } - } finally { - if ( - currentRuntimeErrorRecords.some( - ({ error }) => error === errorRecord.error - ) - ) { - // Deduplicate identical errors. - // This fixes https://github.com/facebook/create-react-app/issues/3011. - return; +const handleRuntimeError = + (options: RuntimeReportingOptions) => (errorRecord: ErrorRecord) => { + try { + if (typeof options.onError === 'function') { + options.onError.call(null); + } + } finally { + if ( + currentRuntimeErrorRecords.some( + ({ error }) => error === errorRecord.error + ) + ) { + // Deduplicate identical errors. + // This fixes https://github.com/facebook/create-react-app/issues/3011. + // eslint-disable-next-line no-unsafe-finally + return; + } + currentRuntimeErrorRecords = currentRuntimeErrorRecords.concat([ + errorRecord, + ]); + update(); } - currentRuntimeErrorRecords = currentRuntimeErrorRecords.concat([ - errorRecord, - ]); - update(); - } -}; + }; export function dismissRuntimeErrors() { currentRuntimeErrorRecords = []; @@ -142,9 +142,8 @@ function update() { const iframeDocument = loadingIframe.contentDocument; if (iframeDocument != null && iframeDocument.body != null) { iframe = loadingIframe; - const script = loadingIframe.contentWindow.document.createElement( - 'script' - ); + const script = + loadingIframe.contentWindow.document.createElement('script'); script.type = 'text/javascript'; script.innerHTML = iframeScript; iframeDocument.body.appendChild(script); @@ -179,11 +178,12 @@ function updateIframeContent() { window.__REACT_ERROR_OVERLAY_GLOBAL_HOOK__ = window.__REACT_ERROR_OVERLAY_GLOBAL_HOOK__ || {}; -window.__REACT_ERROR_OVERLAY_GLOBAL_HOOK__.iframeReady = function iframeReady() { - isIframeReady = true; - isLoadingIframe = false; - updateIframeContent(); -}; +window.__REACT_ERROR_OVERLAY_GLOBAL_HOOK__.iframeReady = + function iframeReady() { + isIframeReady = true; + isLoadingIframe = false; + updateIframeContent(); + }; if (process.env.NODE_ENV === 'production') { console.warn( diff --git a/packages/react-error-overlay/src/listenToRuntimeErrors.js b/packages/react-error-overlay/src/listenToRuntimeErrors.js index 049a79e384a..7e541a0d2f7 100644 --- a/packages/react-error-overlay/src/listenToRuntimeErrors.js +++ b/packages/react-error-overlay/src/listenToRuntimeErrors.js @@ -36,26 +36,25 @@ export type ErrorRecord = {| stackFrames: StackFrame[], |}; -export const crashWithFrames = (crash: ErrorRecord => void) => ( - error: Error, - unhandledRejection = false -) => { - getStackFrames(error, unhandledRejection, CONTEXT_SIZE) - .then(stackFrames => { - if (stackFrames == null) { - return; - } - crash({ - error, - unhandledRejection, - contextSize: CONTEXT_SIZE, - stackFrames, +export const crashWithFrames = + (crash: ErrorRecord => void) => + (error: Error, unhandledRejection = false) => { + getStackFrames(error, unhandledRejection, CONTEXT_SIZE) + .then(stackFrames => { + if (stackFrames == null) { + return; + } + crash({ + error, + unhandledRejection, + contextSize: CONTEXT_SIZE, + stackFrames, + }); + }) + .catch(e => { + console.log('Could not get the stack frames of error:', e); }); - }) - .catch(e => { - console.log('Could not get the stack frames of error:', e); - }); -}; + }; export function listenToRuntimeErrors( crash: ErrorRecord => void, diff --git a/packages/react-error-overlay/src/utils/dom/css.js b/packages/react-error-overlay/src/utils/dom/css.js index c1eef091fd1..6a53cadf730 100644 --- a/packages/react-error-overlay/src/utils/dom/css.js +++ b/packages/react-error-overlay/src/utils/dom/css.js @@ -38,7 +38,7 @@ function removeCss(document: Document, ref: number) { function applyStyles(element: HTMLElement, styles: Object) { element.setAttribute('style', ''); for (const key in styles) { - if (!styles.hasOwnProperty(key)) { + if (!Object.prototype.hasOwnProperty.call(styles, key)) { continue; } // $FlowFixMe diff --git a/packages/react-error-overlay/src/utils/parser.js b/packages/react-error-overlay/src/utils/parser.js index 3f6c699f376..b931e6e2cb3 100644 --- a/packages/react-error-overlay/src/utils/parser.js +++ b/packages/react-error-overlay/src/utils/parser.js @@ -28,7 +28,8 @@ function extractLocation(token: string): [string, number, number] { } const regexValidFrame_Chrome = /^\s*(at|in)\s.+(:\d+)/; -const regexValidFrame_FireFox = /(^|@)\S+:\d+|.+line\s+\d+\s+>\s+(eval|Function).+/; +const regexValidFrame_FireFox = + /(^|@)\S+:\d+|.+line\s+\d+\s+>\s+(eval|Function).+/; function parseStack(stack: string[]): StackFrame[] { const frames = stack diff --git a/packages/react-error-overlay/src/utils/unmapper.js b/packages/react-error-overlay/src/utils/unmapper.js index 4c95ab4d7b3..dddae8c48d6 100644 --- a/packages/react-error-overlay/src/utils/unmapper.js +++ b/packages/react-error-overlay/src/utils/unmapper.js @@ -43,12 +43,8 @@ async function unmap( } const map = await getSourceMap(fileUri, fileContents); return frames.map(frame => { - const { - functionName, - lineNumber, - columnNumber, - _originalLineNumber, - } = frame; + const { functionName, lineNumber, columnNumber, _originalLineNumber } = + frame; if (_originalLineNumber != null) { return frame; } diff --git a/packages/react-scripts/config/webpack.config.js b/packages/react-scripts/config/webpack.config.js index 28385494f78..ee34b12803a 100644 --- a/packages/react-scripts/config/webpack.config.js +++ b/packages/react-scripts/config/webpack.config.js @@ -200,6 +200,8 @@ module.exports = function (webpackEnv) { return { target: ['browserslist'], + // Webpack noise constrained to errors and warnings + stats: 'errors-warnings', mode: isEnvProduction ? 'production' : isEnvDevelopment && 'development', // Stop compilation early in production bail: isEnvProduction, diff --git a/packages/react-scripts/fixtures/kitchensink/template/integration/env.test.js b/packages/react-scripts/fixtures/kitchensink/template/integration/env.test.js index 0dd7c8fb359..6decfd039ff 100644 --- a/packages/react-scripts/fixtures/kitchensink/template/integration/env.test.js +++ b/packages/react-scripts/fixtures/kitchensink/template/integration/env.test.js @@ -26,21 +26,12 @@ describe('Integration', () => { doc.getElementById('feature-file-env-original-2').textContent ).toBe('override-from-original-local-env-2'); - if (process.env.NODE_ENV === 'production') { - expect(doc.getElementById('feature-file-env').textContent).toBe( - 'production' - ); - expect(doc.getElementById('feature-file-env-x').textContent).toBe( - 'x-from-original-local-env' - ); - } else { - expect(doc.getElementById('feature-file-env').textContent).toBe( - 'development' - ); - expect(doc.getElementById('feature-file-env-x').textContent).toBe( - 'x-from-original-local-env' - ); - } + expect(doc.getElementById('feature-file-env').textContent).toBe( + process.env.NODE_ENV === 'production' ? 'production' : 'development' + ); + expect(doc.getElementById('feature-file-env-x').textContent).toBe( + 'x-from-original-local-env' + ); }); it('PUBLIC_URL', async () => { diff --git a/packages/react-scripts/fixtures/kitchensink/template/integration/initDOM.js b/packages/react-scripts/fixtures/kitchensink/template/integration/initDOM.js index bb91e8b3d72..9f573fa353f 100644 --- a/packages/react-scripts/fixtures/kitchensink/template/integration/initDOM.js +++ b/packages/react-scripts/fixtures/kitchensink/template/integration/initDOM.js @@ -24,11 +24,12 @@ export const fetchFile = url => { ); }; -const fileResourceLoader = new (class FileResourceLoader extends ResourceLoader { - fetch(href, options) { - return Promise.resolve(fetchFile(url.parse(href))); - } -})(); +const fileResourceLoader = + new (class FileResourceLoader extends ResourceLoader { + fetch(href, options) { + return Promise.resolve(fetchFile(url.parse(href))); + } + })(); if (!process.env.E2E_FILE && !process.env.E2E_URL) { it.only('can run jsdom (at least one of "E2E_FILE" or "E2E_URL" environment variables must be provided)', () => { @@ -38,7 +39,8 @@ if (!process.env.E2E_FILE && !process.env.E2E_URL) { }); } -export default feature => +const initDOM = async feature => + // eslint-disable-next-line no-async-promise-executor new Promise(async (resolve, reject) => { try { const host = process.env.E2E_URL || 'http://www.example.org/spa:3000'; @@ -102,3 +104,5 @@ export default feature => reject(e); } }); + +export default initDOM; diff --git a/packages/react-scripts/fixtures/kitchensink/template/integration/webpack.test.js b/packages/react-scripts/fixtures/kitchensink/template/integration/webpack.test.js index 7c56bdceee5..537c8456051 100644 --- a/packages/react-scripts/fixtures/kitchensink/template/integration/webpack.test.js +++ b/packages/react-scripts/fixtures/kitchensink/template/integration/webpack.test.js @@ -94,9 +94,9 @@ describe('Integration', () => { doc = await initDOM('no-ext-inclusion'); // Webpack 4 added a default extension ".bin" seems like webpack 5 asset modules do not - expect(doc.getElementById('feature-no-ext-inclusion').getAttribute('href')).toMatch( - /\/static\/media\/aFileWithoutExt\.[a-f0-9]+$/ - ); + expect( + doc.getElementById('feature-no-ext-inclusion').getAttribute('href') + ).toMatch(/\/static\/media\/aFileWithoutExt\.[a-f0-9]+$/); }); it('json inclusion', async () => { @@ -136,9 +136,9 @@ describe('Integration', () => { it('unknown ext inclusion', async () => { doc = await initDOM('unknown-ext-inclusion'); - expect(doc.getElementById('feature-unknown-ext-inclusion').getAttribute('href')).toMatch( - /\/static\/media\/aFileWithExt\.[a-f0-9]+\.unknown$/ - ); + expect( + doc.getElementById('feature-unknown-ext-inclusion').getAttribute('href') + ).toMatch(/\/static\/media\/aFileWithExt\.[a-f0-9]+\.unknown$/); }); }); }); diff --git a/packages/react-scripts/fixtures/kitchensink/template/jest.integration.config.js b/packages/react-scripts/fixtures/kitchensink/template/jest.integration.config.js index 01059d4d688..e4873d28636 100644 --- a/packages/react-scripts/fixtures/kitchensink/template/jest.integration.config.js +++ b/packages/react-scripts/fixtures/kitchensink/template/jest.integration.config.js @@ -1,3 +1,5 @@ +'use strict'; + module.exports = { testEnvironment: 'node', testMatch: ['**/integration/*.test.js'], diff --git a/packages/react-scripts/fixtures/kitchensink/template/jest.transform.js b/packages/react-scripts/fixtures/kitchensink/template/jest.transform.js index 3b2d0c56bf2..66f99ed4399 100644 --- a/packages/react-scripts/fixtures/kitchensink/template/jest.transform.js +++ b/packages/react-scripts/fixtures/kitchensink/template/jest.transform.js @@ -1,3 +1,5 @@ +'use strict'; + const babelOptions = { presets: ['react-app'] }; const babelJest = require('babel-jest').default; diff --git a/packages/react-scripts/fixtures/kitchensink/template/src/App.js b/packages/react-scripts/fixtures/kitchensink/template/src/App.js index c9d768f28df..9954cef8f55 100644 --- a/packages/react-scripts/fixtures/kitchensink/template/src/App.js +++ b/packages/react-scripts/fixtures/kitchensink/template/src/App.js @@ -24,7 +24,7 @@ class BuiltEmitter extends Component { // Class components must call this.props.onReady when they're ready for the test. // We will assume functional components are ready immediately after mounting. - if (!Component.isPrototypeOf(feature)) { + if (!Object.prototype.isPrototypeOf.call(Component, feature)) { this.handleReady(); } } diff --git a/packages/react-scripts/fixtures/kitchensink/template/src/features/webpack/LinkedModules.test.js b/packages/react-scripts/fixtures/kitchensink/template/src/features/webpack/LinkedModules.test.js index b850c2aa884..f02cdf67806 100644 --- a/packages/react-scripts/fixtures/kitchensink/template/src/features/webpack/LinkedModules.test.js +++ b/packages/react-scripts/fixtures/kitchensink/template/src/features/webpack/LinkedModules.test.js @@ -12,8 +12,8 @@ import LinkedModules from './LinkedModules'; describe('linked modules', () => { it('has integrity', () => { - expect(test()); - expect(version() === '2.0.0'); + expect(test()).toBeTruthy(); + expect(version() === '2.0.0').toBeTruthy(); }); it('renders without crashing', () => { diff --git a/packages/react-scripts/fixtures/kitchensink/template/src/features/webpack/assets/scss-styles.scss b/packages/react-scripts/fixtures/kitchensink/template/src/features/webpack/assets/scss-styles.scss index 5a764ed2022..a9e8be2496a 100644 --- a/packages/react-scripts/fixtures/kitchensink/template/src/features/webpack/assets/scss-styles.scss +++ b/packages/react-scripts/fixtures/kitchensink/template/src/features/webpack/assets/scss-styles.scss @@ -1,12 +1,12 @@ -@import "~bootstrap/scss/functions"; -@import "~bootstrap/scss/variables"; -@import "~bootstrap/scss/mixins"; +@import '~bootstrap/scss/functions'; +@import '~bootstrap/scss/variables'; +@import '~bootstrap/scss/mixins'; -@import "~bootstrap/scss/reboot"; -@import "~bootstrap/scss/type"; -@import "~bootstrap/scss/images"; -@import "~bootstrap/scss/code"; -@import "~bootstrap/scss/grid"; +@import '~bootstrap/scss/reboot'; +@import '~bootstrap/scss/type'; +@import '~bootstrap/scss/images'; +@import '~bootstrap/scss/code'; +@import '~bootstrap/scss/grid'; #feature-scss-inclusion { background: ghostwhite; diff --git a/packages/react-scripts/lib/react-app.d.ts b/packages/react-scripts/lib/react-app.d.ts index 624c875ec80..780c321229c 100644 --- a/packages/react-scripts/lib/react-app.d.ts +++ b/packages/react-scripts/lib/react-app.d.ts @@ -40,16 +40,16 @@ declare module '*.png' { } declare module '*.webp' { - const src: string; - export default src; + const src: string; + export default src; } declare module '*.svg' { import * as React from 'react'; - export const ReactComponent: React.FunctionComponent & { title?: string }>; + export const ReactComponent: React.FunctionComponent< + React.SVGProps & { title?: string } + >; const src: string; export default src; diff --git a/packages/react-scripts/package.json b/packages/react-scripts/package.json index d698285cf2c..0c73f1297ff 100644 --- a/packages/react-scripts/package.json +++ b/packages/react-scripts/package.json @@ -44,7 +44,7 @@ "dotenv": "^10.0.0", "dotenv-expand": "^5.1.0", "eslint": "^8.3.0", - "eslint-config-react-app": "^7.0.0", + "eslint-config-react-app": "^7.0.1", "eslint-webpack-plugin": "^3.1.1", "file-loader": "^6.2.0", "fs-extra": "^10.0.0", @@ -63,7 +63,7 @@ "postcss-preset-env": "^7.0.1", "prompts": "^2.4.2", "react-app-polyfill": "^3.0.0", - "react-dev-utils": "^12.0.0", + "react-dev-utils": "^12.0.1", "react-refresh": "^0.11.0", "resolve": "^1.20.0", "resolve-url-loader": "^4.0.0", @@ -79,8 +79,8 @@ "workbox-webpack-plugin": "^6.4.1" }, "devDependencies": { - "react": "^17.0.2", - "react-dom": "^17.0.2" + "react": "^18.0.0", + "react-dom": "^18.0.0" }, "optionalDependencies": { "fsevents": "^2.3.2" diff --git a/packages/react-scripts/scripts/eject.js b/packages/react-scripts/scripts/eject.js index e39907f01d7..67e2bb71cde 100644 --- a/packages/react-scripts/scripts/eject.js +++ b/packages/react-scripts/scripts/eject.js @@ -109,7 +109,12 @@ prompts({ } } - const folders = ['config', 'config/jest', 'scripts', 'config/webpack/persistentCache']; + const folders = [ + 'config', + 'config/jest', + 'scripts', + 'config/webpack/persistentCache', + ]; // Make shallow array of files paths const files = folders.reduce((files, folder) => { @@ -138,7 +143,7 @@ prompts({ console.log(cyan(`Copying files into ${appPath}`)); folders.forEach(folder => { - fs.mkdirSync(path.join(appPath, folder), {recursive: true}); + fs.mkdirSync(path.join(appPath, folder), { recursive: true }); }); files.forEach(file => { diff --git a/tasks/e2e-simple.sh b/tasks/e2e-simple.sh index 55f777fc5b2..d2858f0715f 100755 --- a/tasks/e2e-simple.sh +++ b/tasks/e2e-simple.sh @@ -79,15 +79,6 @@ fi # Start the local NPM registry startLocalRegistry "$root_path"/tasks/verdaccio.yaml -# Lint own code -./node_modules/.bin/eslint --max-warnings 0 packages/babel-preset-react-app/ -./node_modules/.bin/eslint --max-warnings 0 packages/confusing-browser-globals/ -./node_modules/.bin/eslint --max-warnings 0 packages/create-react-app/ -./node_modules/.bin/eslint --max-warnings 0 packages/eslint-config-react-app/ -./node_modules/.bin/eslint --max-warnings 0 packages/react-dev-utils/ -./node_modules/.bin/eslint --max-warnings 0 packages/react-error-overlay/src/ -./node_modules/.bin/eslint --max-warnings 0 packages/react-scripts/ - npm test -w react-error-overlay if [ "$AGENT_OS" != 'Windows_NT' ]; then # Flow started hanging on Windows build agents diff --git a/tasks/screencast.js b/tasks/screencast.js index 53c30d6a8fd..79dd2290ca5 100644 --- a/tasks/screencast.js +++ b/tasks/screencast.js @@ -1,10 +1,10 @@ #!/usr/bin/env node /** - * Copyright (c) 2015-present, Facebook, Inc. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. + * Copyright (c) 2015-present, Facebook, Inc. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. */ 'use strict'; @@ -51,8 +51,6 @@ function main() { console.log(`Recorded screencast to ${cast}`); console.log(`Rendered SVG to ${out}`); - } catch (err) { - throw err; } finally { process.chdir(previous); } diff --git a/test/fixtures/__shared__/test-setup.js b/test/fixtures/__shared__/test-setup.js index 30d1ac644a2..f46359a503f 100644 --- a/test/fixtures/__shared__/test-setup.js +++ b/test/fixtures/__shared__/test-setup.js @@ -1,3 +1,5 @@ +'use strict'; + const path = require('path'); const fs = require('fs-extra'); const TestSetup = require('./util/setup'); diff --git a/test/fixtures/__shared__/util/scripts.js b/test/fixtures/__shared__/util/scripts.js index ac4c176f46f..c6406cc17e4 100644 --- a/test/fixtures/__shared__/util/scripts.js +++ b/test/fixtures/__shared__/util/scripts.js @@ -1,6 +1,7 @@ +'use strict'; + const execa = require('execa'); const getPort = require('get-port'); -const os = require('os'); const stripAnsi = require('strip-ansi'); const waitForLocalhost = require('wait-for-localhost'); diff --git a/test/fixtures/__shared__/util/setup.js b/test/fixtures/__shared__/util/setup.js index 0ec8b1ae393..1fcc8f87bdc 100644 --- a/test/fixtures/__shared__/util/setup.js +++ b/test/fixtures/__shared__/util/setup.js @@ -1,3 +1,5 @@ +'use strict'; + const execa = require('execa'); const fs = require('fs-extra'); const path = require('path'); diff --git a/test/fixtures/boostrap-sass/index.test.js b/test/fixtures/boostrap-sass/index.test.js index 4be53d03460..5efeb813e9c 100644 --- a/test/fixtures/boostrap-sass/index.test.js +++ b/test/fixtures/boostrap-sass/index.test.js @@ -1,3 +1,5 @@ +'use strict'; + const testSetup = require('../__shared__/test-setup'); if (testSetup.isLocal) { diff --git a/test/fixtures/builds-with-multiple-runtimes/index.test.js b/test/fixtures/builds-with-multiple-runtimes/index.test.js index 64d328aee0b..b5e769b6235 100644 --- a/test/fixtures/builds-with-multiple-runtimes/index.test.js +++ b/test/fixtures/builds-with-multiple-runtimes/index.test.js @@ -1,3 +1,5 @@ +'use strict'; + const testSetup = require('../__shared__/test-setup'); test('builds in development', async () => { diff --git a/test/fixtures/global-scss-asset-resolution/index.test.js b/test/fixtures/global-scss-asset-resolution/index.test.js index 4be53d03460..5efeb813e9c 100644 --- a/test/fixtures/global-scss-asset-resolution/index.test.js +++ b/test/fixtures/global-scss-asset-resolution/index.test.js @@ -1,3 +1,5 @@ +'use strict'; + const testSetup = require('../__shared__/test-setup'); if (testSetup.isLocal) { diff --git a/test/fixtures/global-scss-asset-resolution/src/index.scss b/test/fixtures/global-scss-asset-resolution/src/index.scss index 151c0b4a6cd..81ade6705a1 100644 --- a/test/fixtures/global-scss-asset-resolution/src/index.scss +++ b/test/fixtures/global-scss-asset-resolution/src/index.scss @@ -1,5 +1,5 @@ #root { - width: 300px; - height: 300px; - background: url(/images/logo.svg) center/cover no-repeat; + width: 300px; + height: 300px; + background: url(/images/logo.svg) center/cover no-repeat; } diff --git a/test/fixtures/issue-5176-flow-class-properties/index.test.js b/test/fixtures/issue-5176-flow-class-properties/index.test.js index fa09a2222af..b1270fc8ba0 100644 --- a/test/fixtures/issue-5176-flow-class-properties/index.test.js +++ b/test/fixtures/issue-5176-flow-class-properties/index.test.js @@ -1,3 +1,5 @@ +'use strict'; + const testSetup = require('../__shared__/test-setup'); test('passes tests', async () => { diff --git a/test/fixtures/issue-5947-not-typescript/index.test.js b/test/fixtures/issue-5947-not-typescript/index.test.js index aacc783152c..746e517d754 100644 --- a/test/fixtures/issue-5947-not-typescript/index.test.js +++ b/test/fixtures/issue-5947-not-typescript/index.test.js @@ -1,3 +1,5 @@ +'use strict'; + const testSetup = require('../__shared__/test-setup'); const path = require('path'); const fs = require('fs'); diff --git a/test/fixtures/jsconfig/index.test.js b/test/fixtures/jsconfig/index.test.js index eeba70a7420..fc448500a38 100644 --- a/test/fixtures/jsconfig/index.test.js +++ b/test/fixtures/jsconfig/index.test.js @@ -1,3 +1,5 @@ +'use strict'; + const testSetup = require('../__shared__/test-setup'); test('builds in development', async () => { diff --git a/test/fixtures/mjs-support/index.test.js b/test/fixtures/mjs-support/index.test.js index 97f931e95bf..5468855bf8c 100644 --- a/test/fixtures/mjs-support/index.test.js +++ b/test/fixtures/mjs-support/index.test.js @@ -1,3 +1,5 @@ +'use strict'; + const testSetup = require('../__shared__/test-setup'); const puppeteer = require('puppeteer'); diff --git a/test/fixtures/relative-paths/index.test.js b/test/fixtures/relative-paths/index.test.js index f29dc2b3589..5e523a808e3 100644 --- a/test/fixtures/relative-paths/index.test.js +++ b/test/fixtures/relative-paths/index.test.js @@ -1,3 +1,5 @@ +'use strict'; + const testSetup = require('../__shared__/test-setup'); const fs = require('fs-extra'); diff --git a/test/fixtures/typescript-advanced/index.test.js b/test/fixtures/typescript-advanced/index.test.js index fe7ff9c2bda..2a5df9c18fa 100644 --- a/test/fixtures/typescript-advanced/index.test.js +++ b/test/fixtures/typescript-advanced/index.test.js @@ -1,3 +1,5 @@ +'use strict'; + const testSetup = require('../__shared__/test-setup'); test('builds in development', async () => { diff --git a/test/fixtures/typescript-advanced/src/App.tsx b/test/fixtures/typescript-advanced/src/App.tsx index 3d14b6cc8bd..7eaa327be1b 100644 --- a/test/fixtures/typescript-advanced/src/App.tsx +++ b/test/fixtures/typescript-advanced/src/App.tsx @@ -7,19 +7,19 @@ interface MyType { } function assertIsString(val: any): asserts val is string { - if (typeof val !== "string") { - throw new Error("Not a string!"); + if (typeof val !== 'string') { + throw new Error('Not a string!'); } } -const foo: any = "bar"; +const foo: any = 'bar'; assertIsString(foo); type MyObject = Pick; class App extends React.Component { static foo: MyObject = { bar: true, baz: { n: 123 } }; - n = App.foo?.baz!.n ?? "foo"; + n = App.foo?.baz!.n ?? 'foo'; render() { return
; diff --git a/test/fixtures/typescript-typecheck/index.test.js b/test/fixtures/typescript-typecheck/index.test.js index c4978c735e9..bb6c6e6db3d 100644 --- a/test/fixtures/typescript-typecheck/index.test.js +++ b/test/fixtures/typescript-typecheck/index.test.js @@ -1,3 +1,5 @@ +'use strict'; + const testSetup = require('../__shared__/test-setup'); const puppeteer = require('puppeteer'); diff --git a/test/fixtures/typescript/index.test.js b/test/fixtures/typescript/index.test.js index fa09a2222af..b1270fc8ba0 100644 --- a/test/fixtures/typescript/index.test.js +++ b/test/fixtures/typescript/index.test.js @@ -1,3 +1,5 @@ +'use strict'; + const testSetup = require('../__shared__/test-setup'); test('passes tests', async () => { diff --git a/test/fixtures/typescript/src/App.ts b/test/fixtures/typescript/src/App.ts index ee9276a699a..86b59b61694 100644 --- a/test/fixtures/typescript/src/App.ts +++ b/test/fixtures/typescript/src/App.ts @@ -22,7 +22,7 @@ function annotation(target: any) { } function propertyDecorator(target: any, key: string) { - arguments[2].initializer = function() { + arguments[2].initializer = function () { return 42; }; } diff --git a/test/fixtures/webpack-message-formatting/index.test.js b/test/fixtures/webpack-message-formatting/index.test.js index f813a1eecdf..56dd731151c 100644 --- a/test/fixtures/webpack-message-formatting/index.test.js +++ b/test/fixtures/webpack-message-formatting/index.test.js @@ -1,3 +1,5 @@ +'use strict'; + const testSetup = require('../__shared__/test-setup'); const fs = require('fs-extra'); @@ -125,12 +127,14 @@ test('formats case sensitive path error', async () => { path.join(testSetup.testDirectory, 'src', 'App.js') ); - const { stdout, stderr } = await testSetup.scripts.start({ smoke: true }); + const { stderr } = await testSetup.scripts.start({ smoke: true }); if (process.platform === 'darwin') { + // eslint-disable-next-line jest/no-conditional-expect expect(stderr).toMatch( `Cannot find file: 'export5.js' does not match the corresponding name on disk: './src/Export5.js'.` ); } else { + // eslint-disable-next-line jest/no-conditional-expect expect(stderr).not.toEqual(''); // TODO: figure out how we can test this on Linux/Windows // I believe getting this working requires we tap into enhanced-resolve // pipeline, which is debt we don't want to take on right now.