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

fix: apply eslint suggestions #111

Merged
merged 2 commits into from
Sep 9, 2024
Merged

fix: apply eslint suggestions #111

merged 2 commits into from
Sep 9, 2024

Conversation

hoxyq
Copy link

@hoxyq hoxyq commented Sep 5, 2024

Summary

Stacked on #110. See this commit.

Test plan

  • Running npm run check-lint no longer produces errors for our custom files.
  • Tested manually changed logic in RNWelcome.ts.

Upstreaming plan

  • This commit should be sent as a patch to the upstream devtools-frontend repo. I've reviewed the contribution guide.
  • This commit is React Native-specific and cannot be upstreamed.

Copy link

@EdmondChuiHW EdmondChuiHW left a comment

Choose a reason for hiding this comment

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

Interesting! The linter modified some upstream files last time.

#12 (comment)

Looks like Chrome ran the linter on their end too and the file doesn't have those anymore.

record: 'Record',
/**
*@description Text of an item that stops the running task
*/
stop: 'Stop',
/**
*@description Title of an action in the timeline tool to record reload
*/
startProfilingAndReloadPage: 'Start profiling and reload page',

@@ -247,8 +247,8 @@ class FuseboxReactNativeApplicationObserver implements
const {appDisplayName, deviceName} = event.data;

// Update window title
if (appDisplayName != null) {
document.title = `${appDisplayName}${deviceName != null ? ` (${deviceName})` : ''} - React Native DevTools`;
if (appDisplayName !== null && appDisplayName !== undefined) {
Copy link

Choose a reason for hiding this comment

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

Bit unfortunate about this check — != null is FB code style and more concise. Happy to align but we could consider overriding for META_CODE_PATHS.

Copy link
Author

Choose a reason for hiding this comment

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

I am leaning more towards adopting what is already used in the project. Like what if, for example, we need to change non-FB codepaths? For hiding unsupported features, should we use FB code style or not?

I will keep it as it is now, but open to discuss the whole approach in a broader group, since we already have a list of things: # vs private, != vs !==, ...

Copy link

@EdmondChuiHW EdmondChuiHW Sep 12, 2024

Choose a reason for hiding this comment

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

I believe the existing repo convention is to use if (object) or if (Boolean(…))

Copy link
Author

Choose a reason for hiding this comment

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

I've changed it this way, so there are no functional changes

e. g. a != null is the same as a !== null && a !== undefined, but not the same as !!a or Boolean(a)

Choose a reason for hiding this comment

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

Yes the meaning would not the same for this specific line. I'm partial to adopting to local patterns too, so the if (object) or if (Boolean(…)) seems to be the general convention here.

Tho in this specific case, it'd would seem like if (appDisplayName) would work slightly better as it'd filter out (already-trimmed) empty strings as well.

I'm totally happy that this PR as-is is scoped strictly on logical parity (same functional outcomes before and after lint fixes). Items mentioned in this thread is for future considerations when/if we do have a wider conversation around the style

@hoxyq hoxyq merged commit 3a496f2 into main Sep 9, 2024
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants