@markuplint/ml-spec 5.0.0-alpha.0 → 5.0.0-alpha.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -3,6 +3,22 @@
3
3
  All notable changes to this project will be documented in this file.
4
4
  See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
5
5
 
6
+ # [5.0.0-alpha.1](https://github.com/markuplint/markuplint/compare/v5.0.0-alpha.0...v5.0.0-alpha.1) (2026-02-22)
7
+
8
+ ### Bug Fixes
9
+
10
+ - **ml-spec:** add transparent traversal fallback in collectLabelText ([d6096c1](https://github.com/markuplint/markuplint/commit/d6096c1ceba190e7799974d0c682695946f852ed))
11
+
12
+ - feat(ml-spec)!: update default ARIA version to 1.3 ([c3b56e2](https://github.com/markuplint/markuplint/commit/c3b56e2bf06a667a00aa621f2f51a082a90d4e2f))
13
+
14
+ ### BREAKING CHANGES
15
+
16
+ - The default ARIA specification version used when none
17
+ is explicitly configured changes from 1.2 to 1.3. This may produce
18
+ different lint results for rules that depend on ARIA version.
19
+
20
+ Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
21
+
6
22
  # [5.0.0-alpha.0](https://github.com/markuplint/markuplint/compare/v4.14.1...v5.0.0-alpha.0) (2026-02-20)
7
23
 
8
24
  ### Bug Fixes
@@ -155,21 +155,28 @@ result.directivePatterns = [...(result.directivePatterns ?? []), ...extendedSpec
155
155
  (最初のマッチが優先)。そのため、フレームワーク spec はパターンを
156
156
  最も具体的なものから最も一般的なものの順で定義する必要があります。
157
157
 
158
- #### 6. `useIDLAttributeNames`
158
+ #### 6. `acceptedAttrNames`
159
159
 
160
- 拡張仕様が `useIDLAttributeNames` を明示的に設定している場合(`true` または
161
- `false`)、現在の値を上書きします:
160
+ 拡張仕様が `acceptedAttrNames` を明示的に設定している場合、
161
+ 現在の値を上書きします:
162
162
 
163
163
  ```ts
164
- if (extendedSpec.useIDLAttributeNames != null) {
165
- result.useIDLAttributeNames = extendedSpec.useIDLAttributeNames;
164
+ if (extendedSpec.acceptedAttrNames != null) {
165
+ result.acceptedAttrNames = extendedSpec.acceptedAttrNames;
166
166
  }
167
167
  ```
168
168
 
169
169
  これは明示的な `null` ガード付きの last-write-wins セマンティクスです。
170
170
  プロパティを省略しても以前に設定された値はリセットされません。
171
- このフラグは `@markuplint/ml-core` の `MLAttr` コンストラクタで使用され、
172
- IDL-コンテンツ属性名解決(例: `className` → `class`)を有効化します。
171
+ この値は `@markuplint/ml-core` の `MLAttr` コンストラクタで使用され、
172
+ 属性名の解決方法を制御します:
173
+
174
+ - `'idl'` -- IDL-コンテンツ属性名解決を有効化(例: `className` → `class`)し、
175
+ コンテンツ属性名が使用された場合にIDL名を候補として提案します
176
+ (例: `tabindex` → 「`tabIndex` の間違いでは?」)。Reactで使用されます。
177
+ - `'both'` -- IDL-コンテンツ属性名解決を有効化しますが、IDL名を候補として
178
+ 提案**しません**。コンテンツ属性名(例: `class`)とIDLプロパティ名
179
+ (例: `className`)の両方が警告なしで受け入れられます。Svelteで使用されます。
173
180
 
174
181
  #### 7. 要素仕様
175
182
 
@@ -160,21 +160,29 @@ This is simple array concatenation. The core engine evaluates patterns in order
160
160
  (first match wins), so framework specs should define their patterns from most
161
161
  specific to most general.
162
162
 
163
- #### 6. `useIDLAttributeNames`
163
+ #### 6. `acceptedAttrNames`
164
164
 
165
- If the extended spec explicitly sets `useIDLAttributeNames` (to `true` or
166
- `false`), it overrides the current value:
165
+ If the extended spec explicitly sets `acceptedAttrNames`, it overrides the
166
+ current value:
167
167
 
168
168
  ```ts
169
- if (extendedSpec.useIDLAttributeNames != null) {
170
- result.useIDLAttributeNames = extendedSpec.useIDLAttributeNames;
169
+ if (extendedSpec.acceptedAttrNames != null) {
170
+ result.acceptedAttrNames = extendedSpec.acceptedAttrNames;
171
171
  }
172
172
  ```
173
173
 
174
174
  This is a last-write-wins semantic with explicit `null` guard -- omitting the
175
- property does not reset a previously set value. This flag is consumed by
176
- `@markuplint/ml-core`'s `MLAttr` constructor to enable IDL-to-content attribute
177
- name resolution (e.g., `className` -> `class`).
175
+ property does not reset a previously set value. The value controls how
176
+ `@markuplint/ml-core`'s `MLAttr` constructor resolves attribute names:
177
+
178
+ - `'idl'` -- Enables IDL-to-content attribute name resolution (e.g.,
179
+ `className` -> `class`) and suggests IDL names as candidates when the
180
+ content attribute name is used (e.g., `tabindex` -> "Did you mean
181
+ `tabIndex`?"). Used by React, where only IDL property names are accepted.
182
+ - `'both'` -- Enables IDL-to-content attribute name resolution but does
183
+ **not** suggest IDL names as candidates. Both content attribute names
184
+ (e.g., `class`) and IDL property names (e.g., `className`) are accepted
185
+ without warnings. Used by Svelte.
178
186
 
179
187
  #### 7. Element Specs
180
188
 
@@ -59,7 +59,15 @@ function collectLabelText(label, labeledElement, resolver, visited, computeFn, i
59
59
  continue;
60
60
  }
61
61
  const result = computeFn(childEl, resolver, inLabelledbyTraversal, visited);
62
- parts.push(result.name);
62
+ if (result.name) {
63
+ parts.push(result.name);
64
+ }
65
+ else {
66
+ // Transparent traversal: when the child element has no accessible name
67
+ // (e.g., <span> with role="generic"), recursively collect its descendant text.
68
+ // This matches the behavior of resolveNameFromContent's fallback.
69
+ parts.push(collectLabelText(childEl, labeledElement, resolver, visited, computeFn, inLabelledbyTraversal));
70
+ }
63
71
  }
64
72
  }
65
73
  return parts.join(' ');
@@ -91,7 +91,7 @@ export interface ARIA {
91
91
  namingProhibited?: true;
92
92
  implicitProperties?: ImplicitProperties;
93
93
  properties?: PermittedARIAProperties;
94
- conditions?: {
94
+ conditions?: false | {
95
95
  /**
96
96
  * This interface was referenced by `undefined`'s JSON-Schema definition
97
97
  * via the `patternProperty` ".+".
@@ -111,7 +111,7 @@ export interface ARIA {
111
111
  namingProhibited?: true;
112
112
  implicitProperties?: ImplicitProperties;
113
113
  properties?: PermittedARIAProperties;
114
- conditions?: {
114
+ conditions?: false | {
115
115
  /**
116
116
  * This interface was referenced by `undefined`'s JSON-Schema definition
117
117
  * via the `patternProperty` ".+".
@@ -130,7 +130,7 @@ export interface ARIA {
130
130
  permittedRoles?: PermittedRoles;
131
131
  implicitProperties?: ImplicitProperties;
132
132
  properties?: PermittedARIAProperties;
133
- conditions?: {
133
+ conditions?: false | {
134
134
  /**
135
135
  * This interface was referenced by `undefined`'s JSON-Schema definition
136
136
  * via the `patternProperty` ".+".
@@ -12,7 +12,7 @@ export interface MLMLSpec {
12
12
  readonly def: SpecDefs;
13
13
  readonly specs: readonly ElementSpec[];
14
14
  readonly directivePatterns?: readonly DirectivePattern[];
15
- readonly useIDLAttributeNames?: boolean;
15
+ readonly acceptedAttrNames?: 'idl' | 'both';
16
16
  }
17
17
  /**
18
18
  * An element specification for extending or overriding parts of the base spec.
@@ -32,7 +32,7 @@ export type ExtendedSpec = {
32
32
  readonly def?: Partial<SpecDefs>;
33
33
  readonly specs?: readonly ExtendedElementSpec[];
34
34
  readonly directivePatterns?: readonly DirectivePattern[];
35
- readonly useIDLAttributeNames?: boolean;
35
+ readonly acceptedAttrNames?: 'idl' | 'both';
36
36
  };
37
37
  /**
38
38
  * A declarative pattern for resolving framework-specific directive
@@ -5,4 +5,4 @@ export declare const ariaVersions: readonly ["1.1", "1.2", "1.3"];
5
5
  /**
6
6
  * The recommended default ARIA specification version to use when none is explicitly specified.
7
7
  */
8
- export declare const ARIA_RECOMMENDED_VERSION = "1.2";
8
+ export declare const ARIA_RECOMMENDED_VERSION = "1.3";
@@ -5,4 +5,4 @@ export const ariaVersions = ['1.1', '1.2', '1.3'];
5
5
  /**
6
6
  * The recommended default ARIA specification version to use when none is explicitly specified.
7
7
  */
8
- export const ARIA_RECOMMENDED_VERSION = '1.2';
8
+ export const ARIA_RECOMMENDED_VERSION = '1.3';
@@ -15,7 +15,8 @@ export function resolveVersion(aria, version) {
15
15
  const implicitProperties = aria[version]?.implicitProperties ?? aria.implicitProperties;
16
16
  const properties = aria[version]?.properties ?? aria.properties;
17
17
  const namingProhibited = version === '1.1' ? aria.namingProhibited : (aria[version]?.namingProhibited ?? aria.namingProhibited);
18
- const conditions = aria[version]?.conditions ?? aria.conditions;
18
+ const versionConditions = aria[version]?.conditions;
19
+ const conditions = versionConditions === false ? undefined : (versionConditions ?? aria.conditions);
19
20
  return {
20
21
  implicitRole,
21
22
  permittedRoles,
@@ -14,5 +14,5 @@ export declare function schemaToSpec(schemas: readonly [MLMLSpec, ...ExtendedSpe
14
14
  def: import("../types/index.js").SpecDefs;
15
15
  specs: readonly ElementSpec[];
16
16
  directivePatterns?: readonly import("../types/index.js").DirectivePattern[];
17
- useIDLAttributeNames?: boolean;
17
+ acceptedAttrNames?: "idl" | "both";
18
18
  };
@@ -68,8 +68,8 @@ export function schemaToSpec(schemas) {
68
68
  if (extendedSpec.directivePatterns) {
69
69
  result.directivePatterns = [...(result.directivePatterns ?? []), ...extendedSpec.directivePatterns];
70
70
  }
71
- if (extendedSpec.useIDLAttributeNames != null) {
72
- result.useIDLAttributeNames = extendedSpec.useIDLAttributeNames;
71
+ if (extendedSpec.acceptedAttrNames != null) {
72
+ result.acceptedAttrNames = extendedSpec.acceptedAttrNames;
73
73
  }
74
74
  if (extendedSpec.specs) {
75
75
  const exSpecs = [...extendedSpec.specs];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@markuplint/ml-spec",
3
- "version": "5.0.0-alpha.0",
3
+ "version": "5.0.0-alpha.1",
4
4
  "description": "Types and schema that specs of the Markup languages for markuplint",
5
5
  "repository": "git@github.com:markuplint/markuplint.git",
6
6
  "author": "Yusuke Hirao <yusukehirao@me.com>",
@@ -34,14 +34,14 @@
34
34
  "schema:prettier": "npx prettier --write \"./schemas/*.json\" \"./src/types/*.ts\" --log-level warn"
35
35
  },
36
36
  "dependencies": {
37
- "@markuplint/ml-ast": "5.0.0-alpha.0",
38
- "@markuplint/types": "5.0.0-alpha.0",
37
+ "@markuplint/ml-ast": "5.0.0-alpha.1",
38
+ "@markuplint/types": "5.0.0-alpha.1",
39
39
  "is-plain-object": "5.0.0",
40
40
  "type-fest": "5.4.4"
41
41
  },
42
42
  "devDependencies": {
43
- "@markuplint/test-tools": "5.0.0-alpha.0",
43
+ "@markuplint/test-tools": "5.0.0-alpha.1",
44
44
  "json-schema-to-typescript": "15.0.4"
45
45
  },
46
- "gitHead": "13dcfc84ec83d87360c720e253383b60767e1b56"
46
+ "gitHead": "78a295e73a097a1ce09c777c06fa21ab68136387"
47
47
  }