@next/codemod 16.4.0-canary.43 → 16.4.0-canary.45
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.
package/bin/upgrade.js
CHANGED
|
@@ -314,7 +314,13 @@ async function runUpgrade(revision, options) {
|
|
|
314
314
|
: JSON.parse(eslintConfigNextPeerDepsJSON);
|
|
315
315
|
const eslintRange = eslintConfigNextPeerDeps?.eslint;
|
|
316
316
|
if (eslintRange) {
|
|
317
|
-
|
|
317
|
+
// TODO: Target ESLint 10 once eslint-config-next's plugins, especially
|
|
318
|
+
// eslint-plugin-react, support its API removals (e.g. context.getFilename).
|
|
319
|
+
const cappedRange = eslintRange
|
|
320
|
+
.split('||')
|
|
321
|
+
.map((range) => `${range.trim()} <10`)
|
|
322
|
+
.join(' || ');
|
|
323
|
+
const targetEslintVersion = await loadHighestNPMVersionMatching(`eslint@${cappedRange}`);
|
|
318
324
|
versionMapping['eslint'] = {
|
|
319
325
|
version: targetEslintVersion,
|
|
320
326
|
required: false,
|
package/package.json
CHANGED
|
@@ -836,6 +836,13 @@ function transformer(files, options = {}) {
|
|
|
836
836
|
console.error('Error: package.json not found in the specified directory');
|
|
837
837
|
return;
|
|
838
838
|
}
|
|
839
|
+
const packageJsonContent = (0, node_fs_1.readFileSync)(packageJsonPath, 'utf8');
|
|
840
|
+
const packageJson = JSON.parse(packageJsonContent);
|
|
841
|
+
const usesNextLint = Object.values(packageJson.scripts || {}).some((script) => typeof script === 'string' && script.includes('next lint'));
|
|
842
|
+
if (!usesNextLint) {
|
|
843
|
+
console.log('Skipping migration: no next lint script found in package.json.');
|
|
844
|
+
return;
|
|
845
|
+
}
|
|
839
846
|
const isTypeScript = detectTypeScript(projectRoot);
|
|
840
847
|
console.log('Migrating from next lint to the ESLint CLI...');
|
|
841
848
|
// Check for existing ESLint config
|
|
@@ -897,7 +904,6 @@ function transformer(files, options = {}) {
|
|
|
897
904
|
console.log(' Please manually ensure your ESLint config includes the Next.js configurations');
|
|
898
905
|
}
|
|
899
906
|
}
|
|
900
|
-
const packageJsonContent = (0, node_fs_1.readFileSync)(packageJsonPath, 'utf8');
|
|
901
907
|
const result = updatePackageJsonScripts(packageJsonContent);
|
|
902
908
|
if (result.updated) {
|
|
903
909
|
try {
|