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

chore: update to eslint 9 and the flat configuration #12877

Open
wants to merge 18 commits into
base: main
Choose a base branch
from

Conversation

robertIsaac
Copy link
Contributor

Description

currently the repo is using the old .eslintrc and the unsupport eslint 8 versions
this PR migrate to the new flat configuration and eslint 9

I also updated nx since the old version was buggy, you may want to do the upgrade in a separate branch first which is understandable

note that I didn't add all the old plugins, this can be done in a future PR, or if mandatory I can work on it in the future

Copy link

netlify bot commented Dec 23, 2024

Deploy Preview for fundamental-ngx ready!

Name Link
🔨 Latest commit
🔍 Latest deploy log https://app.netlify.com/sites/fundamental-ngx/deploys/67a11708cf557b3231291b3b
😎 Deploy Preview https://deploy-preview-12877--fundamental-ngx.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

Copy link

github-actions bot commented Feb 2, 2025

Visit the preview URL for this PR (updated for commit a577425):

https://fundamental-ngx-gh--pr12877-eslint-9-n0f3yx2r.web.app

(expires Thu, 06 Feb 2025 19:23:53 GMT)

🔥 via Firebase Hosting GitHub Action 🌎

Sign: 41b993ee8e451bd7c6770b342ce142dc886eacff

@droshev droshev added this to the Sprint 143 - February 2025 milestone Feb 2, 2025
@droshev droshev assigned droshev and robertIsaac and unassigned droshev Feb 2, 2025
@droshev droshev added the tooling tooling feature around fundamental-ngx label Feb 3, 2025
Copy link
Member

@mikerodonnell89 mikerodonnell89 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@robertIsaac this appears to introduce some problems with committing. For example, i just opened this file and entered a tab before a variable definition, to test the formatting. On commit, I see the error: 42:5 error Definition for rule '@angular-eslint/no-output-on-prefix' was not found @angular-eslint/no-output-on-prefix

@robertIsaac
Copy link
Contributor Author

robertIsaac commented Feb 3, 2025

@mikerodonnell89
this is due to how the new flat config works it reads from the directory it's executed, not from the closest config file to the file

to illustrate the problem try these command

eslint libs\platform\form\auto-complete\auto-complete.directive.ts # will fail
cd .\libs\platform\
eslint form\auto-complete\auto-complete.directive.ts # will pass

the problem is that lint-staged is triggering eslint directly which will be using the root-level eslint.config.js file not the libs\platform\eslint.config.js one

while nx lint platform will use the correct file

now how to fix this problem? to be honest I'm not sure
I need to research it

@robertIsaac
Copy link
Contributor Author

I used the flag unstable_config_lookup_from_file to fix it, it looks like the only way now
read more about it here https://eslint.org/blog/2024/10/eslint-v9.12.0-released/#experimental-configuration-file-resolution

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
tooling tooling feature around fundamental-ngx
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants