Skip to content

Commit 6c13abe

Browse files
ashwin-pcTommy Markley
and
Tommy Markley
authored
Chore: Replaces sass-lint with stylelint (opensearch-project#1413)
* Replaces `sass-lint` with `stylelint` * Introduces standard scss rules from stylelint with only a few modifications. * `yarn lint` now runs `yarn lint:style` instead of `yarn lint:sass`. * Many of the files were updated with `yarn lint:style --fix`, but some of them had to be manually updated with overrides to adhere to the newly-introduced rules from the stylelint configuration. * Includes a couple fixes such as fixing the class selector for `osdnSuggestionItem--value .osdSuggestionItem__text`. Resolves opensearch-project#551 Resolves opensearch-project#1139 Resolves opensearch-project#1151 Resolves opensearch-project#1152 Resolves opensearch-project#1154 Signed-off-by: Tommy Markley <[email protected]> * fix(Style): Fixes flex style Signed-off-by: Ashwin Pc <[email protected]> * fix(lint): Fixes empty comment lint issue Signed-off-by: Ashwin Pc <[email protected]> * chore: rebase and updates yarn.lock Signed-off-by: Ashwin Pc <[email protected]> Co-authored-by: Tommy Markley <[email protected]>
1 parent 4c3f222 commit 6c13abe

File tree

240 files changed

+1400
-1552
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

240 files changed

+1400
-1552
lines changed

.prettierignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
# use stylelint
2+
*.scss

.sass-lint.yml

Lines changed: 0 additions & 84 deletions
This file was deleted.

.stylelintignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
build
2+
target

.stylelintrc.yml

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
extends:
2+
- stylelint-config-standard-scss
3+
rules:
4+
# while we still use node-sass, only legacy rgb() notation is allowed
5+
color-function-notation: "legacy"
6+
# recommended to turn off descending specificity since we use a lot of nesting:
7+
# https://stylelint.io/user-guide/rules/list/no-descending-specificity/
8+
no-descending-specificity: null
9+
# need to use global function/value names from EUI
10+
function-name-case: null
11+
value-keyword-case: null
12+
scss/no-global-function-names: null
13+
# camelCase names
14+
keyframes-name-pattern: "^[a-z][a-zA-Z0-9_-]+$"
15+
selector-class-pattern: "^[a-z][a-zA-Z0-9_-]+$"
16+
selector-id-pattern: "^[a-z][a-zA-Z0-9_-]+$"
17+
scss/at-mixin-pattern: "^[a-z][a-zA-Z0-9_-]+$"
18+
scss/at-function-pattern: "^[a-z][a-zA-Z0-9_-]+$"
19+
scss/dollar-variable-pattern: "^[a-z][a-zA-Z0-9_-]+$"
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
/* stylelint-disable no-empty-source */

package.json

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -58,9 +58,9 @@
5858
"start": "node scripts/opensearch_dashboards --dev",
5959
"debug": "node --nolazy --inspect scripts/opensearch_dashboards --dev",
6060
"debug-break": "node --nolazy --inspect-brk scripts/opensearch_dashboards --dev",
61-
"lint": "yarn run lint:es && yarn run lint:sass",
61+
"lint": "yarn run lint:es && yarn run lint:style",
6262
"lint:es": "node scripts/eslint",
63-
"lint:sass": "node scripts/sasslint",
63+
"lint:style": "node scripts/stylelint",
6464
"makelogs": "node scripts/makelogs",
6565
"uiFramework:start": "cd packages/osd-ui-framework && yarn docSiteStart",
6666
"uiFramework:build": "cd packages/osd-ui-framework && yarn docSiteBuild",
@@ -77,13 +77,10 @@
7777
"resolutions": {
7878
"**/@types/node": "^14.17.32",
7979
"**/ansi-regex": "^5.0.1",
80-
"**/front-matter": "^4.0.2",
8180
"**/glob-parent": "^6.0.0",
8281
"**/hoist-non-react-statics": "^3.3.2",
8382
"**/json-schema": "^0.4.0",
8483
"**/kind-of": ">=6.0.3",
85-
"**/merge": "^2.1.1",
86-
"**/minimist": "^1.2.5",
8784
"**/node-jose": "^2.1.0",
8885
"**/qs": "^6.10.3",
8986
"**/trim": "^0.0.3",
@@ -428,11 +425,12 @@
428425
"regenerate": "^1.4.0",
429426
"reselect": "^4.0.0",
430427
"resize-observer-polyfill": "^1.5.1",
431-
"sass-lint": "^1.12.1",
432428
"selenium-webdriver": "^4.0.0-alpha.7",
433429
"simple-git": "^3.4.0",
434430
"sinon": "^7.4.2",
435431
"strip-ansi": "^6.0.0",
432+
"stylelint": "^14.5.2",
433+
"stylelint-config-standard-scss": "^3.0.0",
436434
"supertest": "^6.2.2",
437435
"supertest-as-promised": "^4.0.2",
438436
"tape": "^5.0.1",

packages/osd-optimizer/src/__fixtures__/mock_repo/plugins/bar/public/legacy/styles.scss

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
@import "./other_styles.scss";
1+
@import "./other_styles";
22

33
body {
44
width: $globalStyleConstant;
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
/* stylelint-disable no-empty-source */

packages/osd-ui-framework/doc_site/src/components/guide/_guide.scss

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -64,25 +64,25 @@ html {
6464
background-color: $euiColorEmptyShade;
6565
}
6666

67-
.guideContentPage__hint {
68-
position: absolute;
69-
top: 0;
70-
left: 0;
71-
width: 100%;
72-
max-width: 260px;
73-
max-height: 500px;
74-
padding: 30px;
75-
margin: 20px;
76-
border-radius: 4px;
77-
background-color: $euiColorLightestShade;
78-
line-height: $guideLineHeight;
79-
}
67+
.guideContentPage__hint {
68+
position: absolute;
69+
top: 0;
70+
left: 0;
71+
width: 100%;
72+
max-width: 260px;
73+
max-height: 500px;
74+
padding: 30px;
75+
margin: 20px;
76+
border-radius: 4px;
77+
background-color: $euiColorLightestShade;
78+
line-height: $guideLineHeight;
79+
}
8080

81-
.guideContentPage__content {
82-
width: 100%;
83-
max-width: 800px;
84-
padding: 30px 60px;
85-
}
81+
.guideContentPage__content {
82+
width: 100%;
83+
max-width: 800px;
84+
padding: 30px 60px;
85+
}
8686

8787
.guideHintArrow {
8888
position: absolute;
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
.guideCode {
22
padding: 2px 4px;
3-
font-family: 'Ubuntu Mono', monospace;
3+
font-family: "Ubuntu Mono", monospace;
44
background-color: $euiColorLightestShade;
55
color: $euiColorDarkShade;
66
}

packages/osd-ui-framework/doc_site/src/components/guide_code_viewer/_guide_code_viewer.scss

Lines changed: 30 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -22,39 +22,39 @@
2222
}
2323
}
2424

25-
.guideCodeViewer__header {
26-
padding: 0 20px 6px;
27-
line-height: $guideLineHeight;
28-
border-bottom: $euiBorderThin;
29-
font-size: 14px;
30-
font-weight: 700;
31-
margin-bottom: 10px;
32-
}
25+
.guideCodeViewer__header {
26+
padding: 0 20px 6px;
27+
line-height: $guideLineHeight;
28+
border-bottom: $euiBorderThin;
29+
font-size: 14px;
30+
font-weight: 700;
31+
margin-bottom: 10px;
32+
}
3333

34-
.guideCodeViewer__closeButton {
35-
position: absolute;
36-
top: 0;
37-
right: 10px;
38-
cursor: pointer;
39-
padding: 10px;
40-
border-radius: 3px;
41-
color: $guideTextColor;
42-
43-
&:hover {
44-
color: $guideLinkHoverColor;
45-
}
34+
.guideCodeViewer__closeButton {
35+
position: absolute;
36+
top: 0;
37+
right: 10px;
38+
cursor: pointer;
39+
padding: 10px;
40+
border-radius: 3px;
41+
color: $guideTextColor;
42+
43+
&:hover {
44+
color: $guideLinkHoverColor;
4645
}
46+
}
4747

48-
.guideCodeViewer__title {
49-
padding: 0 20px 6px;
50-
border-bottom: $euiBorderThin;
51-
line-height: $guideLineHeight;
52-
font-size: 14px;
53-
}
48+
.guideCodeViewer__title {
49+
padding: 0 20px 6px;
50+
border-bottom: $euiBorderThin;
51+
line-height: $guideLineHeight;
52+
font-size: 14px;
53+
}
5454

55-
.guideCodeViewer__content {
56-
margin: 0 0 16px;
57-
}
55+
.guideCodeViewer__content {
56+
margin: 0 0 16px;
57+
}
5858

5959
// HLJS
6060

@@ -64,7 +64,7 @@
6464
color: $euiColorDarkShade;
6565
font-size: 14px;
6666
line-height: 1.3;
67-
font-family: 'Ubuntu Mono', monospace;
67+
font-family: "Ubuntu Mono", monospace;
6868
}
6969

7070
.hljs-keyword {

packages/osd-ui-framework/doc_site/src/components/guide_components.scss

Lines changed: 12 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,15 @@
1+
@import "guide/guide";
2+
@import "guide_code/guide_code";
3+
@import "guide_code_viewer/guide_code_viewer";
4+
@import "guide_demo/guide_demo";
5+
@import "guide_link/guide_link";
6+
@import "guide_nav/guide_nav";
7+
@import "guide_page/guide_page";
8+
@import "guide_page_side_nav/guide_page_side_nav";
9+
@import "guide_sandbox/guide_sandbox";
10+
@import "guide_section/guide_section";
11+
@import "guide_text/guide_text";
12+
113
$guideVerticalRhythm: $euiSize;
214
$guideLineHeight: $euiSizeL;
315
$guideNavHeight: 60px;
@@ -47,16 +59,3 @@ $guideNormalBreakpoint: 1900px;
4759
background-color: transparent;
4860
}
4961
}
50-
51-
52-
@import "guide/guide";
53-
@import "guide_code/guide_code";
54-
@import "guide_code_viewer/guide_code_viewer";
55-
@import "guide_demo/guide_demo";
56-
@import "guide_link/guide_link";
57-
@import "guide_nav/guide_nav";
58-
@import "guide_page/guide_page";
59-
@import "guide_page_side_nav/guide_page_side_nav";
60-
@import "guide_sandbox/guide_sandbox";
61-
@import "guide_section/guide_section";
62-
@import "guide_text/guide_text";

packages/osd-ui-framework/doc_site/src/components/guide_demo/_guide_demo.scss

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,14 +10,14 @@
1010

1111
.guideDemo__highlightGrid {
1212
.kuiFlexItem {
13-
background: transparentize($euiColorPrimary, .9);
13+
background: transparentize($euiColorPrimary, 0.9);
1414
padding: 16px;
1515
}
1616
}
1717

1818
.guideDemo__highlightGridWrap {
1919
.kuiFlexItem div {
20-
background: transparentize($euiColorPrimary, .9);
20+
background: transparentize($euiColorPrimary, 0.9);
2121
padding: 16px;
2222
}
2323
}

0 commit comments

Comments
 (0)