Repository navigation
feat(check): catch app-level mistakes before the app runs (#207) - #230
Merged
Merged
Conversation
…M event tables The template lint rules for #207 need more data from the standards than the attribute index gave: which attributes are boolean, every WAI-ARIA 1.2 and 1.3 state and property, SVG and obsolete HTML element names, and the DOM event names a listener may use. The generator now reads each from its published source, with saved copies accepted for an offline refresh. Co-Authored-By: Claude Opus 5.5 <[email protected]>
…ver (#207) citry check and the editor now report, from the template alone: misspelled attributes, elements, and DOM events; unknown aria-* names; block elements inside <p>; literal ids two elements always render; <img> without alt (warning); v-model on an element that holds no value; and Vue expressions that are not valid JavaScript. The misspelled-directive rule now covers v-* names such as v-iff, the attribute-value rule reports a boolean attribute with a value other than its own name, and the component-listener rule reports lowercase names such as @hdie and gets a rule_undeclared_component_event setting. Each rule has a rule_* setting on LintSettings and on a component's Lint class, and the template-only ones also run in citry check --static. Co-Authored-By: Claude Opus 5.5 <[email protected]>
…mplate rules From the independent review of the #207 rules: the Vue-only checks (v-* directive typos, v-model targets, DOM event names) now skip v-pre content, which Vue leaves as written; a whitespace-only Vue expression is reported; obsolete block elements close a paragraph and <noscript> does not; <slot> bindings are slot props; c-empty counts as a condition for duplicate ids; a root <img> inside a top-level c-if chain counts as the single root; no message suggests v-once or v-memo; a bound boolean string gets its own message. The catalog text now matches the code, and the editor drops a TypeScript error that repeats an invalid Vue expression. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Two separate top-level c-if blocks can both render, so neither image there is the single root Vue passes a parent's alt to. Also correct the docs and catalog wording the second review pass found. Co-Authored-By: Claude Opus 5.5 <[email protected]>
A data class field annotated as Literal[...] failed every call with "Unsupported annotation". It now accepts exactly the listed values, each read by its own type's rule, and the OpenAPI document lists them as an enum. The events design also now says what the runtime does with a form: arguments written in @c-submit replace the form's fields instead of joining them, and the JSON path checks values strictly. Co-Authored-By: Claude Opus 5.5 <[email protected]>
…c-key The render error for a component that a loop repeats without #c-key, or with a duplicate key, said only "repeated component call". It now names the tag as written, its template, and the line. Co-Authored-By: Claude Opus 5.5 <[email protected]>
) With the application loaded, citry check now reports a component that <c-for> repeats without #c-key on a page that uses Vue; a component that assigns to its own Vue prop (the editor reports it too, and a write in component JavaScript is at most a warning); @c-* arguments the server would reject: an unknown key, a missing required field, or a literal of the wrong type; and a var(--name) one typing slip from a css_data() key. Each has a rule_* setting. A Boolean Vue prop given a string other than '' or its own name is now reported, and a condition whose two results are literals is typed as either result. A js_data() module constant that JSON cannot carry is a warning in citry check, and a value ty types as a standard non-JSON type, such as PurePosixPath, is a warning in the editor and citry check --types. citry check --static notes, and the editor marks, a template it skips because the base class comes from another module. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]>
From the independent review of the #207 batch 2 rules: a component inside a keyed component call needs no key of its own, an inner loop's c-empty repeats with the outer loop, and a js_data() that the source shows always returns {} does not make the page use Vue. A handler that accepts GET is checked against its query-string reading too, only the last of two equal keys is checked, and an Enum member in a Literal field matches its value of any type. The --types command adds only the js_data() warnings that need ty, and drops a repeat only at the same place in the same file. A name js_data() imports or binds itself hides a module constant. The docs, catalog, and changelogs now say what the code does. Co-Authored-By: Claude Opus 5.5 <[email protected]>
…a() binds Co-Authored-By: Claude Opus 5.5 <[email protected]>
…a non-JSON type citry check --types read every component once per file to find these warnings, which made a large library's check run out of time. It now searches only the files where ty typed a js_data() value as a type JSON cannot carry. Co-Authored-By: Claude Opus 5.5 <[email protected]>
The new template checks and their generated HTML and ARIA tables took the wheel to 1,251,430 bytes, past the 1,220 KiB cap set at 1,188,823 bytes. The cap is now 1,320 KiB, about 100 KB above the measured size. Co-Authored-By: Claude Opus 5.5 <[email protected]>
# Conflicts: # CHANGELOG.md # docs/design/ide_integration.md # docs_site/content/ide/template-linting.md # packages/protocol/diagnostics/CHANGELOG.md # packages/py/citry/citry/_checker.py # packages/py/citry/citry/_diagnostic_catalog.py # packages/py/citry/citry/_linting.py # packages/py/citry/citry/analysis.py # packages/py/citry/citry/settings.py # packages/py/citry/tests/test_diagnostics.py # packages/py/citry_lsp/CHANGELOG.md # packages/py/citry_lsp/citry_lsp/engine.py
12 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Part of #207, stacked on #229; merge that first. It adds checks that need the loaded app (
citry --app ... check), and two plain bug fixes.New and extended rules
#c-key<c-for each="c in cards"><c-Card .../></c-for>citry.browser.missing-component-key@click="open = false", whereopenis a propcitry.browser.prop-assignmentsave({amont: 1})citry.browser.unknown-server-event-fieldsave({})citry.browser.missing-server-event-fieldsave({amount: '1'})citry.browser.incompatible-server-event-fieldcss_data()var(--acent)citry.css.misspelled-variable:open="x ? 'open' : 'closed'"citry.browser.incompatible-component-prop(fixed)js_data()value JSON can't carryPurePosixPath(...)citry.js-data.unsupported-type(extended to the editor and--types)class Card(AppComponent)citry.check.template-not-checkedEach new rule has a
rule_*setting.How the rules avoid wrong reports
#c-key: the rule follows how the page is actually rendered. It fires only when the component or the repeated child uses Vue, and skipstransparentandsimple=Truechildren, and children of a keyed component. The runtime error for a missing or duplicate key now names the tag, the template and the line.<form>, on any element that could contain a form, and forsubmit.Plain fixes
Literal[...]field on an Events data class no longer fails at runtime with "Unsupported annotation". It validates, and the OpenAPI document lists its values.docs/design/events.md§5.1 now describes what the runtime does: arguments written in@c-submitreplace the form's fields, and the JSON path checks values strictly.Evidence
citry check --staticover the whole repository.--platform linux) pass. The Python test suites pass; the last fix, which made the--typesjs_data()check fast enough for citry_ui, was re-tested on its own.🤖 Generated with Claude Code