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

AG-12204 - Next step in ESLlint v9 upgrade #3359

Merged
merged 5 commits into from
Jan 10, 2025

Conversation

alantreadway
Copy link
Member

@alantreadway alantreadway requested a review from a team as a code owner January 9, 2025 17:02
@alantreadway alantreadway changed the title ag 12204/complete eslint v9 upgrade AG-12204 - Next step in ESLlint v9 upgrade Jan 9, 2025
@alantreadway alantreadway force-pushed the ag-12204/complete-eslint-v9-upgrade branch from b83572c to 987959c Compare January 10, 2025 10:03
@@ -52,8 +52,6 @@ export const sonarjsConfig = [

// For review - new for eslint 9.
'sonarjs/no-redeclare': 1,
'sonarjs/public-static-readonly': 1,
Copy link
Member Author

Choose a reason for hiding this comment

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

Note: Removing these entries activates the rules at error level.

Comment on lines 64 to 68
title?: string;
symbol?: LegendSymbolOptions;
data?: TooltipContentDataRow[];
rawHtmlString?: string;
}
Copy link
Contributor

@jacobp100 jacobp100 Jan 10, 2025

Choose a reason for hiding this comment

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

This is one or the other. Might be better to represent like this:-

Suggested change
title?: string;
symbol?: LegendSymbolOptions;
data?: TooltipContentDataRow[];
rawHtmlString?: string;
}
title?: string;
symbol?: LegendSymbolOptions;
data?: TooltipContentDataRow[];
} | {
rawHtmlString: string;
}

Copy link
Member Author

Choose a reason for hiding this comment

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

I've tried applying this - but the simplest thing to do is add a type discriminator field, as 'rawHtmlString' in content isn't enough of a hint to the TS compiler that on the negative control flow that the inferred typing of content is a single union member type.

9e3aeac is the smallest additional change encoding use of a type union for TooltipContent.

let i = 0;
let estimatedWidth = 0;
let lastSpaceIndex = 0;
while (i < line.length) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Wondering, what was the warning here about?

Copy link
Contributor

Choose a reason for hiding this comment

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

Mutating the iteratee in a for-loop

Copy link
Member Author

@alantreadway alantreadway left a comment

Choose a reason for hiding this comment

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

PTAL

Comment on lines 64 to 68
title?: string;
symbol?: LegendSymbolOptions;
data?: TooltipContentDataRow[];
rawHtmlString?: string;
}
Copy link
Member Author

Choose a reason for hiding this comment

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

I've tried applying this - but the simplest thing to do is add a type discriminator field, as 'rawHtmlString' in content isn't enough of a hint to the TS compiler that on the negative control flow that the inferred typing of content is a single union member type.

9e3aeac is the smallest additional change encoding use of a type union for TooltipContent.

@alantreadway alantreadway merged commit 54e2a94 into latest Jan 10, 2025
26 checks passed
@alantreadway alantreadway deleted the ag-12204/complete-eslint-v9-upgrade branch January 10, 2025 14:50
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