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
Copy file name to clipboardExpand all lines: .github/CODING_GUIDELINES.md
+39Lines changed: 39 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -193,6 +193,45 @@ export default Base;
193
193
- empty line
194
194
195
195
## 5. Config order
196
+
197
+
## JSDoc for Configs
198
+
199
+
To ensure consistency and enable static analysis, the following JSDoc standards for configs are mandatory.
200
+
201
+
### The `@reactive` Tag
202
+
203
+
A config is considered **reactive** if its definition within the `static config` block (anywhere in its prototype chain) ends with a trailing underscore (`_`). This is the single source of truth for reactivity.
204
+
205
+
- The `@reactive` tag **MUST** be included in the JSDoc comment block for any config that is reactive.
206
+
- This tag signals that the framework generates public `get()` and `set()` methods, along with `beforeGet`, `beforeSet`, and `afterSet` hooks.
207
+
208
+
**Correct Example:**
209
+
```javascript
210
+
/**
211
+
* My cool reactive property.
212
+
* @member{Boolean}myProperty_=true
213
+
* @reactive
214
+
*/
215
+
myProperty_:true,
216
+
```
217
+
218
+
### The `@protected` Tag
219
+
220
+
The `@protected` tag restricts a config to internal use within a class and its subclasses. It should be used sparingly.
221
+
222
+
- This tag **MUST ONLY** be used for configs that are not intended to be part of the public API for component instantiation or modification.
223
+
- A prime example is the `className` config, which is an internal detail.
224
+
- It **MUST NOT** be used for configs that developers are expected to use, such as `items`, `layout`, `style`, `width`, etc.
Copy file name to clipboardExpand all lines: AGENTS.md
+6-2Lines changed: 6 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -27,14 +27,17 @@ At the beginning of every new session, you **MUST** perform the following steps
27
27
- The distinction between class namespaces (e.g., `Neo.component.Base`) and `ntype` shortcuts (e.g., `'button'`).
28
28
29
29
3.**Read the Base Class (`src/core/Base.mjs`):** This is the foundation for all components and classes. Focus on:
30
-
- The `static config` system: Understand the difference between reactive configs (e.g., `myConfig_`) which generate
31
-
hooks, and non-reactive configs which are set on the prototype.
30
+
- The `static config` system: **CRITICAL:** You must deeply understand the difference between **reactive configs** (e.g., `myConfig_`), which generate `before/afterSet` hooks and are fundamental to the framework's reactivity, and **non-reactive configs**, which are applied to the prototype. Misinterpreting this is a critical failure. The trailing underscore is the key indicator.
32
31
- The instance lifecycle: `construct()`, `onConstructed()`, `initAsync()`, and `destroy()`.
33
32
- The reactivity hooks: `beforeGet*`, `beforeSet*`, `afterSet*`.
34
33
35
34
4.**Understand the Two Component Models:** Read the file `learn/gettingstarted/DescribingTheUI.md` to understand the
36
35
difference between functional and class-based components, and how they interoperate.
37
36
37
+
5.**Read the Coding Guidelines:** Parse the file `.github/CODING_GUIDELINES.md` to ensure all code and
38
+
documentation changes adhere to the project's established standards, paying special attention to the
39
+
JSDoc rules for configs.
40
+
38
41
## 3. The Knowledge Base: Your Primary Source of Truth
39
42
40
43
Your primary directive is to rely on the project's internal knowledge base, not your pre-existing training data.
@@ -209,6 +212,7 @@ Integrate the query tool into your development process.
209
212
4.**Verify:** After making changes, run any relevant verification tools, such as tests, to ensure your changes are
210
213
correct and meet the project's standards. For bug fixes, ensure you've created regression tests
211
214
(see `learn/guides/UnitTestingWithSiesta.md` for guidance).
215
+
212
216
5.**Use `text` over `html` in VDOM:** When creating VDOM nodes, always prefer using the `text` property over the `html`
213
217
property. `text` is mapped to the `textContent` DOM attribute, which is inherently secure against XSS attacks. `html`
214
218
is mapped to `innerHTML` and should be avoided unless you are intentionally rendering trusted HTML content.
0 commit comments