Skip to content

Commit 14b8c9f

Browse files
committed
Remove ESLint config from package.json
1 parent d272e56 commit 14b8c9f

File tree

1 file changed

+41
-39
lines changed
  • packages/react-scripts/scripts

1 file changed

+41
-39
lines changed

packages/react-scripts/scripts/init.js

Lines changed: 41 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
// Makes the script crash on unhandled rejections instead of silently
1111
// ignoring them. In the future, promise rejections that are not handled will
1212
// terminate the Node.js process with a non-zero exit code.
13-
process.on('unhandledRejection', err => {
13+
process.on('unhandledRejection', (err) => {
1414
throw err;
1515
});
1616

@@ -86,7 +86,7 @@ module.exports = function (
8686
appName,
8787
verbose,
8888
originalDirectory,
89-
templateName
89+
templateName,
9090
) {
9191
const appPackage = require(path.join(appPath, 'package.json'));
9292
const useYarn = fs.existsSync(path.join(appPath, 'yarn.lock'));
@@ -95,26 +95,26 @@ module.exports = function (
9595
console.log('');
9696
console.error(
9797
`A template was not provided. This is likely because you're using an outdated version of ${chalk.cyan(
98-
'create-react-app'
99-
)}.`
98+
'create-react-app',
99+
)}.`,
100100
);
101101
console.error(
102102
`Please note that global installs of ${chalk.cyan(
103-
'create-react-app'
104-
)} are no longer supported.`
103+
'create-react-app',
104+
)} are no longer supported.`,
105105
);
106106
console.error(
107107
`You can fix this by running ${chalk.cyan(
108-
'npm uninstall -g create-react-app'
108+
'npm uninstall -g create-react-app',
109109
)} or ${chalk.cyan(
110-
'yarn global remove create-react-app'
111-
)} before using ${chalk.cyan('create-react-app')} again.`
110+
'yarn global remove create-react-app',
111+
)} before using ${chalk.cyan('create-react-app')} again.`,
112112
);
113113
return;
114114
}
115115

116116
const templatePath = path.dirname(
117-
require.resolve(`${templateName}/package.json`, { paths: [appPath] })
117+
require.resolve(`${templateName}/package.json`, { paths: [appPath] }),
118118
);
119119

120120
const templateJsonPath = path.join(templatePath, 'template.json');
@@ -132,8 +132,8 @@ module.exports = function (
132132
console.log(
133133
chalk.red(
134134
'Root-level `dependencies` and `scripts` keys in `template.json` were deprecated for Create React App 5.\n' +
135-
'This template needs to be updated to use the new `package` key.'
136-
)
135+
'This template needs to be updated to use the new `package` key.',
136+
),
137137
);
138138
console.log('For more information, visit https://cra.link/templates');
139139
}
@@ -170,12 +170,14 @@ module.exports = function (
170170

171171
// Keys from templatePackage that will be added to appPackage,
172172
// replacing any existing entries.
173-
const templatePackageToReplace = Object.keys(templatePackage).filter(key => {
174-
return (
175-
!templatePackageBlacklist.includes(key) &&
176-
!templatePackageToMerge.includes(key)
177-
);
178-
});
173+
const templatePackageToReplace = Object.keys(templatePackage).filter(
174+
(key) => {
175+
return (
176+
!templatePackageBlacklist.includes(key) &&
177+
!templatePackageToMerge.includes(key)
178+
);
179+
},
180+
);
179181

180182
// Copy over some of the devDependencies
181183
appPackage.dependencies = appPackage.dependencies || {};
@@ -189,7 +191,7 @@ module.exports = function (
189191
test: 'react-scripts test',
190192
eject: 'react-scripts eject',
191193
},
192-
templateScripts
194+
templateScripts,
193195
);
194196

195197
// Update scripts for Yarn users
@@ -199,33 +201,33 @@ module.exports = function (
199201
...acc,
200202
[key]: value.replace(/(npm run |npm )/, 'yarn '),
201203
}),
202-
{}
204+
{},
203205
);
204206
}
205207

206-
// Setup the eslint config
207-
appPackage.eslintConfig = {
208-
extends: 'react-app',
209-
};
208+
// // Setup the eslint config
209+
// appPackage.eslintConfig = {
210+
// extends: 'react-app',
211+
// };
210212

211213
// Setup the browsers list
212214
appPackage.browserslist = defaultBrowsers;
213215

214216
// Add templatePackage keys/values to appPackage, replacing existing entries
215-
templatePackageToReplace.forEach(key => {
217+
templatePackageToReplace.forEach((key) => {
216218
appPackage[key] = templatePackage[key];
217219
});
218220

219221
fs.writeFileSync(
220222
path.join(appPath, 'package.json'),
221-
JSON.stringify(appPackage, null, 2) + os.EOL
223+
JSON.stringify(appPackage, null, 2) + os.EOL,
222224
);
223225

224226
const readmeExists = fs.existsSync(path.join(appPath, 'README.md'));
225227
if (readmeExists) {
226228
fs.renameSync(
227229
path.join(appPath, 'README.md'),
228-
path.join(appPath, 'README.old.md')
230+
path.join(appPath, 'README.old.md'),
229231
);
230232
}
231233

@@ -235,7 +237,7 @@ module.exports = function (
235237
fs.copySync(templateDir, appPath);
236238
} else {
237239
console.error(
238-
`Could not locate supplied template: ${chalk.green(templateDir)}`
240+
`Could not locate supplied template: ${chalk.green(templateDir)}`,
239241
);
240242
return;
241243
}
@@ -247,7 +249,7 @@ module.exports = function (
247249
fs.writeFileSync(
248250
path.join(appPath, 'README.md'),
249251
readme.replace(/(npm run |npm )/g, 'yarn '),
250-
'utf8'
252+
'utf8',
251253
);
252254
} catch (err) {
253255
// Silencing the error. As it fall backs to using default npm commands.
@@ -266,7 +268,7 @@ module.exports = function (
266268
fs.moveSync(
267269
path.join(appPath, 'gitignore'),
268270
path.join(appPath, '.gitignore'),
269-
[]
271+
[],
270272
);
271273
}
272274

@@ -295,7 +297,7 @@ module.exports = function (
295297
// '--no-audit', // https://github.com/facebook/create-react-app/issues/11174
296298
'--save',
297299
verbose && '--verbose',
298-
].filter(e => e);
300+
].filter((e) => e);
299301
}
300302

301303
// Install additional template dependencies, if present.
@@ -307,7 +309,7 @@ module.exports = function (
307309
args = args.concat(
308310
dependenciesToInstall.map(([dependency, version]) => {
309311
return `${dependency}@${version}`;
310-
})
312+
}),
311313
);
312314
}
313315

@@ -329,7 +331,7 @@ module.exports = function (
329331
}
330332
}
331333

332-
if (args.find(arg => arg.includes('typescript'))) {
334+
if (args.find((arg) => arg.includes('typescript'))) {
333335
console.log();
334336
verifyTypeScriptSetup();
335337
}
@@ -373,21 +375,21 @@ module.exports = function (
373375
console.log(' Starts the development server.');
374376
console.log();
375377
console.log(
376-
chalk.cyan(` ${displayedCommand} ${useYarn ? '' : 'run '}build`)
378+
chalk.cyan(` ${displayedCommand} ${useYarn ? '' : 'run '}build`),
377379
);
378380
console.log(' Bundles the app into static files for production.');
379381
console.log();
380382
console.log(chalk.cyan(` ${displayedCommand} test`));
381383
console.log(' Starts the test runner.');
382384
console.log();
383385
console.log(
384-
chalk.cyan(` ${displayedCommand} ${useYarn ? '' : 'run '}eject`)
386+
chalk.cyan(` ${displayedCommand} ${useYarn ? '' : 'run '}eject`),
385387
);
386388
console.log(
387-
' Removes this tool and copies build dependencies, configuration files'
389+
' Removes this tool and copies build dependencies, configuration files',
388390
);
389391
console.log(
390-
' and scripts into the app directory. If you do this, you can’t go back!'
392+
' and scripts into the app directory. If you do this, you can’t go back!',
391393
);
392394
console.log();
393395
console.log('We suggest that you begin by typing:');
@@ -398,8 +400,8 @@ module.exports = function (
398400
console.log();
399401
console.log(
400402
chalk.yellow(
401-
'You had a `README.md` file, we renamed it to `README.old.md`'
402-
)
403+
'You had a `README.md` file, we renamed it to `README.old.md`',
404+
),
403405
);
404406
}
405407
console.log();

0 commit comments

Comments
 (0)