Skip to content

[Draft] | Support flat eslint configuration format for nimble packages#2718

Closed
gokulprasanth-ni wants to merge 8 commits intomainfrom
users/gokulprasanthRavi/feat/convert-to-eslint-v9
Closed

[Draft] | Support flat eslint configuration format for nimble packages#2718
gokulprasanth-ni wants to merge 8 commits intomainfrom
users/gokulprasanthRavi/feat/convert-to-eslint-v9

Conversation

@gokulprasanth-ni
Copy link
Copy Markdown
Contributor

@gokulprasanth-ni gokulprasanth-ni commented Oct 3, 2025

Pull Request

🤨 Rationale

  • Update nimble packages to use flat eslint configuration format and upgrade to eslint v9.
  • The prettier related changes will be handled in the upcoming PR.

👩‍💻 Implementation

  • Updated nimble packages to use flat eslint configuration and upgrade to eslint v9.
  • Fixed the linting issue as per the new version of javascript-styleguide packages.
  • Temporarily removed the prettier from linting as per the suggestion given in this comment. It will be updated in the upcoming PR.

🧪 Testing

  • Ran the linting command and it got passed.

✅ Checklist

  • I have updated the project documentation to reflect my changes or determined no changes are needed.

Signed-off-by: gokulprasanth-ni <131153319+gokulprasanth-ni@users.noreply.github.com>
Signed-off-by: gokulprasanth-ni <131153319+gokulprasanth-ni@users.noreply.github.com>
Signed-off-by: gokulprasanth-ni <131153319+gokulprasanth-ni@users.noreply.github.com>
Signed-off-by: gokulprasanth-ni <131153319+gokulprasanth-ni@users.noreply.github.com>

attr({ attribute: 'fractional-width', converter: nullableNumberConverter })(
// eslint-disable-next-line @typescript-eslint/no-unsafe-argument

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Suggested change

This applies to all instances where we leave a line space where you removed the lint suppression.

@gokulprasanth-ni gokulprasanth-ni marked this pull request as ready for review October 3, 2025 15:07
@rajsite rajsite marked this pull request as draft October 3, 2025 15:20
@@ -0,0 +1,7 @@
{
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Moved the PR to draft because like described in this comment lets do the nimble transition after AzDo. We should iterate in AzDo first and we don't have the time to review the change in nimble right now.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Milan, I want to ensure I understood correctly. Are you suggesting that we update the SLE apps first, followed by the Nimble update? Additionally, in your other comment, you mentioned updating the Azdo pipeline—could you please clarify what specific updates are required there?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Are you suggesting that we update the SLE apps first

yep!

mentioned updating the Azdo pipeline—could you please clarify what specific updates are required there?

sorry wasn't being clear, the SLE apps is what I meant. Not aware of any azdo pipeline changes.

Copy link
Copy Markdown
Member

@rajsite rajsite Oct 3, 2025

Choose a reason for hiding this comment

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

fyi @gokulprasanth-ni as part of regular dependency updates we pulled in the the stylistic eslint changes (from pre v9) into nimble. We also made some intentional rule tweaks which are now merged in main. Just an fyi when the eslint v9 upgrade is revisited.

Hopefully now there will be far fewer changes in the PRs as the stylistic update was merged separately

Copy link
Copy Markdown
Member

@rajsite rajsite Oct 5, 2025

Choose a reason for hiding this comment

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

The goal of splitting the prettier update to a separate PR was to reduce the number of formatting changes in this PR. The assumption was that prettier is what caused so many changes but there are still over 100 files changed in this PR many with just formatting changes. Does splitting the prettier update into a separate PR actually make a difference?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

@rajsite @jattasNI I tried updating the prettier-eslint and prettier-eslint-cli packages version in the Nimble monorepo to make them compatible with ESLint v9. Following this upgrade, we tried enabling ESLint and Prettier for linting across several packages in the workspace.

Problem:

During this update, they were conflicts between ESLint and Prettier that create a circular fixing problem:

  • ESLint runs first and reports certain formatting/style violations
  • Prettier runs subsequently and reports different or conflicting style issues
  • When we fix the ESLint errors, those changes are flagged as violations by Prettier
  • Conversely, when we fix Prettier issues, ESLint reports new violations
  • This creates an endless loop where fixing one tool's issues breaks the other tool's rules

Proposed Solutions:

We're considering the following approaches to resolve this conflict:

  • Disable ESLint style rules: Turn off all style/formatting-related rules in ESLint (such as indent, quotes, semi, comma-dangle, etc.) and rely exclusively on Prettier for code formatting. This would allow ESLint to focus on code quality and potential bugs while Prettier handles all stylistic concerns.

  • Use eslint-plugin-prettier: Integrate Prettier directly into ESLint by using eslint-plugin-prettier along with eslint-config-prettier. This approach:

    • Runs Prettier as an ESLint rule
    • Automatically disables conflicting ESLint formatting rules via eslint-config-prettier
    • Reports Prettier formatting issues as ESLint errors
    • Provides a single, unified linting experience with no conflicts

But we are still not sure whether these approaches works fine or not. We would like to get your thoughts on this and also any alternate solutions available to fix this issue.

Copy link
Copy Markdown
Member

@rajsite rajsite Nov 17, 2025

Choose a reason for hiding this comment

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

Looking at it again I'm not sure why we call both prettier-eslint and eslint via the cli. I think we can just prettier-eslint which is aware of the eslint configuration already.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Closing this PR as it will be handled in the below PR

#2768

…nt-v9

Signed-off-by: gokulprasanth-ni <131153319+gokulprasanth-ni@users.noreply.github.com>
Signed-off-by: gokulprasanth-ni <131153319+gokulprasanth-ni@users.noreply.github.com>
Signed-off-by: gokulprasanth-ni <131153319+gokulprasanth-ni@users.noreply.github.com>
@rajsite rajsite mentioned this pull request Dec 3, 2025
1 task
rajsite added a commit that referenced this pull request Dec 4, 2025
# Pull Request

## 🤨 Rationale

Adopts eslint v9 🎉

## 👩‍💻 Implementation

- Switches to ni eslint config packages using flat config
- Removes `prettier-eslint` which is in [alpha
builds](https://github.com/prettier/prettier-eslint/releases?q=v17&expanded=true)
for eslint v9 support, significantly hurt lint performance, and had
[major conflicts with
eslint](#2718 (comment)).
Now that eslint libraries like [stylistic](https://eslint.style/) are
dedicated to style rules and eslint supports more formats such as
[markdown syntax](https://github.com/eslint/markdown) and [markdown
style](https://github.com/ota-meshi/eslint-plugin-markdown-preferences?tab=readme-ov-file)
it's possible we don't need to rely on prettier long term. Either way we
remove prettier for now to unblock eslint upgrades and can reconsider in
the future
- Linting performance was significantly improved so simplified the
`validate` concurrency scripts to run all lint sequentially in parallel
to tests. Now `validate` completes ~100s faster. It's also possible we
will get another speed bump enabling [multithreaded
eslint](https://eslint.org/blog/2025/08/multithread-linting/) but will
save for a follow-up PR.
- In the nimble private `eslint-config-nimble` package:
- Created a shared `lintNimbleConfig` configuration that is used in each
eslint config to make sure the eslint config file itself is linted and
to give a spot for very general shared config in follow-up PRs (like
markdown or json linting)
- Created an angular lint similar to our typescript / component configs
as shared config for the angular projects. This resolves issues where
extending from a base config in the angular workspace is technically
crossing a library boundary and triggered lint errors about reaching
across package boundaries. Now we explicitly depend on a shared package.
- Angular workspace changes:
- The angular workspace root config is now for the config file in root,
not the angular projects.
- Each angular project uses the shared `angularTypescriptNimbleConfig`
and `angularTemplateNimbleConfig`
- Root workspace changes:
- Added a top-level eslint config file for the config in root (the
config file itself and beachball) but could also be used for linting
markdown, etc. in the future.
- Having a root eslint config also prevents the eslint vscode plugin
from getting confused (errors in extension output logs) searching for
the eslint config for files in root.

## 🧪 Testing

Note, see #2774 for CI results and source changes resulting from this
config change.

## ✅ Checklist

- [x] I have updated the project documentation to reflect my changes or
determined no changes are needed. **A follow-up PR will remove prettier
references and docs**

---------

Signed-off-by: gokulprasanth-ni <131153319+gokulprasanth-ni@users.noreply.github.com>
Co-authored-by: gokulprasanth-ni <131153319+gokulprasanth-ni@users.noreply.github.com>
Co-authored-by: rajsite <1588923+rajsite@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants