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 sass-lint with stylelint #949

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

Conversation

gulderov
Copy link
Contributor

@gulderov gulderov commented Aug 3, 2023

Description

sass-lint is an unmaintained project

Please review the migration to stylelint. Which includes the following steps:

  • Avoid manual changes
  • The style check script has been changed to yarn lint-style
  • yarn lint-style --fix was run to auto fix everything possible

Issues Resolved

resolves #119

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.

@gulderov gulderov changed the title Replace sass-lint with stylelint Draft: Replace sass-lint with stylelint Aug 3, 2023
Copy link
Contributor

@BSFishy BSFishy left a comment

Choose a reason for hiding this comment

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

Looks pretty good so far, just a few comments I had on first inspection

Comment on lines +6 to +8
# recommended to turn off descending specificity since we use a lot of nesting:
# https://stylelint.io/user-guide/rules/list/no-descending-specificity/
no-descending-specificity: null
Copy link
Contributor

Choose a reason for hiding this comment

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

It might be nice to have a selector ordering rule. We should look into this further to see how much work it would be and if we should do it in the first place

Copy link
Contributor Author

Choose a reason for hiding this comment

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

We could handle it as separate task

@@ -177,7 +179,7 @@ $elasticLogoTextDark: #1C1E23;
}

.guideDemo__ghostBackground {
@if (lightness($ouiTextColor) < 50) {
@if lightness($ouiTextColor) < 50 {
Copy link
Contributor

Choose a reason for hiding this comment

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

Why the extra space here? There seem to be a lot of these? Is it just an artifact of yarn lint-sass-fix?

Suggested change
@if lightness($ouiTextColor) < 50 {
@if lightness($ouiTextColor) < 50 {

Copy link
Contributor Author

@gulderov gulderov Aug 4, 2023

Choose a reason for hiding this comment

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

It is artifact from yarn lint-style --fix. I was wondering to fix it with prettier. But we need to update prettier first and that is separate task.

I tend to avoid manual intervention and keep it as is for now. Prettier would reformat it later

@@ -10,9 +10,8 @@
*/

// sass-lint:disable no-url-domains, no-url-protocols
Copy link
Contributor

Choose a reason for hiding this comment

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

Would love to get rid of old sass-lint disables

Copy link
Contributor Author

@gulderov gulderov Aug 4, 2023

Choose a reason for hiding this comment

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

sass-lint has been removed from the codebase

@gulderov gulderov changed the title Draft: Replace sass-lint with stylelint Replace sass-lint with stylelint Aug 4, 2023
@gulderov gulderov mentioned this pull request Aug 4, 2023
7 tasks
@BSFishy
Copy link
Contributor

BSFishy commented Aug 5, 2023

https://github.com/opensearch-project/oui/actions/runs/5759821731/job/15628275259?pr=949#step:5:13

Do you know why the linter is failing in CI? Does it need to be rerun?

Signed-off-by: Danila Gulderov <[email protected]>
@gulderov
Copy link
Contributor Author

gulderov commented Aug 8, 2023

@BSFishy I removed the quotes to try and fix CI

Signed-off-by: Danila Gulderov <[email protected]>
@AMoo-Miki AMoo-Miki self-assigned this Aug 24, 2023
@BSFishy
Copy link
Contributor

BSFishy commented Sep 14, 2023

Love to see the CI is passing, gives me a lot more confidence in this. Will re-review and approve if everything looks good

Copy link
Contributor

@BSFishy BSFishy left a comment

Choose a reason for hiding this comment

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

Overall looks good, will pull down and play around with it then approve

Comment on lines +27 to +28
"lint-style": "stylelint \"{src,src-docs}/**/*.scss\" --max-warnings 0",
"lint-style-fix": "yarn lint-style --fix",
Copy link
Contributor

Choose a reason for hiding this comment

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

Curious if this will cause anything unintended to break. All CI passes, but I wonder if anyone else is using these commands that we don't know about. Either way, I don't think it's something we really need to worry about for breaking things ~ this is more meant for dev anyway

@@ -216,6 +210,7 @@
"moment-timezone": "^0.5.41",
"node-sass": "npm:@amoo-miki/[email protected]",
"pegjs": "^0.10.0",
"postcss": "^8.4.28",
Copy link
Contributor

Choose a reason for hiding this comment

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

I am astonished that we were using postcss without specifying it as a dep 🤦

Copy link
Contributor

@BSFishy BSFishy left a comment

Choose a reason for hiding this comment

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

Just a few minor final things

Comment on lines +1 to +2
build
target
Copy link
Contributor

Choose a reason for hiding this comment

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

We have a few artifact directories:

dist
docs
es
lib
test-env
types

Additionally, would node_modules be a good choice to be here?

Comment on lines +4 to +5
# while we still use node-sass, only legacy rgb() notation is allowed
color-function-notation: "legacy"
Copy link
Contributor

Choose a reason for hiding this comment

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

Will need to followup on this for #1001

@BSFishy BSFishy mentioned this pull request Sep 14, 2023
26 tasks
@BSFishy BSFishy mentioned this pull request Oct 9, 2023
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.

[PROPOSAL] Replace sass-lint with stylelint
4 participants