Skip to content

Commit f484bda

Browse files
authored
feat(mono): Support auto-sorting properties in css files (#18937)
Closes AUTH-2109 Sort CSS properties in CSS files by smacss convention and enforce that sorting with lint. Like the import order sorting, this should be relatively hands off and work on-save in most IDEs, however there is a new format-css makefile command that will sort CSS files according to the plugin rules.
1 parent 042f030 commit f484bda

File tree

56 files changed

+884
-860
lines changed

Some content is hidden

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

56 files changed

+884
-860
lines changed

.stylelintrc.js

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,5 @@
11
module.exports = {
2-
processors: [
3-
[
4-
'stylelint-processor-styled-components',
5-
{
6-
ignoreFiles: ['**/*.css'],
7-
},
8-
],
9-
],
10-
11-
extends: ['stylelint-config-standard', 'stylelint-config-styled-components'],
2+
extends: ['stylelint-config-standard', 'stylelint-config-idiomatic-order'],
123

134
ignoreFiles: [
145
'api/**',

Makefile

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -215,7 +215,7 @@ test-js: test-js-internal
215215

216216
# lints and typechecks
217217
.PHONY: lint
218-
lint: lint-py lint-js lint-json lint-css check-js circular-dependencies-js
218+
lint: lint-py lint-js lint-json lint-css check-js check-css circular-dependencies-js
219219

220220
PYTHON_LINT_TARGETS = $(addsuffix -py-lint, $(PYTHON_DIRS))
221221

@@ -246,7 +246,7 @@ lint-css:
246246
yarn stylelint "**/*.css" "**/*.js"
247247

248248
.PHONY: format
249-
format: format-js format-py
249+
format: format-js format-py format-css
250250

251251
PYTHON_FORMAT_TARGETS := $(addsuffix -py-format, $(PYTHON_DIRS))
252252

@@ -260,6 +260,10 @@ format-py: $(PYTHON_FORMAT_TARGETS)
260260
format-js:
261261
yarn prettier --ignore-path .eslintignore --write $(FORMAT_FILE_GLOB)
262262

263+
.PHONY: format-css
264+
format-css:
265+
yarn stylelint "**/*.css" --fix
266+
263267
.PHONY: check-js
264268
check-js: build-ts
265269

app/src/atoms/SoftwareKeyboard/AlphanumericKeyboard/index.css

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -10,26 +10,26 @@
1010
.simple-keyboard.oddTheme1.hg-theme-default .hg-layout-default {
1111
width: 100%;
1212
height: 100%;
13+
padding: 8px;
1314
background-color: #cbcccc; /* grey35 */
1415
font-family: 'Public Sans', sans-serif;
15-
padding: 8px;
1616
}
1717

1818
.hg-layout-default .hg-row .hg-button,
1919
.hg-layout-shift .hg-row .hg-button,
2020
.hg-layout-numbers .hg-row .hg-button {
21+
padding: 10px 22px;
22+
background-color: #fff;
2123
color: #16212d;
2224
font-size: 20px;
2325
font-style: normal;
2426
font-weight: 600;
2527
line-height: 24px;
26-
background-color: #ffffff;
27-
padding: 10px 22px;
2828
}
2929

3030
.simple-keyboard .hg-button:active {
31-
color: #16212d;
3231
background-color: #dedede; /* grey30 */
32+
color: #16212d;
3333
}
3434

3535
.alphanumericKeyboard .hg-button {
@@ -41,6 +41,7 @@
4141
.hg-layout-shift .hg-row:not(:last-child) {
4242
grid-column: 8px;
4343
}
44+
4445
.hg-row:not(:last-child) .hg-button {
4546
width: 94px;
4647
}
@@ -53,10 +54,12 @@ the rest is the same */
5354
/* adding 3px because package's css add margin-right:5px */
5455
grid-gap: 3px;
5556
}
57+
5658
.hg-layout-default .hg-row:last-child .hg-button,
5759
.hg-layout-shift .hg-row:last-child .hg-button {
5860
width: 97px;
5961
}
62+
6063
.hg-layout-default .hg-row:last-child .hg-button:first-child,
6164
.hg-layout-default .hg-row:last-child .hg-button:last-child,
6265
.hg-layout-shift .hg-row:last-child .hg-button:first-child,
@@ -65,15 +68,15 @@ the rest is the same */
6568
}
6669

6770
.hg-layout-numbers .hg-row .hg-button {
68-
height: 44.75px;
6971
width: 330px !important;
72+
height: 44.75px;
7073
}
7174

7275
.hg-candidate-box {
7376
max-width: 400px;
7477
}
7578

7679
li.hg-candidate-box-list-item {
77-
height: 60px;
7880
width: 60px;
81+
height: 60px;
7982
}

app/src/atoms/SoftwareKeyboard/FullKeyboard/index.css

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,9 @@
1111
.simple-keyboard.oddTheme1.hg-theme-default {
1212
width: 100%;
1313
height: 100%;
14+
padding: 8px;
1415
background-color: #cbcccc; /* grey35 */
1516
font-family: 'Public Sans', sans-serif;
16-
padding: 8px;
1717
}
1818

1919
.hg-layout-default .hg-row,
@@ -29,21 +29,21 @@
2929
}
3030

3131
.simple-keyboard .hg-button:active {
32-
color: #16212d;
3332
background-color: #dedede;
33+
color: #16212d;
3434
}
3535

3636
.hg-layout-default .hg-row .hg-button,
3737
.hg-layout-shift .hg-row .hg-button,
3838
.hg-layout-symbols .hg-row .hg-button,
3939
.hg-layout-numbers .hg-row .hg-button {
40+
padding: 10px 22px;
41+
background-color: #fff;
4042
color: #16212d;
4143
font-size: 20px;
4244
font-style: normal;
4345
font-weight: 600;
4446
line-height: 24px;
45-
background-color: #ffffff;
46-
padding: 10px 22px;
4747
}
4848

4949
.hg-layout-default .hg-row:nth-child(1) .hg-button,
@@ -100,15 +100,15 @@
100100
}
101101

102102
.simple-keyboard .hg-button:active {
103-
color: #16212d;
104103
background-color: #e3e3e3; /* grey30 */
104+
color: #16212d;
105105
}
106106

107107
.hg-candidate-box {
108108
max-width: 400px;
109109
}
110110

111111
li.hg-candidate-box-list-item {
112-
height: 60px;
113112
width: 60px;
113+
height: 60px;
114114
}
Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,13 @@
11
/* stylelint-disable */
22

33
.simple-keyboard .hg-button {
4-
text-align: center;
54
font-size: 20px;
65
font-weight: 600;
76
line-height: 24px;
7+
text-align: center;
88
}
9+
910
.simple-keyboard .hg-button:active {
10-
color: #16212d;
1111
background-color: #dedede; /* grey30 */
12+
color: #16212d;
1213
}

app/src/atoms/SoftwareKeyboard/NumericalKeyboard/index.css

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,10 @@
1010
.simple-keyboard.oddTheme1.hg-theme-default {
1111
width: 100%;
1212
height: 100%;
13+
padding: 8px;
1314
border-radius: 0;
1415
background-color: #cbcccc; /* grey35 */
1516
font-family: 'Public Sans', sans-serif;
16-
padding: 8px;
1717
}
1818

1919
.hg-layout-intKeyboard .hg-row,
@@ -25,12 +25,12 @@
2525

2626
/* ToDo (kk:04/04/2024) this important will be removed when I refactor the entire css */
2727
.numerical-keyboard .hg-row .hg-button {
28-
text-align: center;
28+
height: 75px !important;
29+
padding: 10px 22px;
2930
font-size: 20px;
3031
font-weight: 600;
3132
line-height: 24px;
32-
height: 75px !important;
33-
padding: 10px 22px;
33+
text-align: center;
3434
}
3535

3636
.hg-layout-intKeyboard .hg-row:nth-child(-n + 3) .hg-button,
@@ -50,6 +50,6 @@
5050
}
5151

5252
.simple-keyboard .hg-button:active {
53-
color: #16212d;
5453
background-color: #dedede; /* grey30 */
54+
color: #16212d;
5555
}

app/src/atoms/SoftwareKeyboard/index.css

Lines changed: 33 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,24 @@
11
/* stylelint-disable */
22

33
.hg-theme-default {
4-
background-color: #ececec;
5-
border-radius: 5px;
6-
box-sizing: border-box;
7-
font-family: HelveticaNeue-Light, Helvetica Neue Light, Helvetica Neue,
8-
Helvetica, Arial, Lucida Grande, sans-serif;
94
overflow: hidden;
5+
width: 100%;
6+
box-sizing: border-box;
107
padding: 5px;
8+
border-radius: 5px;
9+
background-color: #ececec;
10+
font-family:
11+
HelveticaNeue-Light,
12+
Helvetica Neue Light,
13+
Helvetica Neue,
14+
Helvetica,
15+
Arial,
16+
Lucida Grande,
17+
sans-serif;
1118
touch-action: manipulation;
1219
-webkit-user-select: none;
1320
-moz-user-select: none;
1421
user-select: none;
15-
width: 100%;
1622
}
1723

1824
.hg-theme-default .hg-button span {
@@ -52,16 +58,16 @@
5258
}
5359

5460
.hg-theme-default .hg-button {
61+
display: flex;
62+
box-sizing: border-box;
5563
align-items: center;
56-
background: #fff;
57-
border-bottom: 1px solid #b5b5b5;
64+
justify-content: center;
65+
padding: 5px;
5866
border-radius: 5px;
67+
border-bottom: 1px solid #b5b5b5;
68+
background: #fff;
5969
box-shadow: 0 0 3px -1px rgba(0, 0, 0, 0.3);
60-
box-sizing: border-box;
6170
cursor: pointer;
62-
display: flex;
63-
justify-content: center;
64-
padding: 5px;
6571
-webkit-tap-highlight-color: rgba(0, 0, 0, 0);
6672
}
6773

@@ -74,11 +80,11 @@
7480
}
7581

7682
.hg-theme-default.hg-layout-numeric .hg-button {
77-
align-items: center;
7883
display: flex;
84+
width: 33.3%;
7985
height: 60px;
86+
align-items: center;
8087
justify-content: center;
81-
width: 33.3%;
8288
}
8389

8490
.hg-theme-default .hg-button.hg-button-com {
@@ -103,13 +109,13 @@
103109
}
104110

105111
.hg-candidate-box {
106-
background: #ececec;
107-
border-bottom: 2px solid #b5b5b5;
108-
border-radius: 5px;
112+
position: absolute;
109113
display: inline-flex;
110-
margin-top: -10px;
111114
max-width: 272px;
112-
position: absolute;
115+
border-radius: 5px;
116+
border-bottom: 2px solid #b5b5b5;
117+
margin-top: -10px;
118+
background: #ececec;
113119
transform: translateY(-100%);
114120
-webkit-user-select: none;
115121
-moz-user-select: none;
@@ -119,17 +125,17 @@
119125
ul.hg-candidate-box-list {
120126
display: flex;
121127
flex: 1;
122-
list-style: none;
123-
margin: 0;
124128
padding: 0;
129+
margin: 0;
130+
list-style: none;
125131
}
126132

127133
li.hg-candidate-box-list-item {
128-
align-items: center;
129134
display: flex;
135+
width: 40px;
130136
height: 40px;
137+
align-items: center;
131138
justify-content: center;
132-
width: 40px;
133139
}
134140

135141
li.hg-candidate-box-list-item:hover {
@@ -141,21 +147,21 @@ li.hg-candidate-box-list-item:active {
141147
background: rgba(0, 0, 0, 0.1);
142148
}
143149

144-
.hg-candidate-box-prev:before {
150+
.hg-candidate-box-prev::before {
145151
content: '◄';
146152
}
147153

148-
.hg-candidate-box-next:before {
154+
.hg-candidate-box-next::before {
149155
content: '►';
150156
}
151157

152158
.hg-candidate-box-next,
153159
.hg-candidate-box-prev {
160+
display: flex;
154161
align-items: center;
162+
padding: 0 10px;
155163
color: #969696;
156164
cursor: pointer;
157-
display: flex;
158-
padding: 0 10px;
159165
}
160166

161167
.hg-candidate-box-next {

0 commit comments

Comments
 (0)