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

Replace bound functions #375

Merged

Conversation

mauromascarenhas
Copy link

Proposed changes

Replaced component instances "bound functions" by ES6 arrow expressions (instance functions which are already bound to current context) whenever it was possible, making the code cleaner and easier to maintain in the long term.

  • Removed instance declarations of "bound functions";
  • Updated declarations of handler functions.

Extra: Removed unnecessary spaces and "fixed" code indentation.

Types of changes

  • Bug fix (non-breaking change which fixes an issue).
  • New feature (non-breaking change which adds functionality).
  • Breaking change (fix or feature that would cause existing functionality to change).

Checklist:

  • I have read the CONTRIBUTING document.
  • My commit messages follows the conventional commit format
  • My change requires a change to the documentation, and updated it accordingly.
  • I have added tests to cover my changes.
  • All new and existing tests passed.

- Removed unnecessary whitespaces on line ending;
- Fixed indentation for every component.
- Replaced event handlers by arrow expressions (class members);
- Replaced calls to "bound function" to class property methods;
- Removed declarations for "bound functions";
- Removed unused variables.
- Fixed resize handlers for "throttled" callbacks;
- Affected components:
    - Carousel;
    - Parallax;
    - ScrollSpy;
    - TapTarget;
@wuda-io
Copy link
Member

wuda-io commented Jun 13, 2023

Sorry but this is impossible to review. Nearly every line was changed.
Thanks for your effort though, but I think there is not much actual change. The time to review this would take too long.
Maybe you can commit or make PR in smaller chunks, so it is easier to review.
For now I can not approve it because there were too many changes at once.

As far as I can see, only spaces and code-style was changed. That is great, but I think this will happen at each
future commit again, since everyone has their own preference and coding style.

I would suggest to use something like prettier. But I am not very familiar with it. It would be awesome if the style is automatically changed, so that we have a consistent code style.
Are you ok with this? What are your thoughts?

@wuda-io
Copy link
Member

wuda-io commented Jun 13, 2023

I am talking about this commit
The other two are perfect!

@mauromascarenhas
Copy link
Author

mauromascarenhas commented Jun 13, 2023

Sorry but this is impossible to review. Nearly every line was changed. Thanks for your effort though, but I think there is not much actual change. The time to review this would take too long. Maybe you can commit or make PR in smaller chunks, so it is easier to review. For now I can not approve it because there were too many changes at once.

As far as I can see, only spaces and code-style was changed. That is great, but I think this will happen at each future commit again, since everyone has their own preference and coding style.

I would suggest to use something like prettier. But I am not very familiar with it. It would be awesome if the style is automatically changed, so that we have a consistent code style. Are you ok with this? What are your thoughts?

I agree with you that each one has a different coding style and it must be respected.
But this commit just fixes some long time indentation issues (see current "src/toast@3~13" to check the difference) and removes trailing whitespaces (no other change has been made).

If this sort of problem should not be fixed, this commit could be reverted.

@wuda-io wuda-io merged commit a020255 into materializecss:v2-dev Jun 14, 2023
@wuda-io
Copy link
Member

wuda-io commented Jun 14, 2023

I merged it because it passed all test, and the code looked cleaner 😃
Thanks for your contribution!

@mauromascarenhas mauromascarenhas deleted the replace-bound-functions branch June 14, 2023 16:06
@wuda-io wuda-io mentioned this pull request Jul 12, 2023
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.

2 participants