Skip to content

Conversation

@IvanKiral
Copy link
Contributor

Motivation

Which issue does this fix? Fixes #issue number

If no issue exists, what is the fix or new feature? Were there any reasons to fix/implement things that are not obvious?

Checklist

  • Code follows coding conventions held in this repo
  • Automated tests have been added
  • Tests are passing
  • Docs have been updated (if applicable)
  • Temporary settings (e.g. variables used during development and testing) have been reverted to defaults

How to test

If manual testing is required, what are the steps?

@IvanKiral IvanKiral marked this pull request as ready for review December 23, 2025 10:19
@IvanKiral IvanKiral requested a review from a team as a code owner December 23, 2025 10:19
public initialize(): void {
if (!window) {
throw InvalidEnvironmentError('IFrameCommunicator can only be initialized in a browser environment.');
if (typeof window === "undefined") {
Copy link
Member

Choose a reason for hiding this comment

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

window === undefined is not enough?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Here I have an error then This comparison appears to be unintentional because the types 'Window & typeof globalThis' and 'string' have no overlap.ts(2367)

I kind of decided to rather use this workaround cuz I believe this check makes sense. On the other hand, we probably might check whether we are in a browser somewhere in the top class and not check it in every class, though I did not want to really totally refactor this solution in this PR to not break it :D

Copy link
Member

Choose a reason for hiding this comment

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

sure, this is just a nitpick and I am totally ok with the current approach. Just thought that typeof window === "undefined" should work the same as window === undefined. In you error message you probably forgot to remove the " around undefined, because it tries to match against string instead of undefined. But maybe TS doesn't include undefined in the type of window so that might throw an error as well. Leave it as it is then.

"linter": {
"rules": {
"performance": {
"noBarrelFile": "off"
Copy link
Member

Choose a reason for hiding this comment

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

When there is this override here, we don't need the comment in the file, right?

Copy link
Member

Choose a reason for hiding this comment

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

When I remove the override and run biome, it shows only one error (and one warning for unexpected any). I'd prefer removing the override and removing that one reexport (ideally) or at least putting an ignore comment to that one place.


{
"files": [],
"references": [
Copy link
Member

Choose a reason for hiding this comment

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

Do we need this "root" tsconfig?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This is so the ts lsp could work for both test config and build configs. The solution was consulted with AI. Tests uses react.jsx for testing components. If i remember correctly, I was fighting cursor (ts lsp) with false React errors in tests.

Copy link
Member

Choose a reason for hiding this comment

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

I tried to rename tsconfig.build.json to tsconfig.json and update all the references to it (deleting the original tsconfig.json) and everything seems to work for me. That would be a lot more reasonable setup in my opinion. Can you try that?

@IvanKiral IvanKiral requested a review from JiriLojda January 5, 2026 11:59
Copy link
Member

@JiriLojda JiriLojda left a comment

Choose a reason for hiding this comment

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

Once we update the eslint config and biome config, lets update it here as well and remove the unnecessary eslint ignores.

): boolean {
const highlightType = getHighlightTypeForElement(element);

// eslint-disable-next-line @typescript-eslint/switch-exhaustiveness-check
Copy link
Member

Choose a reason for hiding this comment

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

Since the highlightType is an enum (finite number of elements), I'd also prefer here to remove the default and instead enumerate the rest of the options as cases for the rest. Then you'll be able to remove the ignore comment and whenever someone adds a new element to the enum, they'll be forced to add a case for it here. This will help avoid a scenario when one forgets to add a case here and cause a bug, because for their new enum element a non-default behavior would be required here.

"linter": {
"rules": {
"performance": {
"noBarrelFile": "off"
Copy link
Member

Choose a reason for hiding this comment

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

When I remove the override and run biome, it shows only one error (and one warning for unexpected any). I'd prefer removing the override and removing that one reexport (ideally) or at least putting an ignore comment to that one place.


{
"files": [],
"references": [
Copy link
Member

Choose a reason for hiding this comment

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

I tried to rename tsconfig.build.json to tsconfig.json and update all the references to it (deleting the original tsconfig.json) and everything seems to work for me. That would be a lot more reasonable setup in my opinion. Can you try that?

@@ -0,0 +1,26 @@
{
"$schema": "https://biomejs.dev/schemas/2.0.x/schema.json",
"extends": ["@kontent-ai/biome-config/base"],
Copy link
Member

Choose a reason for hiding this comment

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

Can we have the react rules as well? (Can be just for testing, but probably won't hurt for other files.)

"$schema": "https://biomejs.dev/schemas/2.0.x/schema.json",
"extends": ["@kontent-ai/biome-config/base"],
"files": {
"includes": ["src/**/*.ts", "src/**/*.tsx"]
Copy link
Member

Choose a reason for hiding this comment

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

The biome should format and lint the test files as well.

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