react-spec-maintenance
Perform maintenance tasks for @markuplint/react-spec: add global attributes,
add element-specific overrides, and modify the ExtendedSpec object.
Input
$ARGUMENTS specifies the task. Supported tasks:
| Task | Description |
|---|---|
add-global-attribute | Add a new global attribute to the ExtendedSpec |
add-element-override | Add an element-specific attribute override |
If omitted, defaults to add-global-attribute.
Reference
Before executing any task, read docs/maintenance.md (or docs/maintenance.ja.md)
for the full guide. The recipes there are the source of truth for procedures.
Also read:
- •
ARCHITECTURE.md-- Package overview, ExtendedSpec content, and integration points - •
src/index.ts-- ExtendedSpec object definition (source of truth)
Task: add-global-attribute
Add a new global attribute available on every JSX element. Follow recipe #1 in docs/maintenance.md.
Step 1: Identify the attribute
- •Determine the attribute name, type (
Any,Boolean, or a specific type), and description - •Check the React documentation to confirm the attribute is a valid global JSX attribute
Step 2: Add the attribute
- •Read
src/index.ts - •Add a new entry under
def['#globalAttrs']['#extends']:tsattributeName: { type: 'Any', // or 'Boolean' }, - •Add a JSDoc comment above the entry describing its purpose
Step 3: Verify
- •Build:
yarn build --scope @markuplint/react-spec - •Confirm the attribute appears in the exported spec object
Task: add-element-override
Add an element-specific attribute override. Follow recipe #2 in docs/maintenance.md.
Step 1: Identify the element and attribute
- •Determine the target element name (e.g.,
input,select,textarea) - •Determine the attribute name, type, and optional conditions
Step 2: Add the override
- •Read
src/index.ts - •Find the element in the
specs[]array, or add a new entry:ts{ name: 'elementName', attributes: { attributeName: { type: 'Any', }, }, }, - •If the attribute has conditions (e.g., only for certain input types), add a
conditionarray:tscondition: ['[type=checkbox]', '[type=radio]'],
- •If the attribute is case-sensitive, add
caseSensitive: true - •Add a JSDoc comment above the entry describing its purpose
Step 3: Verify
- •Build:
yarn build --scope @markuplint/react-spec - •Confirm the attribute appears in the exported spec object
Rules
- •Only export an ExtendedSpec object -- this package contains no parsing logic.
- •Global attributes go under
def['#globalAttrs']['#extends']-- they apply to all elements. - •Element overrides go under
specs[]array -- each entry targets a specific HTML element by name. - •Each attribute needs at minimum a
typefield -- valid types includeAny,Boolean, and specific type strings. - •Add JSDoc comments to all new attribute entries describing their purpose.