Skip to content

Commit 9d473fb

Browse files
authored
Resolve duplicate CSS selectors reported by Stylelint (Stirling-Tools#7212)
Fixes Stirling-Tools#7189 Consolidates all 29 `no-duplicate-selectors` violations across 18 stylesheets by merging later duplicate rule blocks into the first occurrence. Where duplicates had conflicting values, the cascade-winning (later) value was kept, so computed styles are unchanged. Also: - Adds `frontend/stylelint.config.mjs` with only `no-duplicate-selectors` enabled (Prettier and the theme linter own everything else). - Adds a `frontend:lint:css` task, wired into `task frontend:lint` as a blocking check so regressions can't creep back in. - Lints all first-party CSS (`editor/**/*.css`, so `public/css` and any future non-`src` stylesheets are covered too), excluding only the vendored `cookieconsent.css` and build output via `ignoreFiles`. This surfaced and fixed 5 additional duplicate selectors in `cookieconsentCustomisation.css` that weren't in the original issue report. Note: `portal/views/Sources.css` goes beyond dedup — the whole `.portal-sources__connections*` block is deleted as dead code (unreferenced since the S3 connections redesign in Stirling-Tools#6965; only `-actions` in it was an actual duplicate). 🤖 Generated with [Claude Code](https://claude.ai/code)
1 parent 041b6a4 commit 9d473fb

22 files changed

Lines changed: 1163 additions & 415 deletions

File tree

.taskfiles/frontend.yml

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -263,6 +263,16 @@ tasks:
263263
- task: lint:eslint
264264
- task: lint:dpdm
265265
- task: lint:colors
266+
- task: lint:css
267+
268+
lint:css:
269+
desc: "Lint stylesheets for duplicate selectors"
270+
deps: [install]
271+
cmds:
272+
# Covers the whole editor tree, including the portal/processor layer and
273+
# public/css. Vendored CSS and build output are excluded via ignoreFiles
274+
# in stylelint.config.mjs.
275+
- npx stylelint "editor/**/*.css"
266276

267277
lint:colors:
268278
desc: "Enforce theme tokens — no hardcoded colours or raw primitives in components"

frontend/editor/public/css/cookieconsentCustomisation.css

Lines changed: 19 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -130,37 +130,47 @@
130130
opacity: 0 !important; /* Keep invisible but functional */
131131
}
132132

133+
/* Track: flat fill in both themes, no outline ring or border */
133134
#cc-main .toggle__icon {
134135
display: flex !important;
135136
align-items: center !important;
136137
justify-content: flex-start !important;
138+
background: var(--cc-toggle-off-bg) !important;
139+
border: none !important;
140+
box-shadow: none !important;
141+
transition: background-color 150ms ease !important;
137142
}
138143

144+
/* Thumb: small plain circle, vertically centred, no drop shadow */
139145
#cc-main .toggle__icon-circle {
140146
display: block !important;
141147
position: absolute !important;
142-
transition: transform 0.25s ease !important;
148+
width: 14px !important;
149+
height: 14px !important;
150+
top: 3px !important;
151+
left: 2.5px !important;
152+
box-shadow: none !important;
153+
transition:
154+
transform 150ms ease,
155+
background-color 150ms ease !important;
143156
}
144157

158+
/* Mantine switches have no check/cross glyph inside the thumb */
145159
#cc-main .toggle__icon-on,
146160
#cc-main .toggle__icon-off {
147-
display: flex !important;
161+
display: none !important;
148162
align-items: center !important;
149163
justify-content: center !important;
150164
position: absolute !important;
151165
width: 100% !important;
152166
height: 100% !important;
153167
}
154168

155-
/* Ensure toggles are visible in both themes */
156-
#cc-main .toggle__icon {
157-
background: var(--cc-toggle-off-bg) !important;
158-
border: 1px solid var(--cc-toggle-off-bg) !important;
159-
}
160-
169+
/* Checked track visible in both themes, same flat Mantine look */
161170
#cc-main .section__toggle:checked ~ .toggle__icon {
162171
background: var(--cc-toggle-on-bg) !important;
163-
border: 1px solid var(--cc-toggle-on-bg) !important;
172+
border: none !important;
173+
box-shadow: none !important;
164174
}
165175

166176
/* Ensure toggle text is visible */
@@ -226,18 +236,6 @@
226236
border-radius: 1000px !important;
227237
}
228238

229-
/* Track: flat fill, no outline ring or border */
230-
#cc-main .toggle__icon {
231-
border: none !important;
232-
box-shadow: none !important;
233-
transition: background-color 150ms ease !important;
234-
}
235-
236-
#cc-main .section__toggle:checked ~ .toggle__icon {
237-
border: none !important;
238-
box-shadow: none !important;
239-
}
240-
241239
/* Always-enabled categories = Mantine disabled switch (must out-prioritise
242240
the !important checked-track rule above) */
243241
#cc-main .section__toggle:checked:disabled ~ .toggle__icon {
@@ -250,25 +248,7 @@
250248
cursor: not-allowed !important;
251249
}
252250

253-
/* Thumb: small plain circle, vertically centred, no drop shadow */
254-
#cc-main .toggle__icon-circle {
255-
width: 14px !important;
256-
height: 14px !important;
257-
top: 3px !important;
258-
left: 2.5px !important;
259-
box-shadow: none !important;
260-
transition:
261-
transform 150ms ease,
262-
background-color 150ms ease !important;
263-
}
264-
265251
/* Checked thumb travel: 38 − 14 − 2.5 = 21.5px end position */
266252
#cc-main .section__toggle:checked ~ .toggle__icon .toggle__icon-circle {
267253
transform: translateX(19px) !important;
268254
}
269-
270-
/* Mantine switches have no check/cross glyph inside the thumb */
271-
#cc-main .toggle__icon-on,
272-
#cc-main .toggle__icon-off {
273-
display: none !important;
274-
}

frontend/editor/src/core/components/fileEditor/FileEditor.module.css

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -320,11 +320,6 @@
320320
color: var(--c-text-muted); /* subtitle text */
321321
}
322322

323-
/* Light mode selected header stroke override */
324-
:global([data-mantine-color-scheme="light"]) .card[data-selected="true"] {
325-
outline-color: var(--c-primary);
326-
}
327-
328323
/* =========================
329324
Add File Card Styles
330325
========================= */

frontend/editor/src/core/components/filesPage/FilesPage.css

Lines changed: 5 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -156,6 +156,11 @@
156156
flex-shrink: 0;
157157
flex-wrap: wrap;
158158
min-height: 3rem;
159+
/* Safety net - the content should always fit thanks to the shrink rules on
160+
`.files-page-toolbar-actions` below, but if a future addition ever breaks
161+
that, this stops the action group bleeding into sibling areas (notably the
162+
details panel on the right). */
163+
overflow-x: hidden;
159164
}
160165

161166
.files-page-toolbar-info {
@@ -210,13 +215,6 @@
210215
.files-page-toolbar-actions .mantine-SegmentedControl-root {
211216
flex-shrink: 0;
212217
}
213-
/* Clip overflow on the toolbar itself as a safety net - the content
214-
should always fit thanks to the rules above, but if a future addition
215-
ever breaks that, this prevents the action group from bleeding into
216-
sibling areas (notably the details panel on the right). */
217-
.files-page-toolbar {
218-
overflow-x: hidden;
219-
}
220218

221219
.files-page-toolbar-divider {
222220
width: 1px;
@@ -1319,9 +1317,6 @@
13191317
gap: 0.3rem;
13201318
flex-wrap: nowrap;
13211319
}
1322-
.files-page-search {
1323-
flex: 1 1 100%;
1324-
}
13251320
.files-page-breadcrumbs {
13261321
font-size: 0.85rem;
13271322
flex-wrap: nowrap;

frontend/editor/src/core/components/shared/FileSidebar.css

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -447,19 +447,14 @@
447447
}
448448

449449
.file-sidebar-section-header {
450+
position: relative;
450451
display: flex;
451452
align-items: center;
452453
justify-content: space-between;
453454
gap: 8px;
454-
padding: 12px 14px 6px 14px;
455+
padding: 10px 14px 6px 14px;
455456
margin: 4px 0 0 0;
456-
}
457-
458-
.file-sidebar-section-header {
459-
position: relative;
460457
border-top: 1px solid var(--c-border-subtle);
461-
padding-top: 10px;
462-
margin-top: 4px;
463458
flex-shrink: 0;
464459
}
465460

frontend/editor/src/core/components/shared/FileSidebarFileItem.css

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -56,12 +56,6 @@
5656
pointer-events: auto;
5757
}
5858

59-
/* Always reserve space for action buttons so file name truncation dots (...)
60-
never bleed under action buttons or overlap their outline/focus box. */
61-
.file-sidebar-file-info {
62-
padding-right: 3.75rem;
63-
}
64-
6559
.file-sidebar-file-item:hover:not(.selected) {
6660
background-color: color-mix(in srgb, var(--c-primary) 6%, transparent);
6761
}
@@ -173,6 +167,9 @@
173167
.file-sidebar-file-info {
174168
flex: 1;
175169
min-width: 0;
170+
/* Always reserve space for action buttons so file name truncation dots (...)
171+
never bleed under action buttons or overlap their outline/focus box. */
172+
padding-right: 3.75rem;
176173
}
177174

178175
.file-sidebar-file-name {

0 commit comments

Comments
 (0)