VIEW012: property-access
Custom property access mode differs from the project convention
| Code | VIEW012 |
| Name | property-access |
| Category | View structure (VIEW) |
| Default severity | warning |
| Enabled by default | no |
| Fix available | sometimes |
| Fix safety | unsafe |
| ign-lint equivalent | PropertyAccessRule |
What it does
Section titled “What it does”Checks the access mode of every top-level custom property of the view and
of its components against expected-access. The access mode is the
access of the property's propConfig entry (custom.<name>); a property
without one is PUBLIC. Nothing is checked until expected-access is set.
Why is this bad?
Section titled “Why is this bad?”Projects that keep view internals private (or public, for embedding) want every custom property to follow the same rule. A property with the wrong access is either reachable from places that should not depend on it, or hidden from embedding views and scripts that need it.
Example
Section titled “Example”With expected-access = "PRIVATE":
{"custom": {"rows": []}}Use instead:
{"custom": {"rows": []}, "propConfig": {"custom.rows": {"access": "PRIVATE"}}}Options
Section titled “Options”expected-access(unset by default):PUBLIC,PROTECTEDorPRIVATE(case-insensitive). Unset: the rule reports nothing.exempt-props(default[]): patterns (*and?wildcards, everything else literal) matched against the property name,custom.<name>and the full ign-lint path (root.root.children[0].Card.custom.x).
Unsafe, because the access mode changes who can read and write the
property at run time (a PRIVATE property is not sent to the browser, a
PROTECTED one cannot be written from it): sets access in the existing
propConfig entry, adds the entry (and
the propConfig object when the owner has none), or for PUBLIC removes
the access key (or the whole entry when access was its only key).
ign-lint
Section titled “ign-lint”Equivalent of PropertyAccessRule (expected_access, exempt_props), with
the same messages in iglint ign-lint.
Option reference
Section titled “Option reference”Set in [rules.VIEW012] of iglint.toml (or [tool.iglint.rules.VIEW012] in pyproject.toml).
| Option | Type | Default | Description |
|---|---|---|---|
expected-access |
string | none | PUBLIC, PROTECTED or PRIVATE; unset disables the rule. |
exempt-props |
array of strings | [] |
Wildcard patterns of properties that are not checked. |
ign-lint kwargs in a rule_config.json: expected_access -> expected-access, exempt_props -> exempt-props.
Generated from the rule metadata by iglint generate-docs; iglint rule VIEW012 prints the same page in the terminal. Source: docs/rules/VIEW012.md.