Commit c1f8858
fix(ego-lint): don't flag gi:// strings passed to importInShellOnly/importInPrefsOnly (#162)
## Problem
Field test against Burn-My-Windows v48 (2.4M EGO downloads) produced
**14 false positive FAILs** from `imports/shared-module-shell` and
`imports/no-gtk-in-extension`. Closes #159.
The extension uses a conditional import utility pattern in
`src/utils.js`:
```js
export async function importInShellOnly(module) {
if (typeof global !== 'undefined') {
return (await import(module)).default;
}
return null;
}
```
Effect modules reference Shell libraries via this guard:
```js
const Clutter = await utils.importInShellOnly('gi://Clutter');
```
The previous grep matched `gi://Clutter` anywhere in the file, including
as a quoted string argument. These are not imports — they're string
arguments to guard functions that guarantee the import never executes in
the wrong process context.
## Fix
Filter grep output to only flag lines that contain an actual import
statement (`from '...'` or `import('...')`). String references like
`importInShellOnly('gi://Clutter')` don't contain either pattern and are
no longer flagged.
Applied to both:
- `imports/shared-module-shell` (Shell imports in prefs-reachable
modules)
- `imports/no-gtk-in-extension` (GTK imports in extension-reachable
modules)
## Test Coverage
Added `import-guarded@test` fixture with the exact
`importInShellOnly`/`importInPrefsOnly` pattern from Burn-My-Windows.
Two new assertions verify no false positives are produced.
## Impact
- Burn-My-Windows v48: 14 FP FAILs → 0 (only the real R-SEC-22 dconf
FAIL remains)
- Existing `shared-import-violation@test` still fires — real violations
are unaffected
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-authored-by: Solomon <sol@nanoclaw.dev>1 parent 0d79399 commit c1f8858
File tree
7 files changed
+70
-3
lines changed- skills/ego-lint/scripts
- tests
- assertions
- fixtures/import-guarded@test
7 files changed
+70
-3
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
81 | 81 | | |
82 | 82 | | |
83 | 83 | | |
84 | | - | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
85 | 87 | | |
86 | 88 | | |
87 | 89 | | |
| |||
146 | 148 | | |
147 | 149 | | |
148 | 150 | | |
149 | | - | |
| 151 | + | |
| 152 | + | |
| 153 | + | |
150 | 154 | | |
151 | 155 | | |
152 | 156 | | |
153 | 157 | | |
154 | 158 | | |
155 | 159 | | |
156 | | - | |
| 160 | + | |
| 161 | + | |
157 | 162 | | |
158 | 163 | | |
159 | 164 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
7 | 7 | | |
8 | 8 | | |
9 | 9 | | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
0 commit comments