From b0cd28663d1e4a744c35549dd7dc3c4f2c6fc62d Mon Sep 17 00:00:00 2001 From: Alexey Raspopov Date: Sat, 1 Jul 2017 02:05:25 +0300 Subject: [PATCH 01/39] Issue template: fix env list ordering (#2697) --- .github/ISSUE_TEMPLATE.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/ISSUE_TEMPLATE.md b/.github/ISSUE_TEMPLATE.md index dc3c02df8ab..ca97a668bab 100644 --- a/.github/ISSUE_TEMPLATE.md +++ b/.github/ISSUE_TEMPLATE.md @@ -81,8 +81,8 @@ 1. `node -v`: 2. `npm -v`: -4. `yarn --version` (if you use Yarn): -3. `npm ls react-scripts` (if you haven’t ejected): +3. `yarn --version` (if you use Yarn): +4. `npm ls react-scripts` (if you haven’t ejected): Then, specify: From df00d8071abf8dac07510d76beb09b3f15b6f721 Mon Sep 17 00:00:00 2001 From: Kristoffer Date: Sat, 1 Jul 2017 16:49:49 +0200 Subject: [PATCH 02/39] allowTaggedTemplates to avoid warnings from SC's (#2701) --- packages/eslint-config-react-app/index.js | 1 + 1 file changed, 1 insertion(+) diff --git a/packages/eslint-config-react-app/index.js b/packages/eslint-config-react-app/index.js index 7298a8c3b3d..a8b900f940d 100644 --- a/packages/eslint-config-react-app/index.js +++ b/packages/eslint-config-react-app/index.js @@ -185,6 +185,7 @@ module.exports = { { allowShortCircuit: true, allowTernary: true, + allowTaggedTemplates: true, }, ], 'no-unused-labels': 'warn', From 85a9bc8590528bd1e5bab186918721feb64c7d78 Mon Sep 17 00:00:00 2001 From: Danny Ho Date: Mon, 3 Jul 2017 13:03:00 -0700 Subject: [PATCH 03/39] Remove Windows note for source-map-explorer (#2719) Glob support has been added in source-map-explorer@1.4+ --- packages/react-scripts/template/README.md | 10 ---------- 1 file changed, 10 deletions(-) diff --git a/packages/react-scripts/template/README.md b/packages/react-scripts/template/README.md index 5775028406e..6df4d43d7f6 100644 --- a/packages/react-scripts/template/README.md +++ b/packages/react-scripts/template/README.md @@ -1671,16 +1671,6 @@ Then in `package.json`, add the following line to `scripts`: "test": "react-scripts test --env=jsdom", ``` ->**Note:** -> ->This doesn't quite work on Windows because it doesn't automatically expand `*` in the filepath. For now, the workaround is to look at the full hashed filename in `build/static/js` (e.g. `main.89b7e95a.js`) and copy it into `package.json` when you're running the analyzer. For example: -> ->```diff ->+ "analyze": "source-map-explorer build/static/js/main.89b7e95a.js", ->``` -> ->Unfortunately it will be different after every build. You can express support for fixing this on Windows [in this issue](https://github.com/danvk/source-map-explorer/issues/52). - Then to analyze the bundle run the production build then run the analyze script. From f495c15578403cf2dbac211493ae8fb6ac742415 Mon Sep 17 00:00:00 2001 From: Trygve Aaberge Date: Wed, 5 Jul 2017 00:44:55 +0200 Subject: [PATCH 04/39] Reorder vim arguments in launchEditor so --remote works (#2723) This allows you to set REACT_EDITOR to 'vim --remote', so the file can be opened in an already running vim process. When using vim without remote, it works in the same way as before. When launching vim without --remote, the order of the line and path arguments doesn't matter. However, when using --remote the line argument has to precede the path. This happens to be the same as joe and emacs uses, so the vim cases were just moved there. I haven't tested this with mvim, but the documentation says the same as the vim documentation, so I assume it works the same. --- packages/react-dev-utils/launchEditor.js | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/packages/react-dev-utils/launchEditor.js b/packages/react-dev-utils/launchEditor.js index bcf0a506069..6f623dcf81b 100644 --- a/packages/react-dev-utils/launchEditor.js +++ b/packages/react-dev-utils/launchEditor.js @@ -58,9 +58,6 @@ function addWorkspaceToArgumentsIfExists(args, workspace) { function getArgumentsForLineNumber(editor, fileName, lineNumber, workspace) { const editorBasename = path.basename(editor).replace(/\.(exe|cmd|bat)$/i, ''); switch (editorBasename) { - case 'vim': - case 'mvim': - return [fileName, '+' + lineNumber]; case 'atom': case 'Atom': case 'Atom Beta': @@ -74,6 +71,8 @@ function getArgumentsForLineNumber(editor, fileName, lineNumber, workspace) { return [fileName + ':' + lineNumber]; case 'notepad++': return ['-n' + lineNumber, fileName]; + case 'vim': + case 'mvim': case 'joe': case 'emacs': case 'emacsclient': From 8442cf313b351dab840fedf348785b61e87572ea Mon Sep 17 00:00:00 2001 From: Forbes Lindesay Date: Thu, 6 Jul 2017 16:47:41 +0100 Subject: [PATCH 05/39] Update link to issue blocking JSX hoisting (#2732) --- packages/babel-preset-react-app/index.js | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/packages/babel-preset-react-app/index.js b/packages/babel-preset-react-app/index.js index c8f20dde61d..f6102dc0529 100644 --- a/packages/babel-preset-react-app/index.js +++ b/packages/babel-preset-react-app/index.js @@ -129,10 +129,7 @@ if (env === 'test') { if (env === 'production') { // Optimization: hoist JSX that never changes out of render() - // Disabled because of issues: - // * https://github.com/facebookincubator/create-react-app/issues/525 - // * https://phabricator.babeljs.io/search/query/pCNlnC2xzwzx/ - // * https://github.com/babel/babel/issues/4516 + // Disabled because of issues: https://github.com/facebookincubator/create-react-app/issues/553 // TODO: Enable again when these issues are resolved. // plugins.push.apply(plugins, [ // require.resolve('babel-plugin-transform-react-constant-elements') From 804ac0009548cdddebb571a899c718572be08406 Mon Sep 17 00:00:00 2001 From: Dan Ristea Date: Fri, 7 Jul 2017 11:34:56 +0100 Subject: [PATCH 06/39] Support PyCharm in launchEditor (#2740) PyCharm has the same signature as WebStorm and PhpStorm ` --line ` so it can reuse the logic from those. https://www.jetbrains.com/help/pycharm/opening-files-from-command-line.html Tested with PyCharm Pro 2017.1.4 on MacOS 10.12 --- packages/react-dev-utils/launchEditor.js | 2 ++ 1 file changed, 2 insertions(+) diff --git a/packages/react-dev-utils/launchEditor.js b/packages/react-dev-utils/launchEditor.js index 6f623dcf81b..bc1bd4d6e9d 100644 --- a/packages/react-dev-utils/launchEditor.js +++ b/packages/react-dev-utils/launchEditor.js @@ -91,6 +91,8 @@ function getArgumentsForLineNumber(editor, fileName, lineNumber, workspace) { case 'webstorm64': case 'phpstorm': case 'phpstorm64': + case 'pycharm': + case 'pycharm64': return addWorkspaceToArgumentsIfExists( ['--line', lineNumber, fileName], workspace From 16f0d4a56cbfd1525de6da52005f73ce7a5eafc6 Mon Sep 17 00:00:00 2001 From: Mostafa Hajizadeh Date: Fri, 7 Jul 2017 15:07:32 +0430 Subject: [PATCH 07/39] Add "node" to Jest's moduleFileExtensions (#2738) Jest's default value for this option is ["js", "json", "jsx", "node"]. CRA's current value is ["web.js", "js", "json", "web.jsx", "jsx"], which is missing one of default ones: "node". This change fixes that. This "node" extension is used in packages that use native code. --- packages/react-scripts/scripts/utils/createJestConfig.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/react-scripts/scripts/utils/createJestConfig.js b/packages/react-scripts/scripts/utils/createJestConfig.js index de74958efad..bc4ebf82271 100644 --- a/packages/react-scripts/scripts/utils/createJestConfig.js +++ b/packages/react-scripts/scripts/utils/createJestConfig.js @@ -43,7 +43,7 @@ module.exports = (resolve, rootDir, isEjecting) => { moduleNameMapper: { '^react-native$': 'react-native-web', }, - moduleFileExtensions: ['web.js', 'js', 'json', 'web.jsx', 'jsx'], + moduleFileExtensions: ['web.js', 'js', 'json', 'web.jsx', 'jsx', 'node'], }; if (rootDir) { config.rootDir = rootDir; From bbbc15dc8ebdcb1b5a631b9b5537e26c28c146cd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C4=90inh=20Quang=20Trung?= Date: Fri, 7 Jul 2017 17:40:29 +0700 Subject: [PATCH 08/39] ESLint 4 (#2735) * Update eslint-loader 1.7.1 -> 1.9.0 * Add eslintPath option * Update eslint 3.19.0 -> 4.1.1 * Update peer dependencies * Move eslintPath config to outside @remove-on-eject --- packages/eslint-config-react-app/package.json | 2 +- packages/react-scripts/config/webpack.config.dev.js | 1 + packages/react-scripts/config/webpack.config.prod.js | 1 + packages/react-scripts/package.json | 8 ++++---- 4 files changed, 7 insertions(+), 5 deletions(-) diff --git a/packages/eslint-config-react-app/package.json b/packages/eslint-config-react-app/package.json index cd36a70e5cb..559e78b256b 100644 --- a/packages/eslint-config-react-app/package.json +++ b/packages/eslint-config-react-app/package.json @@ -12,7 +12,7 @@ ], "peerDependencies": { "babel-eslint": "^7.2.3", - "eslint": "^3.19.0", + "eslint": "^4.1.1", "eslint-plugin-flowtype": "^2.33.0", "eslint-plugin-import": "^2.2.0", "eslint-plugin-jsx-a11y": "^5.0.3", diff --git a/packages/react-scripts/config/webpack.config.dev.js b/packages/react-scripts/config/webpack.config.dev.js index 987e7a3570c..ea749495b5b 100644 --- a/packages/react-scripts/config/webpack.config.dev.js +++ b/packages/react-scripts/config/webpack.config.dev.js @@ -136,6 +136,7 @@ module.exports = { { options: { formatter: eslintFormatter, + eslintPath: require.resolve('eslint'), // @remove-on-eject-begin baseConfig: { extends: [require.resolve('eslint-config-react-app')], diff --git a/packages/react-scripts/config/webpack.config.prod.js b/packages/react-scripts/config/webpack.config.prod.js index 1ba1307bb3e..f943ef9ecec 100644 --- a/packages/react-scripts/config/webpack.config.prod.js +++ b/packages/react-scripts/config/webpack.config.prod.js @@ -136,6 +136,7 @@ module.exports = { { options: { formatter: eslintFormatter, + eslintPath: require.resolve('eslint'), // @remove-on-eject-begin // TODO: consider separate config for production, // e.g. to enable no-console and no-debugger only in production. diff --git a/packages/react-scripts/package.json b/packages/react-scripts/package.json index 5c1225e1d34..d0eddad69e5 100644 --- a/packages/react-scripts/package.json +++ b/packages/react-scripts/package.json @@ -32,12 +32,12 @@ "chalk": "1.1.3", "css-loader": "0.28.4", "dotenv": "4.0.0", - "eslint": "3.19.0", + "eslint": "4.1.1", "eslint-config-react-app": "^1.0.5", - "eslint-loader": "1.7.1", + "eslint-loader": "1.9.0", "eslint-plugin-flowtype": "2.34.0", - "eslint-plugin-import": "2.2.0", - "eslint-plugin-jsx-a11y": "5.0.3", + "eslint-plugin-import": "2.7.0", + "eslint-plugin-jsx-a11y": "5.1.1", "eslint-plugin-react": "7.1.0", "extract-text-webpack-plugin": "2.1.2", "file-loader": "0.11.2", From a08eb3b44b47b3a1c9776e0859943f610ab50085 Mon Sep 17 00:00:00 2001 From: Andreas Hoffmann Date: Sun, 9 Jul 2017 22:59:19 +0200 Subject: [PATCH 09/39] Use Rule.oneOf to resolve correct loader (#2747) * Use oneOf to resolve correct loader * Add html and json fallthrough again * Use oneOf to resolve correct loader in dev * Document file-loaders `js` exclusion * Remove `jsx` from exclusion in prod config --- .../config/webpack.config.dev.js | 154 +++++++------- .../config/webpack.config.prod.js | 192 +++++++++--------- 2 files changed, 171 insertions(+), 175 deletions(-) diff --git a/packages/react-scripts/config/webpack.config.dev.js b/packages/react-scripts/config/webpack.config.dev.js index ea749495b5b..253bc34f062 100644 --- a/packages/react-scripts/config/webpack.config.dev.js +++ b/packages/react-scripts/config/webpack.config.dev.js @@ -150,97 +150,95 @@ module.exports = { ], include: paths.appSrc, }, - // ** ADDING/UPDATING LOADERS ** - // The "file" loader handles all assets unless explicitly excluded. - // The `exclude` list *must* be updated with every change to loader extensions. - // When adding a new loader, you must add its `test` - // as a new entry in the `exclude` list for "file" loader. - - // "file" loader makes sure those assets get served by WebpackDevServer. - // When you `import` an asset, you get its (virtual) filename. - // In production, they would get copied to the `build` folder. - { - exclude: [ - /\.html$/, - /\.(js|jsx)$/, - /\.css$/, - /\.json$/, - /\.bmp$/, - /\.gif$/, - /\.jpe?g$/, - /\.png$/, - ], - loader: require.resolve('file-loader'), - options: { - name: 'static/media/[name].[hash:8].[ext]', - }, - }, - // "url" loader works like "file" loader except that it embeds assets - // smaller than specified limit in bytes as data URLs to avoid requests. - // A missing `test` is equivalent to a match. - { - test: [/\.bmp$/, /\.gif$/, /\.jpe?g$/, /\.png$/], - loader: require.resolve('url-loader'), - options: { - limit: 10000, - name: 'static/media/[name].[hash:8].[ext]', - }, - }, - // Process JS with Babel. { - test: /\.(js|jsx)$/, - include: paths.appSrc, - loader: require.resolve('babel-loader'), - options: { - // @remove-on-eject-begin - babelrc: false, - presets: [require.resolve('babel-preset-react-app')], - // @remove-on-eject-end - // This is a feature of `babel-loader` for webpack (not Babel itself). - // It enables caching results in ./node_modules/.cache/babel-loader/ - // directory for faster rebuilds. - cacheDirectory: true, - }, - }, - // "postcss" loader applies autoprefixer to our CSS. - // "css" loader resolves paths in CSS and adds assets as dependencies. - // "style" loader turns CSS into JS modules that inject