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

fix(linter): fix runtime error caused by incorrect chalk import #20223

Closed
wants to merge 1 commit into from

Conversation

mattlewis92
Copy link
Contributor

Current Behavior

When the project graph is not available in CI an error is thrown:

TypeError: Error while loading rule '@nx/enforce-module-boundaries': Cannot read properties of undefined (reading 'keyword')
Occurred while linting /home/runner/work/clickup_frontend/clickup_frontend/libs/rich-editor/content-assistant/src/lib/generate-by-prompt-template/generate-by-prompt-template-state.ts
    at ensureGlobalProjectGraph (/home/runner/work/clickup_frontend/clickup_frontend/node_modules/.pnpm/@nx+eslint-plugin@17.1.1_@types+node@18.11.9_@typescript-eslint+parser@6.10.0_eslint-config-p_3dqjsp2nk5zwpqpottk4p3quji/node_modules/@nx/eslint-plugin/src/utils/project-graph-utils.js:35:51)
    at readProjectGraph (/home/runner/work/clickup_frontend/clickup_frontend/node_modules/.pnpm/@nx+eslint-plugin@17.1.1_@types+node@18.11.9_@typescript-eslint+parser@6.10.0_eslint-config-p_3dqjsp2nk5zwpqpottk4p3quji/node_modules/@nx/eslint-plugin/src/utils/project-graph-utils.js:46:5)
    at create (/home/runner/work/clickup_frontend/clickup_frontend/node_modules/.pnpm/@nx+eslint-plugin@17.1.1_@types+node@18.11.9_@typescript-eslint+parser@6.10.0_eslint-config-p_3dqjsp2nk5zwpqpottk4p3quji/node_modules/@nx/eslint-plugin/src/rules/enforce-module-boundaries.js:133:1[37](https://github.com/time-loop/clickup_frontend/actions/runs/6852408090/job/18630875776?pr=40850#step:11:38))
    at Object.create (/home/runner/work/clickup_frontend/clickup_frontend/node_modules/.pnpm/@typescript-eslint+utils@6.10.0_eslint@8.46.0_typescript@5.1.3/node_modules/@typescript-eslint/utils/src/eslint-utils/RuleCreator.ts:102:14)
    at createRuleListeners (/home/runner/work/clickup_frontend/clickup_frontend/node_modules/.pnpm/eslint@8.46.0/node_modules/eslint/lib/linter/linter.js:870:21)
    at /home/runner/work/clickup_frontend/clickup_frontend/node_modules/.pnpm/eslint@8.46.0/node_modules/eslint/lib/linter/linter.js:10[40](https://github.com/time-loop/clickup_frontend/actions/runs/6852408090/job/18630875776?pr=40850#step:11:41):110
    at Array.forEach (<anonymous>)
    at runRules (/home/runner/work/clickup_frontend/clickup_frontend/node_modules/.pnpm/eslint@8.46.0/node_modules/eslint/lib/linter/linter.js:977:34)
    at Linter._verifyWithoutProcessors (/home/runner/work/clickup_frontend/clickup_frontend/node_modules/.pnpm/eslint@8.[46](https://github.com/time-loop/clickup_frontend/actions/runs/6852408090/job/18630875776?pr=40850#step:11:47).0/node_modules/eslint/lib/linter/linter.js:1330:31)
    at Linter._verifyWithoutProcessors (/home/runner/work/clickup_frontend/clickup_frontend/node_modules/.pnpm/eslint-plugin-eslint-comments@3.2.0_eslint@8.46.0/node_modules/eslint-plugin-eslint-comments/lib/utils/patch.js:166:36)

This was caused by #20004 which changed the semantics of how the wildcard import of chalk behaves to behave like native ESM interop - as chalk v4 is commonjs then it can only be imported as the default import and not as a wildcard.

Expected Behavior

No error is thrown any more

Related Issue(s)

I could not find any related issues.

@mattlewis92 mattlewis92 requested a review from a team as a code owner November 13, 2023 17:25
Copy link

vercel bot commented Nov 13, 2023

The latest updates on your projects. Learn more about Vercel for Git ↗︎

1 Ignored Deployment
Name Status Preview Updated (UTC)
nx-dev ⬜️ Ignored (Inspect) Visit Preview Nov 13, 2023 6:11pm

@mattlewis92 mattlewis92 changed the title fix(eslint-plugin): fix runtime error caused by incorrect chalk import fix(linter): fix runtime error caused by incorrect chalk import Nov 13, 2023
@MSkrzypietz
Copy link

I started getting this error after upgrading to v17 as well (only in CI pipelines). The solution was to switch from executing the eslint cli to using nx lint with the @nx/eslint:lint executor.

@meeroslav
Copy link
Contributor

meeroslav commented Jan 29, 2024

Thank you @mattlewis92 for this PR.

Unfortunately, I missed this PR and had fixed it already with #21201

@meeroslav meeroslav closed this Jan 29, 2024
@mattlewis92
Copy link
Contributor Author

Thank you @mattlewis92 for this PR.

Unfortunately, I missed this PR and had fixed it already with #21201

No problem, if you could take a look at this other one I filed though, it would be greatly appreciated! #20387

Copy link

github-actions bot commented Feb 5, 2024

This pull request has already been merged/closed. If you experience issues related to these changes, please open a new issue referencing this pull request.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Feb 5, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants