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

Nx lint is failing on a newly created Angular Monorepo workspace #28407

Closed
2 of 4 tasks
cvandradg opened this issue Oct 11, 2024 · 2 comments
Closed
2 of 4 tasks

Nx lint is failing on a newly created Angular Monorepo workspace #28407

cvandradg opened this issue Oct 11, 2024 · 2 comments
Assignees
Labels
outdated scope: linter Issues related to Eslint support in Nx type: bug

Comments

@cvandradg
Copy link

cvandradg commented Oct 11, 2024

Current Behavior

Can't run npx nx lint on a newly created nx Angular Monorepo workspace

$ npx nx lint testapp

nx run testapp:lint

Linting "testapp"...
NX Cannot read properties of undefined (reading 'at')
Occurred while linting C:\Users\Clau\Desktop\active-work\testworkspace\apps\testapp\src\app\app.component.html:1
Rule: "@typescript-eslint/ban-ts-comment"
Pass --verbose to see the stacktrace.

Expected Behavior

Expected to run successfully on a newly created nx Angular Monorepo workspace

$ npx nx lint testapp

nx run testapp:lint

Linting "testapp"...
✔ All files pass linting

GitHub Repo

https://github.com/cvandradg/testnxissue

Steps to Reproduce

  1. Create a new Nx monorepo angular workspace
  2. run npx nx lint

Nx Report

npx nx lint testapp --verbose

nx run testapp:lint

Linting "testapp"...
NX Cannot read properties of undefined (reading 'at')
Occurred while linting C:\Users\Clau\Desktop\active-work\testnxissue\apps\testapp\src\app\app.component.html:1
Rule: "@typescript-eslint/ban-ts-comment"
TypeError: Cannot read properties of undefined (reading 'at')
Occurred while linting C:\Users\Clau\Desktop\active-work\testnxissue\apps\testapp\src\app\app.component.html:1
Rule: "@typescript-eslint/ban-ts-comment"
at Program (C:\Users\Clau\Desktop\active-work\testnxissue\node_modules@typescript-eslint\eslint-plugin\dist\rules\ban-ts-comment.js:118:50)
at ruleErrorHandler (C:\Users\Clau\Desktop\active-work\testnxissue\node_modules\eslint\lib\linter\linter.js:1084:48)
at C:\Users\Clau\Desktop\active-work\testnxissue\node_modules\eslint\lib\linter\safe-emitter.js:45:58
at Array.forEach ()
at Object.emit (C:\Users\Clau\Desktop\active-work\testnxissue\node_modules\eslint\lib\linter\safe-emitter.js:45:38)
at NodeEventGenerator.applySelector (C:\Users\Clau\Desktop\active-work\testnxissue\node_modules\eslint\lib\linter\node-event-generator.js:297:26)
at NodeEventGenerator.applySelectors (C:\Users\Clau\Desktop\active-work\testnxissue\node_modules\eslint\lib\linter\node-event-generator.js:326:22)
at NodeEventGenerator.enterNode (C:\Users\Clau\Desktop\active-work\testnxissue\node_modules\eslint\lib\linter\node-event-generator.js:337:14)
at runRules (C:\Users\Clau\Desktop\active-work\testnxissue\node_modules\eslint\lib\linter\linter.js:1128:40)
at #flatVerifyWithoutProcessors (C:\Users\Clau\Desktop\active-work\testnxissue\node_modules\eslint\lib\linter\linter.js:1914:31)

NX Running target lint for project testapp failed

Failed tasks:

  • testapp:lint

Hint: run the command with --verbose for more details.

Failure Logs

No response

Package Manager Version

npm 10.9.0

Operating System

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

Additional Information

Image

possible solution:

node_modules@typescript-eslint\eslint-plugin\dist\rules\ban-ts-comment.js
line 118: const firstStatement = node.body?.at(0);

that might do the trick, not sure if it's a viable solution.
Not sure if this should be reported here or in https://github.com/typescript-eslint/typescript-eslint/issues

@cvandradg cvandradg changed the title Nx lint is failing on a newly created Angular workspace Nx lint is failing on a newly created Angular Monorepo workspace Oct 11, 2024
@jaysoo jaysoo added the scope: linter Issues related to Eslint support in Nx label Oct 14, 2024
@leosvelperez
Copy link
Member

This was fixed by #28381 and the fix will be released soon.

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 Nov 14, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
outdated scope: linter Issues related to Eslint support in Nx type: bug
Projects
None yet
Development

No branches or pull requests

3 participants