You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
fix(ego-lint): detect compiled TypeScript and suppress noisy rules (#52)
## Summary
Extensions compiled from TypeScript via esbuild/tsc produce artifacts
that trigger multiple ego-lint rules inappropriately:
- **R-DEPR-09** (`var` declarations): esbuild emits `var` for hoisted
helpers — not a code quality issue
- **R-SLOP-38** (verbose parameter names): TypeScript verbose signatures
survive compilation
- **resource-tracking/no-destroy-method**: compiled output fragments
classes across files; cleanup is handled by parent class hierarchies the
static analyzer can't follow
This adds early detection of esbuild/tsc transpiler markers
(`__defProp`, `__decorateClass`, `__publicField`) and suppresses these
noisy rules when detected.
### Changes
- **`ego-lint.sh`**: New compiled TypeScript detection section between
minified-js and CSS checks. Scans JS files for esbuild helper patterns,
sets `EGO_LINT_COMPILED_TS=1` env var for sub-scripts
- **`apply-patterns.py`**: New `skip-if-compiled` rule field — when
`true` and compiled TS detected, rule is skipped with SKIP status
- **`rules/patterns.yaml`**: Added `skip-if-compiled: true` to R-DEPR-09
and R-SLOP-38
- **`check-resources.py`**: Suppresses `no-destroy-method` findings when
compiled TS detected (other resource orphan checks still run)
- **Test fixture**: `compiled-ts-extension@test` with esbuild-style
helpers, `var` declarations, verbose identifiers, and a helper class
without destroy method
## Test plan
- [x] New fixture triggers detection and verifies all three suppressions
- [x] Full test suite passes: 565 passed, 0 failed (was 558)
- [x] Non-compiled fixtures still get `[PASS] compiled-typescript` (no
false positives)
- [ ] Field test with `--no-fetch` to verify tiling-shell noise
reduction
Closes#40
🤖 Generated with [Claude Code](https://claude.com/claude-code)
---------
Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
When a rule flags artifacts produced by JavaScript transpilers (e.g., esbuild), use `skip-if-compiled: true` to suppress it for compiled extensions. ego-lint detects esbuild output by scanning for transpiler helper functions (`__defProp`, `__decorateClass`, `__publicField`). When detected, rules with this field are emitted as SKIP instead of WARN/FAIL.
222
+
223
+
```yaml
224
+
- id: R-DEPR-09
225
+
pattern: "^\\s*var\\s+\\w"
226
+
severity: advisory
227
+
message: "Use const/let instead of var"
228
+
skip-if-compiled: true
229
+
```
230
+
231
+
esbuild emits `var` for hoisted helpers and verbose parameter names from TypeScript signatures — these are build artifacts, not author choices. Only use this field for rules where compiled output is a known false-positive source.
232
+
219
233
### Fix Version Gating (`fix-min-version`)
220
234
221
235
When a deprecation rule suggests a fix that only works on newer GNOME versions, use `fix-min-version` to suppress the fix text for extensions whose minimum shell-version is below the threshold. The warning still fires (developers should know about deprecations), but the fix suggestion is omitted when applying it would break backward compatibility.
Copy file name to clipboardExpand all lines: skills/ego-lint/references/rules-reference.md
+2Lines changed: 2 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -383,6 +383,7 @@ import {Extension} from 'resource:///org/gnome/shell/extensions/extension.js';
383
383
-**Rule**: Extension code should use `const` or `let` instead of `var`.
384
384
-**Rationale**: `var` has function scope rather than block scope, which causes subtle bugs in closures and loops. Modern JavaScript uses `const` (preferred) and `let` (when reassignment is needed). EGO reviewers view `var` usage as a sign of outdated or AI-generated code.
385
385
-**Fix**: Replace `var` with `const` (preferred) or `let` (when reassignment is needed).
386
+
-**Note**: Suppressed (`skip-if-compiled`) for extensions compiled from TypeScript via esbuild, where `var` is emitted for transpiler helper functions.
@@ -2448,6 +2449,7 @@ Rules for APIs removed or changed in specific GNOME Shell versions. These rules
2448
2449
- **Rationale**: AI-generated code tends to use excessively descriptive camelCase names like `currentBatteryThresholdValue` or `updatedNotificationMessage`. Human-written GNOME code favors concise names (`threshold`, `message`). The lowercase-start filter avoids false positives on PascalCase class names and UPPER_SNAKE constants. Threshold raised from 20 to 25 to avoid FPs on standard Clutter API names (e.g., `brightnessContrastEffect` at 24 chars).
2449
2450
- **Fix**: Shorten parameter/argument names to be concise but clear.
- **Note**: Suppressed (`skip-if-compiled`) for extensions compiled from TypeScript via esbuild, where verbose parameter names from TypeScript signatures survive compilation.
0 commit comments