Skip to content

Evenfire is an intelligence layer platform for running LLM agents that take real actions, on your infrastructure

TypeScript

test(frontend): guard viewport ownership in app styles

Josué79f06f722c76
diff --git a/scripts/style-rules/rules.mjs b/scripts/style-rules/rules.mjs
index 54a33d818..1bacbd2ee 100644
--- a/scripts/style-rules/rules.mjs
+++ b/scripts/style-rules/rules.mjs
@@ -21,6 +21,7 @@ const MOTIONLESS_HOVER_PROPS = new Set(['filter', 'transform'])
const DESKTOP_UI_PREFIX = 'desktop-app/ui/'
const WEB_APP_PREFIXES = ['control-ui/', 'profile-ui/']
const WEB_APP_SOURCE_EXTENSIONS = ['.js', '.jsx', '.ts', '.tsx']
+const WEB_APP_STYLE_EXTENSIONS = ['.css']
const WEB_APP_NON_PRODUCTION_SEGMENTS = [
'/__tests__/',
'/e2e/',
@@ -106,6 +107,12 @@ function isWebProductionSource(file) {
return !WEB_APP_NON_PRODUCTION_SEGMENTS.some(segment => file.includes(segment))
}
+function isWebProductionStyle(file) {
+ if (!WEB_APP_PREFIXES.some(prefix => file.startsWith(prefix))) return false
+ if (!WEB_APP_STYLE_EXTENSIONS.some(extension => file.endsWith(extension))) return false
+ return !WEB_APP_NON_PRODUCTION_SEGMENTS.some(segment => file.includes(segment))
+}
+
function collectHoverMotionViolations(line, lineNumber) {
const violations = []
for (const declarationText of line.split(';')) {
@@ -151,7 +158,7 @@ export const rules = [
description:
'Control UI and Profile UI production views must render standardized table viewports through TableViewport.',
applies(file) {
- return isWebProductionSource(file)
+ return isWebProductionSource(file) || isWebProductionStyle(file)
},
check({ lines }) {
const violations = []
diff --git a/scripts/style-rules/rules.test.mjs b/scripts/style-rules/rules.test.mjs
index 8651e7e9f..7a032d153 100644
--- a/scripts/style-rules/rules.test.mjs
+++ b/scripts/style-rules/rules.test.mjs
@@ -37,6 +37,8 @@ test('requires the shared viewport boundary in application production source', (
assert.equal(violationsFor('control-ui/components/Results.tsx', direct).length, 1)
assert.equal(violationsFor('profile-ui/app/members/page.tsx', direct).length, 1)
+ assert.equal(violationsFor('control-ui/app/globals.css', '.eft-table-viewport {}').length, 1)
+ assert.equal(violationsFor('profile-ui/app/globals.css', '.eft-table-viewport {}').length, 1)
assert.deepEqual(violationsFor('control-ui/components/Results.tsx', shared), [])
assert.deepEqual(violationsFor('packages/frontend-components/src/index.tsx', direct), [])
assert.deepEqual(violationsFor('control-ui/components/__tests__/Results.test.tsx', direct), [])