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

Refactor/biome code style #628

Merged
merged 24 commits into from
Nov 14, 2024

Conversation

maxmorozoff
Copy link
Contributor

No description provided.

Copy link

changeset-bot bot commented Nov 11, 2024

⚠️ No Changeset found

Latest commit: 4df9a87

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@@ -144,6 +142,7 @@ export function applyOverride() {
const hookResolved = isApp()
? requestMapApp.get(request)
: requestMapPage.get(request);
//! biome-ignore lint/style/noParameterAssign: <explanation> <-- doesn't work
Copy link
Contributor Author

Choose a reason for hiding this comment

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

It seems there's an issue with Biome. Here’s a reproduction link: Biome Playground

Copy link
Contributor

Choose a reason for hiding this comment

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

Just set it to // biome-ignore lint: Should be lint/style/noParameterAssign, but there is a bug in biome

Copy link
Contributor

Choose a reason for hiding this comment

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

+1.

And extra +1 if there is a link to the biome bug

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The issue was confirmed: biomejs/biome#4519

Copy link

pkg-pr-new bot commented Nov 11, 2024

Open in Stackblitz

pnpm add https://pkg.pr.new/@opennextjs/aws@628

commit: 4df9a87

@vicb
Copy link
Contributor

vicb commented Nov 13, 2024

Should this PR be rebased and merged?
(As it touches a lot of files it might be tedious to have it pending for too long)

@conico974
Copy link
Contributor

Should this PR be rebased and merged?
(As it touches a lot of files it might be tedious to have it pending for too long)

Definitely.

One thing that we need to be extra careful with this PR is about every file with //#override.
For example one var could be defined as mutable (i.e. let), but not mutated inside this specific file, but the override does mutate it. Biome cannot know this kind of thing.
For these file, every change should be carefully reviewed (including looking at what the override will do)

@maxmorozoff
Copy link
Contributor Author

Should this PR be rebased and merged?

Ok, I'll rebase it today.

@maxmorozoff maxmorozoff marked this pull request as ready for review November 13, 2024 19:12
.git-blame-ignore-revs Outdated Show resolved Hide resolved
- Fixed linting issues related to the rule
- Restored the rule to default settings
- Fixed linting issues related to the rule
- Restored the rule to default settings
- Fixed linting issues related to the rule
- Restored the rule to default settings
@maxmorozoff
Copy link
Contributor Author

The only remaining warning is related to a Biome issue.

Should I refactor this part to resolve the warning by using a local variable, or would it be better to add a TODO comment to revisit this after the Biome issue is resolved?

$ pnpm lint

> [email protected] lint /opennextjs-aws
> biome check

/opennextjs-aws/packages/open-next/src/core/require-hooks.ts:146:23 lint/style/noParameterAssign ━━━━━━━━━━

  ℹ Reassigning a function parameter is confusing.
  
    144 │       : requestMapPage.get(request);
    145 │     //! biome-ignore lint/style/noParameterAssign: <explanation> <-- doesn't work
  > 146 │     if (hookResolved) request = hookResolved;
        │                       ^^^^^^^
    147 │     return originalResolveFilename.call(mod, request, parent, isMain, options);
    148 │ 
  
  ℹ The parameter is declared here:
  
    135 │     requestMapApp: Map<string, string>,
    136 │     requestMapPage: Map<string, string>,
  > 137 │     request: string,
        │     ^^^^^^^^^^^^^^^
    138 │     parent: any,
    139 │     isMain: boolean,
  
  ℹ Use a local variable instead.
  

Checked 302 files in 121ms. No fixes applied.

@conico974
Copy link
Contributor

@maxmorozoff About the issue, why did you change it back to a normal function with a biome ignore #627 (comment)
Also why just not do this, it works on the playground #628 (comment)

I'll do a proper review tomorrow

@maxmorozoff
Copy link
Contributor Author

why did you change it back to a normal function with a biome ignore #627 (comment)

Didn't see your reply - my apologies.
The issue is now resolved. Thank you!

Copy link
Contributor

@conico974 conico974 left a comment

Choose a reason for hiding this comment

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

LGTM Thanks

@conico974 conico974 merged commit 009332b into opennextjs:main Nov 14, 2024
3 checks passed
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