Skip to content

feat(check,lint): warn when a snippet call carries Class/Style/design properties (mendixlabs/mxcli#1511) - #1529

Merged
ako merged 1 commit into
mainfrom
feature/1511-snippetcall-class-style-warning
Oct 21, 2026
Merged

ako merged 1 commit into
mainfrom
feature/1511-snippetcall-class-style-warning

Conversation

@ako

@ako ako commented Oct 21, 2026

Copy link
Copy Markdown
Owner

Implements mendixlabs#1511 (#1393), approved by the maintainer.

Measured first, in the running app

On an 11.15.0 fixture copy booted with run --local, a page has snippetcall snippetCall1 inside a container. The call carries Class: 'probe-x', a Style, DynamicClasses, and two design properties.

mxcli playwright check results:

  • Snippet call: every selector for those settings matched 0 elements, and so did .mx-name-snippetCall1.
  • Inlining: the snippet's own container sits directly under the outer container (.probe-outer > .mx-name-sc_inner matched). The snippet's widgets are inlined, with no wrapper element.
  • Control: a container on the same page with the same four kinds of setting rendered all of them.

mxcli check --references and mx check (0 errors) were clean throughout, so nothing flagged the dead settings.

What this adds

  • MDL-WIDGET48 (check, warning)
    • Fires on snippetcall with Class, Style, DynamicClasses or design properties in create page/snippet and in alter page insert/replace. This needs no project.
    • In the --references pass it also covers alter page … { set (…) on <snippetcall> } and alter styling … widget <snippetcall> set …. There the widget type comes from the stored page (widgetStorageTyper).
    • Setting a value to empty stays silent.
  • MPR013 SnippetCallAppearance (lint, warning)
    • The same check over the catalog: class, style and dynamic classes, plus design properties from the stored page.
  • Message: the snippet call renders no element because the snippet's widgets are inlined. Style a container inside the snippet, or wrap the call in a container.

Tests

  • validate_snippetcall_appearance_test.go:
    • each setting on its own and several together;
    • message text;
    • controls: a bare call, and a styled container around the call;
    • alter insert;
    • alter set and alter styling on a stored snippet call;
    • stored controls stay silent.
  • snippet_call_appearance_test.go: catalog fields and design properties from the document.

Revert check:

  • Without the create-path hook, the create and insert tests fail.
  • A stored-type check that always answers no fails the stored tests; one that always answers yes fails the container controls.
  • Removing MPR013's widget-type filter makes it flag the container.

Also in this PR: lint rule table, create-page skill and widget reference, docs-site/src/language/widget-types.md, syntax snippet help, a finding file, and mdl-examples/bug-tests/1511-snippetcall-class-style.mdl. make build, make test and make lint pass.

Notes

  • Severity: these are warnings, not errors, because Studio Pro itself offers these fields on a snippet call.
  • Not covered:
    • an alter set on a page the same script creates (the same as the existing reference pass);
    • the bulk alter pages … where widgettype = snippetcall form.
  • Rule IDs: WIDGET48 and MPR013 were the next free IDs. Parallel branches may collide; this is checked at merge.

Generated by Claude Code

… properties (mendixlabs#1511)

A snippet call renders no element of its own: the snippet's widgets are
inlined into the parent, so the Class, Style, DynamicClasses and design
properties stored on a Forms$SnippetCallWidget never reach the DOM. check,
exec and mx check were all clean, so the setting was silently useless.

Measured on Mendix 11.15.0 (run --local + playwright check): a snippetcall
with Class 'probe-x', Style 'border: 3px solid red', DynamicClasses
'probe-dyn' and 'Align self' / 'Hide on' produced no element carrying any
of them (the snippet's container was a direct child of the enclosing
container), while a container on the same page with the same four settings
carried every one.

- MDL-WIDGET48 (check, warning): in the widget-tree walk for CREATE PAGE /
  SNIPPET and ALTER PAGE INSERT / REPLACE; and in the reference pass for
  `alter page ... { set (Class|Style|DynamicClasses|<design prop>) on sc }`
  and `alter styling ... widget sc set ...`, where the stored widget's $Type
  comes from the page mutator. Clearing a value stays silent.
- MPR013 (lint, correctness/warning): catalog Class/Style/DynamicClasses,
  plus design properties read from the stored document.
- Docs: lint rule table, create-page skill + widget reference, docs-site
  widget types, `syntax snippet` help.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01W3x8Fyvir8kLyPgJs1BDmF
@ako
ako merged commit c7dfd8d into main Oct 21, 2026
33 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants