I tried migrating from nx 9.4.3 to 10.0.6 but the Migrate .eslintrc files to reference new tsconfig migration fails because it also tries to run the migration for a folder aws-cdk that is in the root folder of the repo.
The nx migrations look at the .gitignore file to see which folders need to be excluded. Because this folder, the aws-cdk folder, is not (and can not be) excluded in .gitignore, the migrations also run in this folder.
All migrations from migrations.json should run through without erroring.
This is just a basic and easy migration, it just fails because we have an external package in the root folder of the repository. In this case a custom version of the aws-cdk npm package.
It can actually be fixed by manually adding the aws-cdk folder to the .gitignore file before the migration and removing it after the migration. A better solution would maybe be to have something like an extra.nx-ignore file that will be used in these cases.
Running migration @nrwl/workspace:migrate-eslintrc-tsconfig
/Users/elmarbeckmann/Sites/nts-apps/node_modules/rxjs/internal/util/hostReportError.js:4
setTimeout(function () { throw err; }, 0);
^
Error: Cannot parse aws-cdk/node_modules/aws-cdk/node_modules/extend/.eslintrc: Unexpected token } in JSON at position 393
at readJsonInTree (/Users/elmarbeckmann/Sites/nts-apps/node_modules/@nrwl/workspace/src/utils/ast-utils.js:299:15)
at /Users/elmarbeckmann/Sites/nts-apps/node_modules/@nrwl/workspace/src/utils/ast-utils.js:360:65
at MergeMapSubscriber.project (/Users/elmarbeckmann/Sites/nts-apps/node_modules/@nrwl/workspace/node_modules/@angular-devkit/schematics/src/rules/call.js:75:24)
at MergeMapSubscriber._tryNext (/Users/elmarbeckmann/Sites/nts-apps/node_modules/rxjs/internal/operators/mergeMap.js:69:27)
at MergeMapSubscriber._next (/Users/elmarbeckmann/Sites/nts-apps/node_modules/rxjs/internal/operators/mergeMap.js:59:18)
at MergeMapSubscriber.Subscriber.next (/Users/elmarbeckmann/Sites/nts-apps/node_modules/rxjs/internal/Subscriber.js:66:18)
at Observable._subscribe (/Users/elmarbeckmann/Sites/nts-apps/node_modules/rxjs/internal/util/subscribeToArray.js:5:20)
at Observable._trySubscribe (/Users/elmarbeckmann/Sites/nts-apps/node_modules/rxjs/internal/Observable.js:44:25)
at Observable.subscribe (/Users/elmarbeckmann/Sites/nts-apps/node_modules/rxjs/internal/Observable.js:30:22)
at MergeMapOperator.call (/Users/elmarbeckmann/Sites/nts-apps/node_modules/rxjs/internal/operators/mergeMap.js:39:23)
/Users/elmarbeckmann/Sites/nts-apps/node_modules/yargs/yargs.js:1109
else throw err
^
Error: Command failed: ./node_modules/.bin/tao migrate --run-migrations=migrations.json
at checkExecSyncError (child_process.js:611:11)
at Object.execSync (child_process.js:647:15)
at Object.handler (/Users/elmarbeckmann/Sites/nts-apps/node_modules/@nrwl/workspace/src/command-line/nx-commands.js:77:21)
at Object.runCommand (/Users/elmarbeckmann/Sites/nts-apps/node_modules/yargs/lib/command.js:235:44)
at Object.parseArgs [as _parseArgs] (/Users/elmarbeckmann/Sites/nts-apps/node_modules/yargs/yargs.js:1022:30)
at Object.get [as argv] (/Users/elmarbeckmann/Sites/nts-apps/node_modules/yargs/yargs.js:965:21)
at Object.initLocal (/Users/elmarbeckmann/Sites/nts-apps/node_modules/@nrwl/cli/lib/init-local.js:20:79)
at Object.<anonymous> (/Users/elmarbeckmann/Sites/nts-apps/node_modules/@nrwl/cli/bin/nx.js:12:18)
at Module._compile (internal/modules/cjs/loader.js:1151:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:1171:10) {
status: 1,
signal: null,
output: [ null, null, null ],
pid: 26837,
stdout: null,
stderr: null
}
@nrwl/angular : 10.0.6
@nrwl/cli : 9.1.2
@nrwl/cypress : 10.0.6
@nrwl/eslint-plugin-nx : Not Found
@nrwl/express : Not Found
@nrwl/jest : 10.0.6
@nrwl/linter : Not Found
@nrwl/nest : Not Found
@nrwl/next : Not Found
@nrwl/node : Not Found
@nrwl/react : Not Found
@nrwl/schematics : Not Found
@nrwl/tao : 9.1.2
@nrwl/web : Not Found
@nrwl/workspace : 10.0.6
typescript : 3.9.7
For me it was my firebase cloud functions /functions folder
Error: Cannot parse functions/node_modules/extend/.eslintrc: Unexpected token } in JSON at position 393
at readJsonInTree (C:\Users\Mark\Documents\IdeaCrew\active-branch-tracker\node_modules\@nrwl\workspace\src\utils\ast-utils.js:299:15)
at C:\Users\Mark\Documents\IdeaCrew\active-branch-tracker\node_modules\@nrwl\workspace\src\utils\ast-utils.js:360:65
at MergeMapSubscriber.project (C:\Users\Mark\Documents\IdeaCrew\active-branch-tracker\node_modules\@angular-devkit\schematics\src\rules\call.js:75:24)
at MergeMapSubscriber._tryNext (C:\Users\Mark\Documents\IdeaCrew\active-branch-tracker\node_modules\rxjs\internal\operators\mergeMap.js:69:27)
at MergeMapSubscriber._next (C:\Users\Mark\Documents\IdeaCrew\active-branch-tracker\node_modules\rxjs\internal\operators\mergeMap.js:59:18)
at MergeMapSubscriber.Subscriber.next (C:\Users\Mark\Documents\IdeaCrew\active-branch-tracker\node_modules\rxjs\internal\Subscriber.js:66:18)
at Observable._subscribe (C:\Users\Mark\Documents\IdeaCrew\active-branch-tracker\node_modules\rxjs\internal\util\subscribeToArray.js:5:20)
at Observable._trySubscribe (C:\Users\Mark\Documents\IdeaCrew\active-branch-tracker\node_modules\rxjs\internal\Observable.js:44:25)
at Observable.subscribe (C:\Users\Mark\Documents\IdeaCrew\active-branch-tracker\node_modules\rxjs\internal\Observable.js:30:22)
at MergeMapOperator.call (C:\Users\Mark\Documents\IdeaCrew\active-branch-tracker\node_modules\rxjs\internal\operators\mergeMap.js:39:23)
at Observable.subscribe (C:\Users\Mark\Documents\IdeaCrew\active-branch-tracker\node_modules\rxjs\internal\Observable.js:25:31)
at C:\Users\Mark\Documents\IdeaCrew\active-branch-tracker\node_modules\@nrwl\workspace\src\utils\rules\visit-not-ignored-files.js:25:69
at Array.forEach (<anonymous>)
at visit (C:\Users\Mark\Documents\IdeaCrew\active-branch-tracker\node_modules\@nrwl\workspace\src\utils\rules\visit-not-ignored-files.js:19:31)
at C:\Users\Mark\Documents\IdeaCrew\active-branch-tracker\node_modules\@nrwl\workspace\src\utils\rules\visit-not-ignored-files.js:29:17
at Array.forEach (<anonymous>)
It looks like this is because there is an additional node_modules folder in these extra root folders and they're not being ignored and there's a syntax error in the .eslintrc .
Workaround: delete the node_modules folder in the subdirectory that's causing the migration to error. Then, after migration has finished, run npm i in that subdirectory
Would temporarily adding it to .gitignore during migrations be a good workaround? I can change the code to WARN instead of ERROR.
For anyone coming to this issue, please consider submitting PRs to the repos with invalid .eslintrc files that fix these files. Typically, there are trailing commas where there shouldn't be.