Skip to content

Self-hosted, Self-Improving, Federated Everything App — dev management, agent orchestration, persistent mind, digital twin, second brain, and creative pipeline from a single dashboard over Tailscale to port the user into the OS

fix: treat 'of' as an identifier when classifying slashes in import-case scanner (#12302)

[._.]/ Adam Eivy486a4659cb32
diff --git a/scripts/check-import-case.js b/scripts/check-import-case.js
index b1eaa47f92..dfd92ca9e1 100644
--- a/scripts/check-import-case.js
+++ b/scripts/check-import-case.js
@@ -34,7 +34,7 @@ const MODULE_RE = /\.(?:[cm]?jsx?|tsx?)$/i;
const DYNAMIC_IMPORT_RE = /\bimport\(\s*['"]([^'"]+)['"]\s*\)/g;
const NEW_URL_RE = /new URL\(\s*['"]([^'"]+)['"]\s*,\s*import\.meta\.url\s*\)/g;
// A `/` after one of these words begins a regex literal, not a division.
-const REGEX_PRECEDING_KEYWORDS = new Set(['return', 'typeof', 'instanceof', 'in', 'of', 'new', 'delete', 'void', 'throw', 'case', 'do', 'else', 'yield', 'await']);
+const REGEX_PRECEDING_KEYWORDS = new Set(['return', 'typeof', 'instanceof', 'in', 'new', 'delete', 'void', 'throw', 'case', 'do', 'else', 'yield', 'await']);
// `if (x) /re/.test(y)`: a `)` closing one of these headers is followed by a statement.
const CONTROL_HEADER_KEYWORDS = new Set(['if', 'while', 'for', 'with']);
const COMPLETIONS = ['', '.js', '.jsx', '.mjs', '.cjs', '.ts', '.tsx', '/index.js', '/index.jsx', '/index.ts', '/index.tsx'];
diff --git a/scripts/check-import-case.test.js b/scripts/check-import-case.test.js
index af5c3b5278..4ca92ac042 100644
--- a/scripts/check-import-case.test.js
+++ b/scripts/check-import-case.test.js
@@ -79,8 +79,9 @@ describe('relativeSpecifiers ignores non-executable text', () => {
"if (ok) /[/]'/.test(s); await import('./AfterIf.js');",
"const q = obj.return / 2; await import('./AfterProp.js');",
"const w = (a) / 2; await import('./AfterGroup.js');",
+ "const of = 4; const r = of / 2; await import('./AfterOf.js');",
].join('\n');
- expect(relativeSpecifiers(source)).toEqual(['./AfterReturn.js', './AfterTypeof.js', './AfterIf.js', './AfterProp.js', './AfterGroup.js']);
+ expect(relativeSpecifiers(source)).toEqual(['./AfterReturn.js', './AfterTypeof.js', './AfterIf.js', './AfterProp.js', './AfterGroup.js', './AfterOf.js']);
});
});