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

[GH-394] Migration to TypeScript: Sidebar_button migrated to Typescript #438

Merged
merged 11 commits into from
Jan 23, 2024
Merged

[GH-394] Migration to TypeScript: Sidebar_button migrated to Typescript #438

merged 11 commits into from
Jan 23, 2024

Conversation

Willy-Wakam
Copy link
Contributor

Summary

  • The file sidebar_button.jsx was migrated into his appropriated Typescript version

  • All properties and classes were well typed

Ticket Link

Fixes #430

Copy link

codecov bot commented Jan 11, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Comparison is base (eab8193) 33.40% compared to head (aac3ab2) 33.40%.

Additional details and impacted files
@@           Coverage Diff           @@
##           master     #438   +/-   ##
=======================================
  Coverage   33.40%   33.40%           
=======================================
  Files          22       22           
  Lines        3979     3979           
=======================================
  Hits         1329     1329           
  Misses       2519     2519           
  Partials      131      131           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@Willy-Wakam Willy-Wakam changed the title [GH-394] Migration to TypeScript: Sidebar_button migrated in Typescript [GH-394] Migration to TypeScript: Sidebar_button migrated to Typescript Jan 11, 2024
Copy link
Contributor

@mickmister mickmister left a comment

Choose a reason for hiding this comment

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

Thanks for this contribution @Willy-Wakam! This is looking really good. I have just a few suggestions. Also, we'll want to convert src/components/sidebar_buttons/index.js to typescript if possible.

To fix some linting rules, I suggest changing these lines in .eslintrc.json:

"no-magic-numbers": "off",
"no-use-before-define": "off",

Note that no-use-before-define is superseded by @typescript-eslint/no-use-before-define, so those checks will still be made.

Can you please run this command locally to ensure the linting is correct? The --fix flag makes it automatically fix certain things as well.

./node_modules/.bin/eslint src/components/sidebar_buttons/sidebar_buttons.tsx --fix

I tried to run the below command locally but it doesn't seem to work. It spits out a bunch of errors from node_modules/@types only. Using your editor's error reporting in that file should be enough for tsc errors.

npx tsc src/components/sidebar_buttons/sidebar_buttons.tsx --noEmit --skipLibCheck

import React from 'react';
import {Tooltip, OverlayTrigger} from 'react-bootstrap';
import React, { PureComponent, ReactElement } from 'react';
import { Tooltip, OverlayTrigger } from 'react-bootstrap';
Copy link
Contributor

@mickmister mickmister Jan 12, 2024

Choose a reason for hiding this comment

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

Our convention is generally to not have spaces in the imports. Our linter should catch this, though on a closer inspection, the npm run lint command is configured to only check js and jsx files

webapp/src/components/sidebar_buttons/sidebar_buttons.tsx Outdated Show resolved Hide resolved
webapp/src/components/sidebar_buttons/sidebar_buttons.tsx Outdated Show resolved Hide resolved
webapp/src/components/sidebar_buttons/index.js Outdated Show resolved Hide resolved
webapp/src/components/sidebar_buttons/sidebar_buttons.tsx Outdated Show resolved Hide resolved
webapp/src/components/sidebar_buttons/sidebar_buttons.tsx Outdated Show resolved Hide resolved
webapp/src/components/sidebar_buttons/sidebar_buttons.tsx Outdated Show resolved Hide resolved
@mickmister
Copy link
Contributor

mickmister commented Jan 12, 2024

@ayusht2810 Heads up that the linter seems to be configured incorrectly in npm run lint, as we are only including js and jsx files

Copy link
Contributor

@ayusht2810 ayusht2810 left a comment

Choose a reason for hiding this comment

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

LGTM! Apart from @mickmister comments.


import { RHSStates, connectUsingBrowserMessage } from 'src/constants';
import { isDesktopApp } from 'src/utils/user_agent';
// import PropTypes from 'prop-types';
Copy link
Contributor

Choose a reason for hiding this comment

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

We can remove this comment if it's of no use

Copy link
Contributor

Choose a reason for hiding this comment

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

why are we having changes in this file even though we didn't make any changes in the package.json file?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I got some errors in the previous commit, so I deleted and pulled the forked project again. I guess by installing node modules, the file was edited, although it was not really changed

Copy link
Contributor

Choose a reason for hiding this comment

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

The package-lock.json says it's lockfileVersion: 3 now. @Willy-Wakam Can you please either revert those changes, or try re-running npm install in the webapp folder after setting your node version to the version defined here?

You can set your node version using tools like https://github.com/nvm-sh/nvm or https://github.com/Schniz/fnm

@Willy-Wakam
Copy link
Contributor Author

Willy-Wakam commented Jan 19, 2024

If there are no more relevant changes, could you @ayusht2810 please merge and close the PR?

Copy link
Contributor

@mickmister mickmister left a comment

Choose a reason for hiding this comment

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

LGTM, thanks @Willy-Wakam!

@mickmister
Copy link
Contributor

Actually blocking on #438 (comment), since this PR currently changes the lockfile version to 3, when it should be 2

Copy link
Contributor

@ayusht2810 ayusht2810 left a comment

Choose a reason for hiding this comment

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

LGTM! Apart from lock file changes.

@mickmister
Copy link
Contributor

Thanks for the contribution @Willy-Wakam!

@mickmister mickmister merged commit b49b535 into mattermost:master Jan 23, 2024
9 checks passed
@mickmister mickmister mentioned this pull request Jan 24, 2024
@hanzei hanzei added this to the v1.8.1 milestone Jan 25, 2024
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.

Convert sidebar_buttons component to typescript
4 participants