@reactunity/scripts 0.6.1 → 0.9.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (35) hide show
  1. package/bin/react-unity-scripts.js +7 -2
  2. package/config/env.js +1 -3
  3. package/config/eslint/base.js +43 -0
  4. package/config/eslint/config.js +252 -0
  5. package/config/eslint/jest.js +59 -0
  6. package/config/eslintConfig.js +31 -0
  7. package/config/jest/babelTransform.js +37 -0
  8. package/config/jest/cssTransform.js +22 -0
  9. package/config/jest/fileTransform.js +40 -0
  10. package/config/modules.js +14 -0
  11. package/config/paths.js +6 -0
  12. package/config/unityMiddleware.js +29 -0
  13. package/config/web-inspector/Build/WebInspector.data +0 -0
  14. package/config/web-inspector/Build/WebInspector.framework.js +1 -1
  15. package/config/web-inspector/Build/WebInspector.loader.js +1 -1
  16. package/config/web-inspector/Build/WebInspector.wasm +0 -0
  17. package/config/web-inspector/index.html +2 -2
  18. package/config/webpack/persistentCache/createEnvironmentHash.js +9 -0
  19. package/config/webpack.config.js +183 -169
  20. package/config/webpackDevServer.config.js +49 -79
  21. package/lib/types/base.d.ts +21 -7
  22. package/package.json +63 -54
  23. package/scripts/build.js +41 -19
  24. package/scripts/eject.js +237 -234
  25. package/scripts/init.js +11 -12
  26. package/scripts/lint.js +40 -0
  27. package/scripts/start.js +40 -40
  28. package/scripts/test.js +129 -0
  29. package/scripts/utils/createJestConfig.js +152 -0
  30. package/scripts/utils/verifyTypeScriptSetup.js +306 -309
  31. package/config/pnpTs.js +0 -43
  32. package/config/react-error-overlay.js +0 -9
  33. package/config/refreshOverlayInterop.js +0 -4
  34. package/config/webpackHotDevClient.js +0 -268
  35. package/scripts/utils/verifyPackageTree.js +0 -161
@@ -12,38 +12,55 @@ const fs = require('fs');
12
12
  const path = require('path');
13
13
  const webpack = require('webpack');
14
14
  const resolve = require('resolve');
15
- const PnpWebpackPlugin = require('pnp-webpack-plugin');
16
15
  const CaseSensitivePathsPlugin = require('case-sensitive-paths-webpack-plugin');
17
16
  const TerserPlugin = require('terser-webpack-plugin');
18
- const WatchMissingNodeModulesPlugin = require('react-dev-utils/WatchMissingNodeModulesPlugin');
17
+ const MiniCssExtractPlugin = require('mini-css-extract-plugin');
18
+ const { WebpackManifestPlugin } = require('webpack-manifest-plugin');
19
19
  const ModuleScopePlugin = require('react-dev-utils/ModuleScopePlugin');
20
20
  const getCSSModuleLocalIdent = require('react-dev-utils/getCSSModuleLocalIdent');
21
21
  const ESLintPlugin = require('eslint-webpack-plugin');
22
+ const eslintConfig = require('./eslintConfig');
22
23
  const paths = require('./paths');
23
24
  const modules = require('./modules');
24
25
  const getClientEnvironment = require('./env');
25
26
  const ModuleNotFoundPlugin = require('react-dev-utils/ModuleNotFoundPlugin');
26
- const ForkTsCheckerWebpackPlugin = require('react-dev-utils/ForkTsCheckerWebpackPlugin');
27
- const typescriptFormatter = require('react-dev-utils/typescriptFormatter');
27
+ const ForkTsCheckerWebpackPlugin =
28
+ process.env.TSC_COMPILE_ON_ERROR === 'true'
29
+ ? require('react-dev-utils/ForkTsCheckerWarningWebpackPlugin')
30
+ : require('react-dev-utils/ForkTsCheckerWebpackPlugin');
28
31
  const ReactRefreshWebpackPlugin = require('@pmmmwh/react-refresh-webpack-plugin');
29
- const restrictedGlobals = require('confusing-browser-globals');
30
32
  // @remove-on-eject-begin
31
33
  const getCacheIdentifier = require('react-dev-utils/getCacheIdentifier');
32
34
  // @remove-on-eject-end
35
+ const createEnvironmentHash = require('./webpack/persistentCache/createEnvironmentHash');
33
36
 
34
37
  // Source maps are resource heavy and can cause out of memory issue for large source files.
38
+
35
39
  const sourceMapVar = process.env.GENERATE_SOURCEMAP;
36
40
  const shouldUseSourceMap = sourceMapVar !== 'false' && !!sourceMapVar;
37
41
  const sourceMapType = sourceMapVar !== 'false' && sourceMapVar !== 'true' && sourceMapVar;
38
42
 
39
- const webpackDevClientEntry = require.resolve(
40
- './webpackHotDevClient'
43
+ const reactRefreshRuntimeEntry = require.resolve('react-refresh/runtime');
44
+ const reactRefreshWebpackPluginRuntimeEntry = require.resolve(
45
+ '@pmmmwh/react-refresh-webpack-plugin'
41
46
  );
42
- const reactRefreshOverlayEntry = require.resolve(
43
- './refreshOverlayInterop'
47
+ const babelRuntimeEntry = require.resolve('babel-preset-react-app');
48
+ const babelRuntimeEntryHelpers = require.resolve(
49
+ '@babel/runtime/helpers/esm/assertThisInitialized',
50
+ { paths: [babelRuntimeEntry] }
44
51
  );
52
+ const babelRuntimeRegenerator = require.resolve('@babel/runtime/regenerator', {
53
+ paths: [babelRuntimeEntry],
54
+ });
55
+
56
+ // Some apps do not need the benefits of saving a web request, so not inlining the chunk
57
+ // makes for a smoother build process.
58
+ const shouldInlineRuntimeChunk = process.env.INLINE_RUNTIME_CHUNK === 'true';
59
+
45
60
  const emitErrorsAsWarnings = process.env.ESLINT_NO_DEV_ERRORS === 'true';
46
61
  const disableESLintPlugin = process.env.DISABLE_ESLINT_PLUGIN === 'true';
62
+ const extractCss = process.env.EXTRACT_CSS === 'true';
63
+ const generateManifest = process.env.GENERATE_MANIFEST !== 'false';
47
64
 
48
65
  const imageInlineSizeLimit = parseInt(
49
66
  process.env.IMAGE_INLINE_SIZE_LIMIT || '0'
@@ -52,30 +69,23 @@ const imageInlineSizeLimit = parseInt(
52
69
  // Check if TypeScript is setup
53
70
  const useTypeScript = fs.existsSync(paths.appTsConfig);
54
71
 
72
+ // Check if Tailwind config exists
73
+ const useTailwind = fs.existsSync(
74
+ path.join(paths.appPath, 'tailwind.config.js')
75
+ );
76
+
55
77
  // style files regexes
56
78
  const cssRegex = /\.css$/;
57
79
  const cssModuleRegex = /\.module\.css$/;
58
80
  const sassRegex = /\.(scss|sass)$/;
59
81
  const sassModuleRegex = /\.module\.(scss|sass)$/;
60
82
 
61
- const hasJsxRuntime = (() => {
62
- if (process.env.DISABLE_NEW_JSX_TRANSFORM === 'true') {
63
- return false;
64
- }
65
-
66
- try {
67
- require.resolve('react/jsx-runtime');
68
- return true;
69
- } catch (e) {
70
- return false;
71
- }
72
- })();
73
-
74
83
  // This is the production and development configuration.
75
84
  // It is focused on developer experience, fast rebuilds, and a minimal bundle.
76
85
  module.exports = function (webpackEnv) {
77
86
  const isEnvDevelopment = webpackEnv === 'development';
78
87
  const isEnvProduction = webpackEnv === 'production';
88
+ const shouldExtractCss = isEnvProduction && extractCss;
79
89
 
80
90
  // Variable used for enabling profiling in Production
81
91
  // passed into alias object. Uses a flag if passed into the build command
@@ -93,13 +103,35 @@ module.exports = function (webpackEnv) {
93
103
  // common function to get style loaders
94
104
  const getStyleLoaders = (cssOptions, preProcessor) => {
95
105
  const loaders = [
96
- // Always use style-loader in React Unity as we do not extract CSS files
97
- require.resolve('style-loader'),
98
-
106
+ !shouldExtractCss ? require.resolve('style-loader')
107
+ : {
108
+ loader: MiniCssExtractPlugin.loader,
109
+ // css is located in `static/css`, use '../../' to locate index.html folder
110
+ // in production `paths.publicUrlOrPath` can be a relative path
111
+ options: paths.publicUrlOrPath.startsWith('.')
112
+ ? { publicPath: '../../' }
113
+ : {},
114
+ },
99
115
  {
100
116
  loader: require.resolve('css-loader'),
101
117
  options: cssOptions,
102
118
  },
119
+ useTailwind && {
120
+ // Options for PostCSS as we reference these options twice
121
+ // Adds vendor prefixing based on your specified browser support in
122
+ // package.json
123
+ loader: require.resolve('postcss-loader'),
124
+ options: {
125
+ postcssOptions: {
126
+ // Necessary for external CSS imports to work
127
+ // https://github.com/facebook/create-react-app/issues/2677
128
+ ident: 'postcss',
129
+ config: false,
130
+ plugins: ['tailwindcss'],
131
+ },
132
+ sourceMap: isEnvProduction ? shouldUseSourceMap : isEnvDevelopment,
133
+ },
134
+ },
103
135
  ].filter(Boolean);
104
136
  if (preProcessor) {
105
137
  loaders.push(
@@ -132,40 +164,20 @@ module.exports = function (webpackEnv) {
132
164
  : isEnvDevelopment && (sourceMapType || 'eval-source-map'),
133
165
  // These are the "entry points" to our application.
134
166
  // This means they will be the "root" imports that are included in JS bundle.
135
- entry:
136
- isEnvDevelopment && !shouldUseReactRefresh
137
- ? [
138
- // Include an alternative client for WebpackDevServer. A client's job is to
139
- // connect to WebpackDevServer by a socket and get notified about changes.
140
- // When you save a file, the client will either apply hot updates (in case
141
- // of CSS changes), or refresh the page (in case of JS changes). When you
142
- // make a syntax error, this client will display a syntax error overlay.
143
- // Note: instead of the default WebpackDevServer client, we use a custom one
144
- // to bring better experience for Create React App users. You can replace
145
- // the line below with these two lines if you prefer the stock client:
146
- //
147
- // require.resolve('webpack-dev-server/client') + '?/',
148
- // require.resolve('webpack/hot/dev-server'),
149
- //
150
- // When using the experimental react-refresh integration,
151
- // the webpack plugin takes care of injecting the dev client for us.
152
- webpackDevClientEntry,
153
- // Finally, this is your app's code:
154
- paths.appIndexJs,
155
- // We include the app code last so that if there is a runtime error during
156
- // initialization, it doesn't blow up the WebpackDevServer client, and
157
- // changing JS code would still trigger a refresh.
158
- ]
159
- : paths.appIndexJs,
167
+ entry: paths.appIndexJs,
160
168
  output: {
161
169
  // The build folder.
162
- path: isEnvProduction ? paths.appBuild : undefined,
170
+ path: paths.appBuild,
163
171
  // Add /* filename */ comments to generated require()s in the output.
164
172
  pathinfo: isEnvDevelopment,
165
173
  // There will be one main bundle, and one file per asynchronous chunk.
166
174
  // In development, it does not produce real files.
167
175
  filename: isEnvDevelopment ? 'index.js' : process.env.FILENAME || 'index.js',
168
- chunkFilename: 'static/chunk/[name].js',
176
+ // There are also additional JS chunk files if you use code splitting.
177
+ chunkFilename: isEnvProduction
178
+ ? 'static/js/[name].chunk.js'
179
+ : isEnvDevelopment && 'static/js/[name].chunk.js',
180
+ assetModuleFilename: 'static/media/[name][ext]',
169
181
  // webpack uses `publicPath` to determine where the app is being served from.
170
182
  // It requires a trailing slash, or the file assets will get an incorrect path.
171
183
  // We inferred the "public path" (such as / or /my-project) from homepage.
@@ -178,9 +190,22 @@ module.exports = function (webpackEnv) {
178
190
  .replace(/\\/g, '/')
179
191
  : isEnvDevelopment &&
180
192
  (info => path.resolve(info.absoluteResourcePath).replace(/\\/g, '/')),
181
- // this defaults to 'window', but by setting it to 'this' then
182
- // module chunks which are built will work in web workers as well.
183
- globalObject: 'this',
193
+ },
194
+ cache: {
195
+ type: 'filesystem',
196
+ version: createEnvironmentHash(env.raw),
197
+ cacheDirectory: paths.appWebpackCache,
198
+ store: 'pack',
199
+ buildDependencies: {
200
+ defaultWebpack: ['webpack/lib/'],
201
+ config: [__filename],
202
+ tsconfig: [paths.appTsConfig, paths.appJsConfig].filter(f =>
203
+ fs.existsSync(f)
204
+ ),
205
+ },
206
+ },
207
+ infrastructureLogging: {
208
+ level: 'none',
184
209
  },
185
210
  optimization: {
186
211
  minimize: false,
@@ -260,9 +285,6 @@ module.exports = function (webpackEnv) {
260
285
  ...(modules.webpackAliases || {}),
261
286
  },
262
287
  plugins: [
263
- // Adds support for installing with Plug'n'Play, leading to faster installs and adding
264
- // guards against forgotten dependencies and such.
265
- PnpWebpackPlugin,
266
288
  // Prevents users from importing files from outside of src/ (or node_modules/).
267
289
  // This often causes confusion because we only process files within src/ with babel.
268
290
  // To fix this, we prevent you from importing files out of src/ -- if you'd like to,
@@ -270,22 +292,24 @@ module.exports = function (webpackEnv) {
270
292
  // Make sure your source files are compiled, as they will not be processed in any way.
271
293
  new ModuleScopePlugin(paths.appSrc, [
272
294
  paths.appPackageJson,
273
- reactRefreshOverlayEntry,
295
+ reactRefreshRuntimeEntry,
296
+ reactRefreshWebpackPluginRuntimeEntry,
297
+ babelRuntimeEntry,
298
+ babelRuntimeEntryHelpers,
299
+ babelRuntimeRegenerator,
274
300
  ]),
275
301
  ],
276
302
  },
277
- resolveLoader: {
278
- plugins: [
279
- // Also related to Plug'n'Play, but this time it tells webpack to load its loaders
280
- // from the current package.
281
- PnpWebpackPlugin.moduleLoader(module),
282
- ],
283
- },
284
303
  module: {
285
304
  strictExportPresence: true,
286
305
  rules: [
287
- // Disable require.ensure as it's not a standard language feature.
288
- { parser: { requireEnsure: false } },
306
+ // Handle node_modules packages that contain sourcemaps
307
+ shouldUseSourceMap && {
308
+ enforce: 'pre',
309
+ exclude: /@babel(?:\/|\\{1,2})runtime/,
310
+ test: /\.(js|mjs|jsx|ts|tsx|css)$/,
311
+ loader: require.resolve('source-map-loader'),
312
+ },
289
313
  {
290
314
  // "oneOf" will traverse all following loaders until one will
291
315
  // match the requirements. When no loader matches it will fall
@@ -296,10 +320,11 @@ module.exports = function (webpackEnv) {
296
320
  // A missing `test` is equivalent to a match.
297
321
  {
298
322
  test: [/\.bmp$/, /\.gif$/, /\.jpe?g$/, /\.png$/],
299
- loader: require.resolve('url-loader'),
300
- options: {
301
- limit: imageInlineSizeLimit,
302
- name: 'static/media/[name].[ext]',
323
+ type: 'asset',
324
+ parser: {
325
+ dataUrlCondition: {
326
+ maxSize: imageInlineSizeLimit,
327
+ },
303
328
  },
304
329
  },
305
330
  // Process application JS with Babel.
@@ -316,8 +341,7 @@ module.exports = function (webpackEnv) {
316
341
  [
317
342
  require.resolve('babel-preset-react-app'),
318
343
  {
319
- runtime: hasJsxRuntime ? 'automatic' : 'classic',
320
- absoluteRuntime: false,
344
+ runtime: modules.hasJsxRuntime ? 'automatic' : 'classic',
321
345
  },
322
346
  ],
323
347
  ],
@@ -342,10 +366,6 @@ module.exports = function (webpackEnv) {
342
366
  ),
343
367
  // @remove-on-eject-end
344
368
  plugins: [
345
- [
346
- require.resolve('babel-plugin-named-asset-import'),
347
- { loaderMap: {} },
348
- ],
349
369
  isEnvDevelopment &&
350
370
  shouldUseReactRefresh &&
351
371
  require.resolve('react-refresh/babel'),
@@ -413,6 +433,9 @@ module.exports = function (webpackEnv) {
413
433
  sourceMap: isEnvProduction
414
434
  ? shouldUseSourceMap
415
435
  : isEnvDevelopment,
436
+ modules: {
437
+ mode: 'icss',
438
+ },
416
439
  }),
417
440
  // Don't consider CSS imports dead code even if the
418
441
  // containing package claims to have no side effects.
@@ -430,6 +453,7 @@ module.exports = function (webpackEnv) {
430
453
  ? shouldUseSourceMap
431
454
  : isEnvDevelopment,
432
455
  modules: {
456
+ mode: 'local',
433
457
  getLocalIdent: getCSSModuleLocalIdent,
434
458
  },
435
459
  }),
@@ -446,6 +470,9 @@ module.exports = function (webpackEnv) {
446
470
  sourceMap: isEnvProduction
447
471
  ? shouldUseSourceMap
448
472
  : isEnvDevelopment,
473
+ modules: {
474
+ mode: 'icss',
475
+ },
449
476
  },
450
477
  'sass-loader'
451
478
  ),
@@ -466,6 +493,7 @@ module.exports = function (webpackEnv) {
466
493
  ? shouldUseSourceMap
467
494
  : isEnvDevelopment,
468
495
  modules: {
496
+ mode: 'local',
469
497
  getLocalIdent: getCSSModuleLocalIdent,
470
498
  },
471
499
  },
@@ -477,35 +505,24 @@ module.exports = function (webpackEnv) {
477
505
  test: /\.txt$/i,
478
506
  use: 'raw-loader',
479
507
  },
480
- // svgr loader is disabled and SVGs are converted to PNG in React Unity
481
- {
482
- test: /\.svg$/i,
483
- loader: 'svg-to-png-loader',
484
- options: {
485
- name: 'static/svg/[name]-[height]x[width].png',
486
- },
487
- },
488
508
  // "file" loader makes sure those assets get served by WebpackDevServer.
489
509
  // When you `import` an asset, you get its (virtual) filename.
490
510
  // In production, they would get copied to the `build` folder.
491
511
  // This loader doesn't use a "test" so it will catch all modules
492
512
  // that fall through the other loaders.
493
513
  {
494
- loader: require.resolve('file-loader'),
495
514
  // Exclude `js` files to keep "css" loader working as it injects
496
515
  // its runtime that would otherwise be processed through "file" loader.
497
- // Also exclude `html` and `json` extensions so they get processed
516
+ // Also exclude `json` extensions so they get processed
498
517
  // by webpacks internal loaders.
499
- exclude: [/\.(js|mjs|jsx|ts|tsx)$/, /\.json$/],
500
- options: {
501
- name: 'static/media/[name].[ext]',
502
- },
518
+ exclude: [/^$/, /\.(js|mjs|jsx|ts|tsx)$/, /\.json$/],
519
+ type: 'asset/resource',
503
520
  },
504
521
  // ** STOP ** Are you adding a new loader?
505
522
  // Make sure to add the new loader(s) before the "file" loader.
506
523
  ],
507
524
  },
508
- ],
525
+ ].filter(Boolean),
509
526
  },
510
527
  plugins: [
511
528
  // This gives some necessary context to module not found errors, such as
@@ -518,31 +535,48 @@ module.exports = function (webpackEnv) {
518
535
  // Otherwise React will be compiled in the very slow development mode.
519
536
  new webpack.DefinePlugin(env.stringified),
520
537
  // Experimental hot reloading for React .
521
- // https://github.com/facebook/react/tree/master/packages/react-refresh
538
+ // https://github.com/facebook/react/tree/main/packages/react-refresh
522
539
  isEnvDevelopment &&
523
540
  shouldUseReactRefresh &&
524
541
  new ReactRefreshWebpackPlugin({
525
- overlay: {
526
- entry: webpackDevClientEntry,
527
- // The expected exports are slightly different from what the overlay exports,
528
- // so an interop is included here to enable feedback on module-level errors.
529
- module: reactRefreshOverlayEntry,
530
- // Since we ship a custom dev client and overlay integration,
531
- // the bundled socket handling logic can be eliminated.
532
- sockIntegration: false,
533
- },
542
+ overlay: false,
534
543
  }),
535
544
  // Watcher doesn't work well if you mistype casing in a path so we use
536
545
  // a plugin that prints an error when you attempt to do this.
537
546
  // See https://github.com/facebook/create-react-app/issues/240
538
547
  isEnvDevelopment && new CaseSensitivePathsPlugin(),
539
- // If you require a missing module and then `npm install` it, you still have
540
- // to restart the development server for webpack to discover it. This plugin
541
- // makes the discovery automatic so you don't have to restart.
542
- // See https://github.com/facebook/create-react-app/issues/186
543
- isEnvDevelopment &&
544
- new WatchMissingNodeModulesPlugin(paths.appNodeModules),
548
+ shouldExtractCss &&
549
+ new MiniCssExtractPlugin({
550
+ // Options similar to the same options in webpackOptions.output
551
+ // both options are optional
552
+ filename: 'static/css/[name].css',
553
+ chunkFilename: 'static/css/[name].chunk.css',
554
+ }),
555
+ // Generate an asset manifest file with the following content:
556
+ // - "files" key: Mapping of all asset filenames to their corresponding
557
+ // output file so that tools can pick it up without having to parse
558
+ // `index.html`
559
+ // - "entrypoints" key: Array of files which are included in `index.html`,
560
+ // can be used to reconstruct the HTML if necessary
561
+ generateManifest &&
562
+ new WebpackManifestPlugin({
563
+ fileName: 'asset-manifest.json',
564
+ publicPath: paths.publicUrlOrPath,
565
+ generate: (seed, files, entrypoints) => {
566
+ const manifestFiles = files.reduce((manifest, file) => {
567
+ manifest[file.name] = file.path;
568
+ return manifest;
569
+ }, seed);
570
+ const entrypointFiles = entrypoints.main.filter(
571
+ fileName => !fileName.endsWith('.map')
572
+ );
545
573
 
574
+ return {
575
+ files: manifestFiles,
576
+ entrypoints: entrypointFiles,
577
+ };
578
+ },
579
+ }),
546
580
  // Moment.js is an extremely popular library that bundles large locale files
547
581
  // by default due to how webpack interprets its code. This is a practical
548
582
  // solution that requires the user to opt into importing specific locales.
@@ -556,79 +590,59 @@ module.exports = function (webpackEnv) {
556
590
  // TypeScript type checking
557
591
  useTypeScript &&
558
592
  new ForkTsCheckerWebpackPlugin({
559
- typescript: resolve.sync('typescript', {
560
- basedir: paths.appNodeModules,
561
- }),
562
593
  async: isEnvDevelopment,
563
- checkSyntacticErrors: true,
564
- resolveModuleNameModule: process.versions.pnp
565
- ? `${__dirname}/pnpTs.js`
566
- : undefined,
567
- resolveTypeReferenceDirectiveModule: process.versions.pnp
568
- ? `${__dirname}/pnpTs.js`
569
- : undefined,
570
- tsconfig: paths.appTsConfig,
571
- reportFiles: [
594
+ typescript: {
595
+ typescriptPath: resolve.sync('typescript', {
596
+ basedir: paths.appNodeModules,
597
+ }),
598
+ configOverwrite: {
599
+ compilerOptions: {
600
+ sourceMap: isEnvProduction
601
+ ? shouldUseSourceMap
602
+ : isEnvDevelopment,
603
+ skipLibCheck: true,
604
+ inlineSourceMap: false,
605
+ declarationMap: false,
606
+ noEmit: true,
607
+ incremental: true,
608
+ tsBuildInfoFile: paths.appTsBuildInfoFile,
609
+ },
610
+ },
611
+ context: paths.appPath,
612
+ diagnosticOptions: {
613
+ syntactic: true,
614
+ },
615
+ mode: 'write-references',
616
+ // profile: true,
617
+ },
618
+ issue: {
572
619
  // This one is specifically to match during CI tests,
573
620
  // as micromatch doesn't match
574
621
  // '../cra-template-typescript/template/src/App.tsx'
575
622
  // otherwise.
576
- '../**/src/**/*.{ts,tsx}',
577
- '**/src/**/*.{ts,tsx}',
578
- '!**/src/**/__tests__/**',
579
- '!**/src/**/?(*.)(spec|test).*',
580
- '!**/src/setupProxy.*',
581
- '!**/src/setupTests.*',
582
- ],
583
- silent: true,
584
- // The formatter is invoked directly in WebpackDevServerUtils during development
585
- formatter: isEnvProduction ? typescriptFormatter : undefined,
623
+ include: [
624
+ { file: '../**/src/**/*.{ts,tsx}' },
625
+ { file: '**/src/**/*.{ts,tsx}' },
626
+ ],
627
+ exclude: [
628
+ { file: '**/src/**/__tests__/**' },
629
+ { file: '**/src/**/?(*.){spec|test}.*' },
630
+ { file: '**/src/setupProxy.*' },
631
+ { file: '**/src/setupTests.*' },
632
+ ],
633
+ },
634
+ logger: {
635
+ infrastructure: 'silent',
636
+ },
586
637
  }),
587
638
  !disableESLintPlugin &&
588
639
  new ESLintPlugin({
589
640
  // Plugin options
590
- extensions: ['js', 'mjs', 'jsx', 'ts', 'tsx'],
591
641
  formatter: require.resolve('react-dev-utils/eslintFormatter'),
592
642
  eslintPath: require.resolve('eslint'),
593
643
  failOnError: !(isEnvDevelopment && emitErrorsAsWarnings),
594
644
  context: paths.appSrc,
595
- cache: true,
596
- cacheLocation: path.resolve(
597
- paths.appNodeModules,
598
- '.cache/.eslintcache'
599
- ),
600
- // ESLint class options
601
- cwd: paths.appPath,
602
- resolvePluginsRelativeTo: __dirname,
603
- baseConfig: {
604
- extends: [require.resolve('eslint-config-react-app')],
605
- rules: {
606
- ...(!hasJsxRuntime && {
607
- 'react/react-in-jsx-scope': 'error',
608
- }),
609
-
610
- // Disable jsx-ally as it is irrelevant for us
611
- // https://github.com/evcohen/eslint-plugin-jsx-a11y/tree/master/docs/rules
612
- 'jsx-a11y/alt-text': 'off',
613
- 'jsx-a11y/anchor-has-content': 'off',
614
- 'jsx-a11y/anchor-is-valid': 'off',
615
- 'jsx-a11y/aria-activedescendant-has-tabindex': 'off',
616
- 'jsx-a11y/aria-props': 'off',
617
- 'jsx-a11y/aria-proptypes': 'off',
618
- 'jsx-a11y/aria-role': 'off',
619
- 'jsx-a11y/aria-unsupported-elements': 'off',
620
- 'jsx-a11y/heading-has-content': 'off',
621
- 'jsx-a11y/iframe-has-title': 'off',
622
- 'jsx-a11y/img-redundant-alt': 'off',
623
- 'jsx-a11y/no-access-key': 'off',
624
- 'jsx-a11y/no-distracting-elements': 'off',
625
- 'jsx-a11y/no-redundant-roles': 'off',
626
- 'jsx-a11y/role-has-required-aria-props': 'off',
627
- 'jsx-a11y/role-supports-aria-props': 'off',
628
- 'jsx-a11y/scope': 'off',
629
- 'no-restricted-globals': ['error'].concat(restrictedGlobals.filter(x => x !== 'location')),
630
- },
631
- },
645
+ ...eslintConfig,
632
646
  }),
633
647
  ].filter(Boolean),
634
648
  // Turn off performance processing because we utilize