-
Notifications
You must be signed in to change notification settings - Fork 4
Update deps #207
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
base: master
Are you sure you want to change the base?
Update deps #207
Conversation
7e3660c to
d71896a
Compare
| public initialize(): void { | ||
| if (!window) { | ||
| throw InvalidEnvironmentError('IFrameCommunicator can only be initialized in a browser environment.'); | ||
| if (typeof window === "undefined") { |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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" |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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": [ |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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?
JiriLojda
left a comment
There was a problem hiding this 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 |
There was a problem hiding this comment.
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" |
There was a problem hiding this comment.
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": [ |
There was a problem hiding this comment.
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"], | |||
There was a problem hiding this comment.
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"] |
There was a problem hiding this comment.
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.
Motivation
Which issue does this fix? Fixes #
issue numberIf no issue exists, what is the fix or new feature? Were there any reasons to fix/implement things that are not obvious?
Checklist
How to test
If manual testing is required, what are the steps?