Skip to content

Commit f1b83dd

Browse files
nadalabaMiodec
authored andcommitted
chore: add stylelint linter for css/scss (@nadalaba) (monkeytypegame#7718)
supersedes monkeytypegame#7716 --------- Co-authored-by: Jack <jack@monkeytype.com>
1 parent 3907b79 commit f1b83dd

39 files changed

Lines changed: 876 additions & 222 deletions

.github/workflows/monkey-ci.yml

Lines changed: 15 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ jobs:
2828
should-build-be: ${{ steps.export-changes.outputs.should-build-be }}
2929
should-build-fe: ${{ steps.export-changes.outputs.should-build-fe }}
3030
should-build-pkg: ${{ steps.export-changes.outputs.should-build-pkg }}
31-
assets-json: ${{ steps.export-changes.outputs.assets-json }}
31+
assets-or-styles: ${{ steps.export-changes.outputs.assets-or-styles }}
3232

3333
steps:
3434
- name: Full checkout
@@ -41,8 +41,9 @@ jobs:
4141
id: filter
4242
with:
4343
filters: |
44-
json:
44+
assets-or-styles:
4545
- 'frontend/static/**/*'
46+
- '**/*.{scss,css}'
4647
be-src:
4748
- 'backend/**/*.{ts,js,json,lua,css,html}'
4849
- 'backend/package.json'
@@ -64,13 +65,13 @@ jobs:
6465
echo "should-build-pkg=${{ steps.filter.outputs.pkg-src }}" >> $GITHUB_OUTPUT
6566
echo "should-build-be=${{ steps.filter.outputs.be-src }}" >> $GITHUB_OUTPUT
6667
echo "should-build-fe=${{ steps.filter.outputs.fe-src }}" >> $GITHUB_OUTPUT
67-
echo "assets-json=${{ steps.filter.outputs.json }}" >> $GITHUB_OUTPUT
68+
echo "assets-or-styles=${{ steps.filter.outputs.assets-or-styles }}" >> $GITHUB_OUTPUT
6869
6970
prime-cache:
7071
name: prime-cache
7172
runs-on: ubuntu-latest
7273
needs: [pre-ci]
73-
if: needs.pre-ci.outputs.should-build-be == 'true' || needs.pre-ci.outputs.should-build-fe == 'true' || needs.pre-ci.outputs.should-build-pkg == 'true' || needs.pre-ci.outputs.assets-json == 'true' || contains(github.event.pull_request.labels.*.name, 'force-full-ci')
74+
if: needs.pre-ci.outputs.should-build-be == 'true' || needs.pre-ci.outputs.should-build-fe == 'true' || needs.pre-ci.outputs.should-build-pkg == 'true' || needs.pre-ci.outputs.assets-or-styles == 'true' || contains(github.event.pull_request.labels.*.name, 'force-full-ci')
7475
steps:
7576
- name: Checkout pnpm-lock
7677
uses: actions/checkout@v4
@@ -216,7 +217,7 @@ jobs:
216217
name: ci-assets
217218
needs: [pre-ci, prime-cache]
218219
runs-on: ubuntu-latest
219-
if: needs.pre-ci.outputs.assets-json == 'true' || contains(github.event.pull_request.labels.*.name, 'force-full-ci')
220+
if: needs.pre-ci.outputs.assets-or-styles == 'true' || contains(github.event.pull_request.labels.*.name, 'force-full-ci')
220221
steps:
221222
- uses: actions/checkout@v4
222223
with:
@@ -228,6 +229,10 @@ jobs:
228229
id: filter
229230
with:
230231
filters: |
232+
styles:
233+
- '**/*.{scss,css}'
234+
json:
235+
- 'frontend/static/**/*.json'
231236
languages:
232237
- 'frontend/static/languages/**'
233238
quotes:
@@ -265,7 +270,12 @@ jobs:
265270
- name: Install dependencies
266271
run: pnpm install
267272

273+
- name: Lint styles
274+
if: steps.filter.outputs.styles == 'true'
275+
run: npm run lint-styles
276+
268277
- name: Lint JSON
278+
if: steps.filter.outputs.json == 'true'
269279
run: npm run lint-json-assets
270280

271281
- name: Validate language assets

backend/private/style.css

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ body {
8181
bottom: 3rem;
8282
background-color: var(--sub-alt-color);
8383
color: var(--text-color);
84-
font-style: bold;
84+
font-weight: bold;
8585
border-radius: 3px;
8686
padding: 1rem 2rem;
8787
cursor: pointer;
@@ -189,10 +189,6 @@ input[type="checkbox"] {
189189
}
190190
}
191191

192-
.tooltip:hover .tooltip-text {
193-
display: block;
194-
}
195-
196192
.tooltip-text {
197193
display: none;
198194
color: var(--text-color);
@@ -202,3 +198,7 @@ input[type="checkbox"] {
202198
padding: 10px;
203199
border-radius: var(--roundness);
204200
}
201+
202+
.tooltip:hover .tooltip-text {
203+
display: block;
204+
}

frontend/package.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@
66
"scripts": {
77
"lint": "oxlint . --type-aware --type-check",
88
"lint-fast": "oxlint .",
9+
"lint-styles": "stylelint \"**/*.{scss,css}\"",
10+
"lint-styles-fix": "stylelint \"**/*.{scss,css}\" --fix",
911
"lint-json": "eslint static/**/*.json",
1012
"check-assets": "tsx ./scripts/check-assets.ts",
1113
"audit": "vite-bundle-visualizer",

frontend/src/styles/account-settings.scss

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -141,7 +141,6 @@
141141
td {
142142
padding: 0.5rem;
143143
background: var(--bg-color);
144-
position: -webkit-sticky;
145144
position: sticky;
146145
top: 0;
147146
z-index: 99;
@@ -159,7 +158,6 @@
159158
tfoot {
160159
td {
161160
padding: 1rem 0.5rem;
162-
position: -webkit-sticky;
163161
position: sticky;
164162
bottom: -5px;
165163
background: var(--bg-color);

frontend/src/styles/account.scss

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -152,7 +152,7 @@
152152

153153
&.history {
154154
table td {
155-
-webkit-appearance: unset;
155+
appearance: unset;
156156
}
157157

158158
table tr {
@@ -170,10 +170,8 @@
170170
padding: 0.5rem;
171171
border-radius: var(--roundness);
172172
cursor: pointer;
173-
-webkit-transition: 0.25s;
174173
transition: 0.25s;
175-
-webkit-user-select: none;
176-
display: -ms-grid;
174+
user-select: none;
177175
display: grid;
178176
-ms-flex-line-pack: center;
179177
align-content: center;

frontend/src/styles/buttons.scss

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,6 @@ button,
2727
input[type="button"],
2828
input[type="reset"],
2929
input[type="submit"] {
30-
text-align: center;
3130
color: var(--text-color);
3231
cursor: pointer;
3332
transition:
@@ -38,11 +37,9 @@ input[type="submit"] {
3837
border-radius: var(--roundness);
3938
background: var(--sub-alt-color);
4039
text-align: center;
41-
-webkit-user-select: none;
4240
user-select: none;
4341
align-content: center;
4442
align-items: center;
45-
height: -moz-min-content;
4643
height: min-content;
4744
line-height: 1.25;
4845
appearance: none;
@@ -115,10 +112,8 @@ button.text,
115112
border-radius: var(--roundness);
116113
background: none;
117114
text-align: center;
118-
-webkit-user-select: none;
119115
user-select: none;
120116
align-content: center;
121-
height: -moz-min-content;
122117
height: min-content;
123118
line-height: 1.25;
124119
appearance: none;

frontend/src/styles/caret.scss

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,6 @@
6565

6666
&.block {
6767
width: 0.5em;
68-
border-radius: 0;
6968
z-index: -1;
7069
border-radius: 0.05em;
7170
}

frontend/src/styles/commandline.scss

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -60,13 +60,11 @@
6060
}
6161

6262
.suggestions {
63-
display: block;
6463
@extend .ffscroll;
6564
overflow-y: scroll;
6665
max-height: calc(100vh - 12rem - 3rem);
6766
display: grid;
6867
cursor: pointer;
69-
-webkit-user-select: none;
7068
user-select: none;
7169

7270
.command {

frontend/src/styles/core.scss

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -292,7 +292,6 @@ kbd {
292292
grid-column: 1/2;
293293
grid-row: 1/2;
294294
place-self: center center;
295-
display: grid;
296295
place-content: center center;
297296
overflow: hidden;
298297
display: inline-block;
@@ -321,7 +320,6 @@ kbd {
321320
color: var(--text-color);
322321
border-radius: calc(var(--roundness) / 2);
323322
// padding: 0.15em 0.5em;
324-
-webkit-user-select: none;
325323
user-select: none;
326324
display: grid;
327325
grid-template-columns: max-content auto;
@@ -375,7 +373,7 @@ kbd {
375373
}
376374

377375
// mouseover texts
378-
[aria-label][data-balloon-pos]:after {
376+
[aria-label][data-balloon-pos]::after {
379377
font-family: var(--font);
380378
font-size: var(--balloon-font-size);
381379
line-height: var(--balloon-font-size);
@@ -401,7 +399,6 @@ table {
401399
z-index: 0;
402400
td.sortable:hover {
403401
cursor: pointer;
404-
-webkit-user-select: none;
405402
user-select: none;
406403
background-color: var(--sub-alt-color);
407404
}

frontend/src/styles/fontawesome-5.scss

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
@import "@fortawesome/fontawesome-free/scss/_mixins.scss";
33
@import "@fortawesome/fontawesome-free/scss/_core.scss";
44

5-
/** fixed-with **/
5+
/** fixed-width **/
66
@import "@fortawesome/fontawesome-free/scss/_fixed-width.scss"; //fa-fw
77
/** animated **/
88
@import "@fortawesome/fontawesome-free/scss/_animated.scss"; //fa-spin

0 commit comments

Comments
 (0)