Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Migration "update-17-2-7" fails if a project does not have .eslintrc.json #20920

Closed
1 of 4 tasks
paustint opened this issue Dec 25, 2023 · 3 comments · Fixed by #20932
Closed
1 of 4 tasks

Migration "update-17-2-7" fails if a project does not have .eslintrc.json #20920

paustint opened this issue Dec 25, 2023 · 3 comments · Fixed by #20932
Labels
outdated scope: nextjs Issues related to NextJS support for Nx type: bug

Comments

@paustint
Copy link

paustint commented Dec 25, 2023

Current Behavior

I have a project that does not have an eslint file in it and the migration did not account for the file not existing

Error: Cannot find apps/docs/.eslintrc.json
    at readJson (/Users/foo/dev/node/foo/node_modules/nx/src/generators/utils/json.js:14:15)
    at updateJson (/Users/foo/dev/node/foo/node_modules/nx/src/generators/utils/json.js:45:34)
    at updateOverrideInLintConfig (/Users/foo/dev/node/foo/node_modules/@nx/eslint/src/generators/utils/eslint-file.js:142:33)
    at /Users/foo/dev/node/foo/node_modules/@nx/next/src/migrations/update-17-2-7/remove-eslint-rules-patch.js:8:54
    at Map.forEach (<anonymous>)
    at update (/Users/foo/dev/node/foo/node_modules/@nx/next/src/migrations/update-17-2-7/remove-eslint-rules-patch.js:7:14)
    at runNxMigration (/Users/foo/dev/node/foo/node_modules/nx/src/command-line/migrate/migrate.js:1017:11)
    at executeMigrations (/Users/foo/dev/node/foo/node_modules/nx/src/command-line/migrate/migrate.js:880:39)
    at async runMigrations (/Users/foo/dev/node/foo/node_modules/nx/src/command-line/migrate/migrate.js:965:37)
    at async /Users/foo/dev/node/foo/node_modules/nx/src/command-line/migrate/migrate.js:1034:13
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
Command failed: yarn nx _migrate --run-migrations --verbose
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.

Expected Behavior

The migration should not fail if eslint file does not exist in a given application, instead it should skip the application/library and move on.

GitHub Repo

https://github.com/jetstreamapp/jetstream/tree/v3.7.0

Steps to Reproduce

  1. On provided repository, upgrade nx npx nx migrate latest
  2. Run yarn
  3. Run npx nx migrate --run-migrations

Nx Report

>  NX   Report complete - copy this into the issue template

   Node   : 18.16.0
   OS     : darwin-arm64
   yarn   : 1.22.19
   
   nx                 : 17.2.7
   @nx/js             : 17.2.7
   @nx/jest           : 17.2.7
   @nx/linter         : 17.2.7
   @nx/eslint         : 17.2.7
   @nx/workspace      : 17.2.7
   @nx/cypress        : 17.2.7
   @nx/devkit         : 17.2.7
   @nx/eslint-plugin  : 17.2.7
   @nx/express        : 17.2.7
   @nx/next           : 17.2.7
   @nx/node           : 17.2.7
   @nx/plugin         : 17.2.7
   @nx/react          : 17.2.7
   @nx/storybook      : 17.2.7
   @nrwl/tao          : 17.2.7
   @nx/vite           : 17.2.7
   @nx/web            : 17.2.7
   @nx/webpack        : 17.2.7
   typescript         : 5.2.2
   ---------------------------------------
   Community plugins:
   @mands/nx-playwright : 0.6.2
   nx-electron          : 15.0.0
   ---------------------------------------
   Local workspace plugins:
         @jetstream/workspace-plugin

Failure Logs

>  NX   Running migrations from 'migrations.json'


 >  NX   Failed to run update-17-2-7 from @nx/next. This workspace is NOT up to date!


 >  NX   Cannot find apps/docs/.eslintrc.json


Error: Cannot find apps/docs/.eslintrc.json
    at readJson (/Users/foo/dev/node/foo/node_modules/nx/src/generators/utils/json.js:14:15)
    at updateJson (/Users/foo/dev/node/foo/node_modules/nx/src/generators/utils/json.js:45:34)
    at updateOverrideInLintConfig (/Users/foo/dev/node/foo/node_modules/@nx/eslint/src/generators/utils/eslint-file.js:142:33)
    at /Users/foo/dev/node/foo/node_modules/@nx/next/src/migrations/update-17-2-7/remove-eslint-rules-patch.js:8:54
    at Map.forEach (<anonymous>)
    at update (/Users/foo/dev/node/foo/node_modules/@nx/next/src/migrations/update-17-2-7/remove-eslint-rules-patch.js:7:14)
    at runNxMigration (/Users/foo/dev/node/foo/node_modules/nx/src/command-line/migrate/migrate.js:1017:11)
    at executeMigrations (/Users/foo/dev/node/foo/node_modules/nx/src/command-line/migrate/migrate.js:880:39)
    at async runMigrations (/Users/foo/dev/node/foo/node_modules/nx/src/command-line/migrate/migrate.js:965:37)
    at async /Users/foo/dev/node/foo/node_modules/nx/src/command-line/migrate/migrate.js:1034:13
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
Command failed: yarn nx _migrate --run-migrations --verbose
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.

Package Manager Version

yarn 1.22.19

Operating System

  • macOS
  • Linux
  • Windows
  • Other (Please specify)

Additional Information

The migration was developed in this PR: #20863

@cyrus-za
Copy link

Also running into this, but we DO have a eslint file. We using .eslintrc.js though and not .eslintrc.json

Not sure if that's the reason

@jaysoo jaysoo added the scope: nextjs Issues related to NextJS support for Nx label Dec 27, 2023
@jaysoo
Copy link
Member

jaysoo commented Dec 27, 2023

We'll patch this, in the meantime you can remove the migration from migrations.json as it does not seem applicable.

Copy link

This issue has been closed for more than 30 days. If this issue is still occuring, please open a new issue with more recent context.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Jan 27, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
outdated scope: nextjs Issues related to NextJS support for Nx type: bug
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants