Skip to content

Commit 7eee724

Browse files
committed
Remove eslint from build
1 parent 93fb7bd commit 7eee724

File tree

2 files changed

+23
-47
lines changed

2 files changed

+23
-47
lines changed

packages/cra-template/template.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@
55
"@testing-library/jest-dom": "^5.14.1",
66
"@testing-library/react": "^13.0.0",
77
"@testing-library/user-event": "^13.2.1",
8-
"babel-jest": "latest",
9-
"jest": "latest"
8+
"jest": "latest",
9+
"eslint": "latest"
1010
}
1111
}
1212
}

packages/react-scripts/config/webpack.config.js

Lines changed: 21 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -43,12 +43,12 @@ const shouldUseSourceMap = process.env.GENERATE_SOURCEMAP !== 'false';
4343

4444
const reactRefreshRuntimeEntry = require.resolve('react-refresh/runtime');
4545
const reactRefreshWebpackPluginRuntimeEntry = require.resolve(
46-
'@pmmmwh/react-refresh-webpack-plugin'
46+
'@pmmmwh/react-refresh-webpack-plugin',
4747
);
4848
const babelRuntimeEntry = require.resolve('babel-preset-react-app');
4949
const babelRuntimeEntryHelpers = require.resolve(
5050
'@babel/runtime/helpers/esm/assertThisInitialized',
51-
{ paths: [babelRuntimeEntry] }
51+
{ paths: [babelRuntimeEntry] },
5252
);
5353
const babelRuntimeRegenerator = require.resolve('@babel/runtime/regenerator', {
5454
paths: [babelRuntimeEntry],
@@ -62,15 +62,15 @@ const emitErrorsAsWarnings = process.env.ESLINT_NO_DEV_ERRORS === 'true';
6262
const disableESLintPlugin = process.env.DISABLE_ESLINT_PLUGIN === 'true';
6363

6464
const imageInlineSizeLimit = parseInt(
65-
process.env.IMAGE_INLINE_SIZE_LIMIT || '10000'
65+
process.env.IMAGE_INLINE_SIZE_LIMIT || '10000',
6666
);
6767

6868
// Check if TypeScript is setup
6969
const useTypeScript = fs.existsSync(paths.appTsConfig);
7070

7171
// Check if Tailwind config exists
7272
const useTailwind = fs.existsSync(
73-
path.join(paths.appPath, 'tailwind.config.js')
73+
path.join(paths.appPath, 'tailwind.config.js'),
7474
);
7575

7676
// Get the path to the uncompiled service worker (if it exists).
@@ -190,7 +190,7 @@ module.exports = function (webpackEnv) {
190190
options: {
191191
sourceMap: true,
192192
},
193-
}
193+
},
194194
);
195195
}
196196
return loaders;
@@ -232,12 +232,13 @@ module.exports = function (webpackEnv) {
232232
publicPath: paths.publicUrlOrPath,
233233
// Point sourcemap entries to original disk location (format as URL on Windows)
234234
devtoolModuleFilenameTemplate: isEnvProduction
235-
? info =>
235+
? (info) =>
236236
path
237237
.relative(paths.appSrc, info.absoluteResourcePath)
238238
.replace(/\\/g, '/')
239239
: isEnvDevelopment &&
240-
(info => path.resolve(info.absoluteResourcePath).replace(/\\/g, '/')),
240+
((info) =>
241+
path.resolve(info.absoluteResourcePath).replace(/\\/g, '/')),
241242
},
242243
cache: {
243244
type: 'filesystem',
@@ -247,8 +248,8 @@ module.exports = function (webpackEnv) {
247248
buildDependencies: {
248249
defaultWebpack: ['webpack/lib/'],
249250
config: [__filename],
250-
tsconfig: [paths.appTsConfig, paths.appJsConfig].filter(f =>
251-
fs.existsSync(f)
251+
tsconfig: [paths.appTsConfig, paths.appJsConfig].filter((f) =>
252+
fs.existsSync(f),
252253
),
253254
},
254255
},
@@ -308,7 +309,7 @@ module.exports = function (webpackEnv) {
308309
// if there are any conflicts. This matches Node resolution mechanism.
309310
// https://github.com/facebook/create-react-app/issues/253
310311
modules: ['node_modules', paths.appNodeModules].concat(
311-
modules.additionalModulePaths || []
312+
modules.additionalModulePaths || [],
312313
),
313314
// These are the reasonable defaults supported by the Node ecosystem.
314315
// We also include JSX as a common component filename extension to support
@@ -317,8 +318,8 @@ module.exports = function (webpackEnv) {
317318
// `web` extension prefixes have been added for better support
318319
// for React Native Web.
319320
extensions: paths.moduleFileExtensions
320-
.map(ext => `.${ext}`)
321-
.filter(ext => useTypeScript || !ext.includes('ts')),
321+
.map((ext) => `.${ext}`)
322+
.filter((ext) => useTypeScript || !ext.includes('ts')),
322323
alias: {
323324
// Support React Native Web
324325
// https://www.smashingmagazine.com/2016/08/a-glimpse-into-the-future-with-react-native-for-web/
@@ -419,7 +420,7 @@ module.exports = function (webpackEnv) {
419420
loader: require.resolve('babel-loader'),
420421
options: {
421422
customize: require.resolve(
422-
'babel-preset-react-app/webpack-overrides'
423+
'babel-preset-react-app/webpack-overrides',
423424
),
424425
presets: [
425426
[
@@ -446,7 +447,7 @@ module.exports = function (webpackEnv) {
446447
'babel-preset-react-app',
447448
'react-dev-utils',
448449
'react-scripts',
449-
]
450+
],
450451
),
451452
// @remove-on-eject-end
452453
plugins: [
@@ -492,7 +493,7 @@ module.exports = function (webpackEnv) {
492493
'babel-preset-react-app',
493494
'react-dev-utils',
494495
'react-scripts',
495-
]
496+
],
496497
),
497498
// @remove-on-eject-end
498499
// Babel sourcemaps are needed for debugging into node_modules
@@ -558,7 +559,7 @@ module.exports = function (webpackEnv) {
558559
mode: 'icss',
559560
},
560561
},
561-
'sass-loader'
562+
'sass-loader',
562563
),
563564
// Don't consider CSS imports dead code even if the
564565
// containing package claims to have no side effects.
@@ -581,7 +582,7 @@ module.exports = function (webpackEnv) {
581582
getLocalIdent: getCSSModuleLocalIdent,
582583
},
583584
},
584-
'sass-loader'
585+
'sass-loader',
585586
),
586587
},
587588
// "file" loader makes sure those assets get served by WebpackDevServer.
@@ -627,8 +628,8 @@ module.exports = function (webpackEnv) {
627628
minifyURLs: true,
628629
},
629630
}
630-
: undefined
631-
)
631+
: undefined,
632+
),
632633
),
633634
// Inlines the webpack runtime script. This script is too small to warrant
634635
// a network request.
@@ -684,7 +685,7 @@ module.exports = function (webpackEnv) {
684685
return manifest;
685686
}, seed);
686687
const entrypointFiles = entrypoints.main.filter(
687-
fileName => !fileName.endsWith('.map')
688+
(fileName) => !fileName.endsWith('.map'),
688689
);
689690

690691
return {
@@ -763,31 +764,6 @@ module.exports = function (webpackEnv) {
763764
infrastructure: 'silent',
764765
},
765766
}),
766-
!disableESLintPlugin &&
767-
new ESLintPlugin({
768-
// Plugin options
769-
extensions: ['js', 'mjs', 'jsx', 'ts', 'tsx'],
770-
formatter: require.resolve('react-dev-utils/eslintFormatter'),
771-
eslintPath: require.resolve('eslint'),
772-
failOnError: !(isEnvDevelopment && emitErrorsAsWarnings),
773-
context: paths.appSrc,
774-
cache: true,
775-
cacheLocation: path.resolve(
776-
paths.appNodeModules,
777-
'.cache/.eslintcache'
778-
),
779-
// ESLint class options
780-
cwd: paths.appPath,
781-
resolvePluginsRelativeTo: __dirname,
782-
baseConfig: {
783-
extends: [require.resolve('eslint-config-react-app/base')],
784-
rules: {
785-
...(!hasJsxRuntime && {
786-
'react/react-in-jsx-scope': 'error',
787-
}),
788-
},
789-
},
790-
}),
791767
].filter(Boolean),
792768
// Turn off performance processing because we utilize
793769
// our own hints via the FileSizeReporter

0 commit comments

Comments
 (0)