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(shared-object-base): Move to recommended eslint base config #23233

Merged
merged 19 commits into from
Dec 3, 2024

Conversation

alexvy86
Copy link
Contributor

@alexvy86 alexvy86 commented Dec 3, 2024

Description

Moves from the minimal-deprecated eslint config to the recommended one in the shared-object-base package.

Reviewer Guidance

The review process is outlined on this wiki page.

AB#3018

@alexvy86 alexvy86 requested a review from a team as a code owner December 3, 2024 00:11
@github-actions github-actions bot added area: dds Issues related to distributed data structures public api change Changes to a public API labels Dec 3, 2024
@alexvy86 alexvy86 requested review from Josmithr and a team December 3, 2024 00:12
@github-actions github-actions bot added the base: main PRs targeted against main branch label Dec 3, 2024
@@ -52,7 +48,7 @@ export class RemoteFluidObjectHandle extends FluidHandleBase<FluidObject> {
};
this.objectP = this.routeContext.resolveHandle(request).then<FluidObject>((response) => {
if (response.mimeType === "fluid/object") {
const fluidObject: FluidObject = response.value;
const fluidObject: FluidObject = response.value as FluidObject;
Copy link
Contributor

Choose a reason for hiding this comment

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

Any validation we can do here?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Not familiar with the space, but I think the existing check for mimeType is enough?

@@ -234,16 +248,18 @@ describe("FluidSerializer", () => {
);

// Add some handles to intermediate objects.
input.h = handle;
input.o1.h = handle;
input.h = handle; // eslint-disable-line @typescript-eslint/no-unsafe-member-access
Copy link
Contributor

Choose a reason for hiding this comment

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

Can we not use eslint-disable-next-line for these (for consistency)?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

We can. I personally find the resulting code harder to parse than this, but don't feel strongly one way or the other. I tend to prefer "this-line" comments and use next-line only when the line is already too long and reading the disable would require scrolling.

Copy link
Contributor

Choose a reason for hiding this comment

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

I don't feel that strongly, it's just not what we normally do. Feel free to close without action 🙂

Copy link
Contributor

Choose a reason for hiding this comment

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

I didn't even know there was a "this-line"!! I'm with @alexvy86 - I like that much better than "next-line" as long as it doesn't make the line way too long.

Copy link
Contributor

@Josmithr Josmithr left a comment

Choose a reason for hiding this comment

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

Left a couple of comments, but overall looks good to me! Thanks!!

alexvy86 and others added 3 commits December 3, 2024 08:15
Co-authored-by: Joshua Smithrud <[email protected]>
Co-authored-by: Joshua Smithrud <[email protected]>
@@ -33,10 +33,10 @@ export interface ISharedObjectKind<TSharedObject> {
}

// @alpha
export function makeHandlesSerializable(value: any, serializer: IFluidSerializer, bind: IFluidHandle): any;
export function makeHandlesSerializable(value: unknown, serializer: IFluidSerializer, bind: IFluidHandle): any;
Copy link
Contributor Author

@alexvy86 alexvy86 Dec 3, 2024

Choose a reason for hiding this comment

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

Updating an input type on free functions shouldn't be breaking.

let didAttach = 0;
let attachCalled = false;
const { overrides, sharedObject } = createTestSharedObject({
runtime: {
...(runtimeEvents as any),
...(runtimeEvents as unknown as Overridable<IFluidDataStoreRuntime>),
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Using the same pattern found already in other places in this file. Trying to use ...runtimeEvents on its own results in mismatched typing issues along the lines of the one below, which I don't quite understand or know how to fix:

<several more entries...>
Type 'TypedEventTransform<TypedEventEmitter<IFluidDataStoreRuntimeEvents>, IFluidDataStoreRuntimeEvents>' is not assignable to type 'TransformedEvent<IFluidDataStoreRuntime, "disconnected", []>'.
  Types of parameters 'event' and 'event' are incompatible.
    Type '"disconnected"' is not assignable to type '"newListener" | "removeListener"'.ts(2322)

Copy link
Contributor

github-actions bot commented Dec 3, 2024

🔗 No broken links found! ✅

Your attention to detail is admirable.

linkcheck output


> [email protected] ci:check-links /home/runner/work/FluidFramework/FluidFramework/docs
> start-server-and-test "npm run serve -- --no-open" 3000 check-links

1: starting server using command "npm run serve -- --no-open"
and when url "[ 'http://127.0.0.1:3000' ]" is responding with HTTP status code 200
running tests using command "npm run check-links"


> [email protected] serve
> docusaurus serve --no-open

[SUCCESS] Serving "build" directory at: http://localhost:3000/

> [email protected] check-links
> linkcheck http://localhost:3000 --skip-file skipped-urls.txt

Crawling...

Stats:
  170006 links
    1595 destination URLs
    1825 URLs ignored
       0 warnings
       0 errors


@alexvy86 alexvy86 merged commit 18036ea into microsoft:main Dec 3, 2024
32 checks passed
@alexvy86 alexvy86 deleted the eslint-config branch December 3, 2024 17:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area: dds Issues related to distributed data structures base: main PRs targeted against main branch public api change Changes to a public API
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants