eslint rule suggestion: report an Index that the system's own query already covers
Maintainer antworten meist innerhalb von 1 Tag
Dieses Issue hat noch niemand übernommen.
Bewertung
- Schwierigkeit
- 4/5
- Geschätzter Aufwand
- 3-5 Tage
- Anfängerfreundlichkeit
- 45/100
- Issue-Typ
- Feature
- Klarheit
- Größtenteils klar
- Aktivitätsstatus
- Aktiv
- Tech-Stack
- eslint, typescript
- Bereich
- tooling
Rechercherichtung
Start by reading the existing ESLint plugin and rule entry points; the issue notes that the plugin already sees system declarations and lookups. Check related issues #233 and #234 for context, then add tests for the listed report and non-report cases. Done means the rule reports only qualifying indexes at Index.create and leaves the specified legitimate indexes alone.
Vom Indexierungsmodell aus dem Issue-Text verfasst.
Beschreibung
Summary
Suggestion for the planned ESLint rule: report an Index that a plain query already covers. An index is kept up to date on every structural change and costs memory, so defining one for something a system can read with components: { with, not } is waste, and it is easy to write by habit.
Case
A system that despawns every entity carrying a tag was written with an index:
const transients = Index.create({ key: [], components: { with: [frameTransient] } });
export const endFrame = System.create({ lookup: { transients: { index: transients } } }, ({ commands, lookup }) => {
const all = lookup.transients();
for (let i = 0; i < all.length; i++) commands.despawn(all.at(i).entity);
});
A row system reads the same entities with nothing to maintain:
export const endFrame = System.create({ components: { with: [frameTransient] } }, (row, { commands }) => {
commands.despawn(row.entity);
});
Rule
Report an index when all of these hold:
- it has
key: []and is notunique, - exactly one system uses it, through a lookup,
- the index's
with(andnot) is covered by that system's owncomponentsdeclaration, so the system already matches those entities, - the body only iterates the lookup's rows (
for (i < rows.length) rows.at(i)), with no keyed access.
Message: "this index is replaceable by the system's own components query; make it a row system" (or the equivalent for per-run systems), pointing at the Index.create.
What it must not report
An all-rows index (key: []) is legitimate when:
- several systems read it,
- a per-run system needs the whole set before it acts (for example, "is there any request for X?" across all rows), which a row system, called once per row, can't express,
- it is read from a system whose own declaration doesn't match those entities (a different archetype).
An index with a key (a keyed or unique lookup) is never reported.
Notes
- It could also be a compiler warning, since the plugin already sees every system's declaration and lookups, but a lint rule fits better: the first check is a style judgment and the fix depends on the body.
- Related: https://github.com/adobe/data/issues/234 (the widened-access fallback) and https://github.com/adobe/data/issues/233 (describing inferred access), both about making what the build infers visible.
- Vorherrschende Sprache
- TypeScript
- Sterne
- 12
- Forks
- 8
- Ø Merge
- 9 Std. 2 Min.
- Gemergte PRs (30 T.)
- 25
Entwicklungsumgebung
- Kein Dockerfile und keine Docker-Compose-Datei
- Keine Pull-Request-Vorlage
- Beitragsleitfaden lesen
Erste Schritte
- Lesen Sie das ganze Issue und danach den Beitragsleitfaden des Projekts.
- Schreiben Sie ins Issue, dass Sie es übernehmen — das erspart doppelte Arbeit.
- Forken Sie das Repository und arbeiten Sie in einem Branch.
- Öffnen Sie einen Pull Request, der die Issue-Nummer nennt.
Mehr aus adobe/data
-
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 72/100
Maintainer antworten meist innerhalb von 1 Tag
-
Schwierigkeit 5/5 Über eine Woche Anfängerfreundlichkeit 38/100
Maintainer antworten meist innerhalb von 1 Tag
-
Schwierigkeit 4/5 3-5 Tage Anfängerfreundlichkeit 57/100
Maintainer antworten meist innerhalb von 1 Tag
-
ecs: let kernels issue commands through helpers (component lists, symbol-keyed values, void helpers)Offen
Schwierigkeit 5/5 Über eine Woche Anfängerfreundlichkeit 15/100
Maintainer antworten meist innerhalb von 1 Tag
-
createLazy: wrap nested service groups and accept partial (subset) schemasEvtl. vergeben @krisnye hat das vor 2 Tagen übernommen. Offen
Schwierigkeit 4/5 3-5 Tage Anfängerfreundlichkeit 30/100
Maintainer antworten meist innerhalb von 1 Tag
Ähnliche Issues
-
desktop v3 windows
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 75/100
esengine/DeepSeek-Reasonix#15016 · 1 Kommentar ·
Maintainer antworten meist innerhalb von 1 Tag
-
FR: Support CJK brackets, symbols and full-width markers in footnoteHeuristics (EBPAJ support)Offen
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 72/100
readest/readest#7413 · 1 Kommentar ·
Maintainer antworten meist innerhalb von 1 Tag
-
enhancement good first issue priority: medium size: XS
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 85/100
Maintainer antworten meist innerhalb von 1 Tag
-
content triage
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 72/100
Maintainer antworten meist innerhalb von 1 Tag
-
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 75/100
eliasstravik/herdr-projects#788 ·