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

Optimize calc() usage in scss files #1158

Open
wants to merge 17 commits into
base: main
Choose a base branch
from

Conversation

ShatilKhan
Copy link
Contributor

Description

Optimization of some math equations inside calc() in scss files was done.

Issues Resolved

Fixes #1002

Check List

  • New functionality includes testing.
  • New functionality has been documented.
  • All tests pass
    • yarn lint
    • yarn test-unit
  • Update CHANGELOG.md
  • Commits are signed per the DCO using --signoff

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.

For more information on following Developer Certificate of Origin and signing off your commits, please check here.

Naurabay and others added 7 commits November 16, 2023 21:10
Signed-off-by: Nuraiym Omurbekova <[email protected]>
Co-authored-by: Josh Romero <[email protected]>
Signed-off-by: ShatilKhan <[email protected]>
Also:
* Implement sass variable extraction
* Implement sass variable importing in typescript
* Add guards to post-install cleanup
* Make sources compatible with dart sass by wrapping divisions in `calc()` and adding units were necessary
* Fold in `@elastic/charts/dist/theme.scss` to modify it for dart-sass compatibility
* Break out compiling `charts`

Signed-off-by: Miki <[email protected]>
Signed-off-by: ShatilKhan <[email protected]>
* typescript bump: 4.1.6

Signed-off-by: Danila Gulderov <[email protected]>

* typescript bump: 4.2.4

Signed-off-by: Danila Gulderov <[email protected]>

* typescript bump: 4.3.5

Signed-off-by: Danila Gulderov <[email protected]>

* typescript bump: 4.4.4

Signed-off-by: Danila Gulderov <[email protected]>

* typescript bump: 4.5.5

Signed-off-by: Danila Gulderov <[email protected]>

* typescript bump: 4.6.4

Signed-off-by: Danila Gulderov <[email protected]>

* CHANGELOG.md updated

Signed-off-by: Danila Gulderov <[email protected]>

* bump typescript-eslint/eslint-plugin: 5.62.0
bump typescript-eslint/parser: 5.62.0

node 16 is required for typescript-eslint: 6.0.0

Signed-off-by: Danila Gulderov <[email protected]>

* CHANGELOG.md update

Signed-off-by: Danila Gulderov <[email protected]>

* move typescript update to regular section

Signed-off-by: Danila Gulderov <[email protected]>

* changelog message improvement

Signed-off-by: Danila Gulderov <[email protected]>

* fix typings

Signed-off-by: Danila Gulderov <[email protected]>

* cleanup useUnknownInCatchVariables

Signed-off-by: Danila Gulderov <[email protected]>

* logical or => nullish coalescing

Signed-off-by: Danila Gulderov <[email protected]>

* wrap with String

Signed-off-by: Danila Gulderov <[email protected]>

* Update CHANGELOG.md

Move CHANGELOG entry to the unreleased section

Signed-off-by: Miki <[email protected]>

* Add back `onPinClick` check in `OuiPinnableListGroup`

Update pinnable_list_group.tsx

Signed-off-by: Miki <[email protected]>

* Enhance error message extraction in `validateFieldValue`

Update default_syntax.ts

Signed-off-by: Miki <[email protected]>

* Remove e.code from default_syntax.ts

Update default_syntax.ts

Signed-off-by: Miki <[email protected]>

* Lint default_syntax.ts

Signed-off-by: Miki <[email protected]>

---------

Signed-off-by: Danila Gulderov <[email protected]>
Signed-off-by: Matt Provost <[email protected]>
Signed-off-by: Miki <[email protected]>
Co-authored-by: Matt Provost <[email protected]>
Co-authored-by: Josh Romero <[email protected]>
Co-authored-by: Miki <[email protected]>
Signed-off-by: ShatilKhan <[email protected]>
Signed-off-by: Shahriar Shatil <[email protected]>
Signed-off-by: ShatilKhan <[email protected]>
Signed-off-by: Shahriar Shatil <[email protected]>
Signed-off-by: ShatilKhan <[email protected]>
Signed-off-by: Shahriar Shatil <[email protected]>
Signed-off-by: ShatilKhan <[email protected]>
On line 88, in order to optimize
We perform the subtraction within the map-get function directly.
This simplifies the calculation by removing the unnecessary parentheses around map-get($map, 'percentage').

Signed-off-by: Shahriar Shatil <[email protected]>
Signed-off-by: ShatilKhan <[email protected]>
@ShatilKhan
Copy link
Contributor Author

These same kind of conflicts keep appeared in my previous PR
I'm curious about why this kind of conflict actually occurs?
image

<<<<<<< calc
=======
>>>>>>> main

What does this actually mean?

ShatilKhan and others added 7 commits November 17, 2023 16:58
Signed-off-by: Shahriar Shatil <[email protected]>
Signed-off-by: ShatilKhan <[email protected]>
Signed-off-by: Shahriar Shatil <[email protected]>
Signed-off-by: ShatilKhan <[email protected]>
Signed-off-by: Shahriar Shatil <[email protected]>
Signed-off-by: ShatilKhan <[email protected]>
Signed-off-by: ShatilKhan <[email protected]>
Signed-off-by: ShatilKhan <[email protected]>
Signed-off-by: Shahriar Shatil <[email protected]>
Signed-off-by: ShatilKhan <[email protected]>
Signed-off-by: Shahriar Shatil <[email protected]>
Signed-off-by: ShatilKhan <[email protected]>
@ShatilKhan
Copy link
Contributor Author

I'm just gonna make a new PR, a lot of problem with this one

@joshuarrrr
Copy link
Member

These same kind of conflicts keep appeared in my previous PR I'm curious about why this kind of conflict actually occurs? image

<<<<<<< calc
=======
>>>>>>> main

What does this actually mean?

@ShatilKhan Those lines indicate a merge conflict, where git is unsure whether which branch has the "correct" or desired changes. So it keeps both and wraps them in those markers so that you can manually choose (or replace with a combination). The first section is the line(s) as it appears in the calc branch and the second is the line as it appears in the main branch. See https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/addressing-merge-conflicts/about-merge-conflicts and https://code.visualstudio.com/docs/sourcecontrol/overview#_merge-conflicts

@ShatilKhan
Copy link
Contributor Author

Thanks for the explanation @joshuarrrr

@ShatilKhan ShatilKhan reopened this Dec 11, 2023
Signed-off-by: Shahriar Shatil <[email protected]>
@ShatilKhan
Copy link
Contributor Author

I resolved all the conflicts
This one is ready for review

@BSFishy
Copy link
Contributor

BSFishy commented Dec 12, 2023

Signed-off-by: Shahriar Shatil <[email protected]>
Copy link
Contributor Author

@ShatilKhan ShatilKhan left a comment

Choose a reason for hiding this comment

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

fixed linting failures

Signed-off-by: Shahriar Shatil <[email protected]>
Copy link
Collaborator

@AMoo-Miki AMoo-Miki left a comment

Choose a reason for hiding this comment

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

A lot of the changes are unnecessary and in fact, detrimental to readability and maintainability.

Comment on lines +13 to +14
const util = require('util')
const { writeFile, mkdir } = require('fs/promises'
Copy link
Collaborator

Choose a reason for hiding this comment

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

What happened here? Please revert.

@@ -64,4 +65,5 @@ module.exports = (babel) => ({
}
},
},

Copy link
Collaborator

Choose a reason for hiding this comment

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

Please remove unnecessary space.

@@ -28,6 +28,7 @@
* under the License.
*/


Copy link
Collaborator

Choose a reason for hiding this comment

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

Please remove unnecessary space.

Comment on lines +50 to +51
await Promise.all
inputFilenames.map(async (inputFilename) =>
Copy link
Collaborator

Choose a reason for hiding this comment

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

Please revert.

Comment on lines +89 to +90
chalk`{green ✔} Finished compiling {gray ${inputFilename}} to ${outputFilename
.map((filename) => chalk.gray(filename)
Copy link
Collaborator

Choose a reason for hiding this comment

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

Please revert

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.

Optimize calc() usage in scss files
6 participants