@markuplint/rules 4.9.2 → 4.9.4

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,16 +3,25 @@
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
- ## [4.9.2](https://github.com/markuplint/markuplint/compare/@markuplint/rules@4.9.1...@markuplint/rules@4.9.2) (2024-06-09)
6
+ ## [4.9.4](https://github.com/markuplint/markuplint/compare/@markuplint/rules@4.9.3...@markuplint/rules@4.9.4) (2024-09-02)
7
+
8
+ **Note:** Version bump only for package @markuplint/rules
9
+
7
10
 
8
11
 
9
- ### Bug Fixes
10
12
 
11
- * fix to export type files ([eff4bbf](https://github.com/markuplint/markuplint/commit/eff4bbfd127574809dc5e15d7cafe87699758ee0))
12
13
 
14
+ ## [4.9.3](https://github.com/markuplint/markuplint/compare/@markuplint/rules@4.9.2...@markuplint/rules@4.9.3) (2024-06-25)
13
15
 
16
+ ### Bug Fixes
17
+
18
+ - **ml-core:** `localName` returns lowercase when using case-sensitive parser for tag names ([b1acadd](https://github.com/markuplint/markuplint/commit/b1acaddfd6bf939ee809f6419ce85a701033ca4f))
14
19
 
20
+ ## [4.9.2](https://github.com/markuplint/markuplint/compare/@markuplint/rules@4.9.1...@markuplint/rules@4.9.2) (2024-06-09)
21
+
22
+ ### Bug Fixes
15
23
 
24
+ - fix to export type files ([eff4bbf](https://github.com/markuplint/markuplint/commit/eff4bbfd127574809dc5e15d7cafe87699758ee0))
16
25
 
17
26
  ## [4.9.1](https://github.com/markuplint/markuplint/compare/@markuplint/rules@4.9.0...@markuplint/rules@4.9.1) (2024-05-28)
18
27
 
@@ -224,7 +224,7 @@ function createExpectedObject(type, matches, t) {
224
224
  ? null
225
225
  : 1 < expectedObject.length
226
226
  ? t('either {0}', t(expectedObject))
227
- : expectedObject[0] ?? null;
227
+ : (expectedObject[0] ?? null);
228
228
  return expects;
229
229
  }
230
230
  function expectValueToWord(t, expect, type) {
package/lib/helpers.d.ts CHANGED
@@ -29,7 +29,7 @@ export declare function isValidAttr(t: Translator, name: string, value: string,
29
29
  raw: string;
30
30
  line: number;
31
31
  col: number;
32
- } | undefined;
32
+ };
33
33
  };
34
34
  export declare function toNormalizedValue(value: string, spec: Attribute): string;
35
35
  export declare function accnameMayBeMutable(el: Element<any, any>, document: Document<any, any>): boolean;
package/lib/helpers.js CHANGED
@@ -67,7 +67,7 @@ node, attrSpecs,
67
67
  log) {
68
68
  let invalid = false;
69
69
  const spec = attrSpecs.find(s => s.name.toLowerCase() === name.toLowerCase());
70
- log && log('Spec of the %s attr: %o', name, spec);
70
+ log?.('Spec of the %s attr: %o', name, spec);
71
71
  invalid = attrCheck(t, name, value, false, spec);
72
72
  if (invalid === false &&
73
73
  spec &&
package/lib/index.d.ts CHANGED
@@ -16,13 +16,7 @@ declare const rules: {
16
16
  readonly 'id-duplication': Readonly<import("@markuplint/ml-core").RuleSeed<import("@markuplint/ml-core").RuleConfigValue, undefined>>;
17
17
  readonly 'ineffective-attr': Readonly<import("@markuplint/ml-core").RuleSeed<import("@markuplint/ml-core").RuleConfigValue, undefined>>;
18
18
  readonly 'invalid-attr': Readonly<import("@markuplint/ml-core").RuleSeed<boolean, {
19
- allowAttrs?: Record<string, {
20
- enum: [string, ...string[]];
21
- } | {
22
- pattern: string;
23
- } | {
24
- type: import("packages/@markuplint/ml-spec/lib/index.js").AttributeType;
25
- }> | (string | {
19
+ allowAttrs?: (string | {
26
20
  name: string;
27
21
  value: import("packages/@markuplint/ml-spec/lib/index.js").AttributeType | ({
28
22
  enum: [string, ...string[]];
@@ -31,14 +25,14 @@ declare const rules: {
31
25
  } | {
32
26
  type: import("packages/@markuplint/ml-spec/lib/index.js").AttributeType;
33
27
  });
34
- })[] | undefined;
35
- disallowAttrs?: Record<string, {
28
+ })[] | Record<string, {
36
29
  enum: [string, ...string[]];
37
30
  } | {
38
31
  pattern: string;
39
32
  } | {
40
33
  type: import("packages/@markuplint/ml-spec/lib/index.js").AttributeType;
41
- }> | (string | {
34
+ }>;
35
+ disallowAttrs?: (string | {
42
36
  name: string;
43
37
  value: import("packages/@markuplint/ml-spec/lib/index.js").AttributeType | ({
44
38
  enum: [string, ...string[]];
@@ -47,9 +41,15 @@ declare const rules: {
47
41
  } | {
48
42
  type: import("packages/@markuplint/ml-spec/lib/index.js").AttributeType;
49
43
  });
50
- })[] | undefined;
51
- ignoreAttrNamePrefix?: string | string[] | undefined;
52
- allowToAddPropertiesForPretender?: boolean | undefined;
44
+ })[] | Record<string, {
45
+ enum: [string, ...string[]];
46
+ } | {
47
+ pattern: string;
48
+ } | {
49
+ type: import("packages/@markuplint/ml-spec/lib/index.js").AttributeType;
50
+ }>;
51
+ ignoreAttrNamePrefix?: string | string[];
52
+ allowToAddPropertiesForPretender?: boolean;
53
53
  attrs?: Record<string, ({
54
54
  enum: [string, ...string[]];
55
55
  } | {
@@ -58,7 +58,7 @@ declare const rules: {
58
58
  type: import("packages/@markuplint/ml-spec/lib/index.js").AttributeType;
59
59
  }) | {
60
60
  disallowed: true;
61
- }> | undefined;
61
+ }>;
62
62
  }>>;
63
63
  readonly 'label-has-control': Readonly<import("@markuplint/ml-core").RuleSeed<import("@markuplint/ml-core").RuleConfigValue, undefined>>;
64
64
  readonly 'landmark-roles': Readonly<import("@markuplint/ml-core").RuleSeed<boolean, {
@@ -72,29 +72,29 @@ declare const rules: {
72
72
  readonly 'no-default-value': Readonly<import("@markuplint/ml-core").RuleSeed<import("@markuplint/ml-core").RuleConfigValue, undefined>>;
73
73
  readonly 'no-duplicate-dt': Readonly<import("@markuplint/ml-core").RuleSeed<import("@markuplint/ml-core").RuleConfigValue, undefined>>;
74
74
  readonly 'no-empty-palpable-content': Readonly<import("@markuplint/ml-core").RuleSeed<boolean, {
75
- extendsExposableElements?: boolean | undefined;
76
- ignoreIfAriaBusy?: boolean | undefined;
75
+ extendsExposableElements?: boolean;
76
+ ignoreIfAriaBusy?: boolean;
77
77
  }>>;
78
78
  readonly 'no-hard-code-id': Readonly<import("@markuplint/ml-core").RuleSeed<import("@markuplint/ml-core").RuleConfigValue, undefined>>;
79
79
  readonly 'no-orphaned-end-tag': Readonly<import("@markuplint/ml-core").RuleSeed<boolean, null>>;
80
80
  readonly 'no-refer-to-non-existent-id': Readonly<import("@markuplint/ml-core").RuleSeed<import("@markuplint/ml-core").RuleConfigValue, {
81
- ariaVersion: "1.1" | "1.2" | "1.3";
81
+ ariaVersion: import("packages/@markuplint/ml-spec/lib/index.js").ARIAVersion;
82
82
  fragmentRefersNameAttr: boolean;
83
83
  }>>;
84
84
  readonly 'no-use-event-handler-attr': Readonly<import("@markuplint/ml-core").RuleSeed<boolean, {
85
- ignore?: string | string[] | undefined;
85
+ ignore?: string | string[];
86
86
  }>>;
87
87
  readonly 'permitted-contents': Readonly<import("@markuplint/ml-core").RuleSeed<import("./permitted-contents/types.js").TagRule[], import("./permitted-contents/types.js").Options>>;
88
88
  readonly 'placeholder-label-option': Readonly<import("@markuplint/ml-core").RuleSeed<boolean, undefined>>;
89
89
  readonly 'require-accessible-name': Readonly<import("@markuplint/ml-core").RuleSeed<boolean, {
90
- ariaVersion: "1.1" | "1.2" | "1.3";
90
+ ariaVersion: import("packages/@markuplint/ml-spec/lib/index.js").ARIAVersion;
91
91
  }>>;
92
92
  readonly 'require-datetime': Readonly<import("@markuplint/ml-core").RuleSeed<boolean, {
93
- langs?: import("./require-datetime/types.js").Lang[] | undefined;
93
+ langs?: import("./require-datetime/types.js").Lang[];
94
94
  }>>;
95
95
  readonly 'required-attr': Readonly<import("@markuplint/ml-core").RuleSeed<string | (string | {
96
96
  name: string;
97
- value?: string | string[] | undefined;
97
+ value?: string | string[];
98
98
  })[], undefined>>;
99
99
  readonly 'required-element': Readonly<import("@markuplint/ml-core").RuleSeed<string[], {
100
100
  ignoreHasMutableContents: boolean;
@@ -102,11 +102,11 @@ declare const rules: {
102
102
  readonly 'required-h1': Readonly<import("@markuplint/ml-core").RuleSeed<boolean, import("./required-h1/index.js").Options>>;
103
103
  readonly 'table-row-column-alignment': Readonly<import("@markuplint/ml-core").RuleSeed<boolean, undefined>>;
104
104
  readonly 'use-list': Readonly<import("@markuplint/ml-core").RuleSeed<readonly string[], {
105
- spaceNeededBullets?: string[] | undefined;
106
- noPrev?: boolean | undefined;
107
- prevElement?: boolean | undefined;
108
- prevComment?: boolean | undefined;
109
- prevCodeBlock?: boolean | undefined;
105
+ spaceNeededBullets?: string[];
106
+ noPrev?: boolean;
107
+ prevElement?: boolean;
108
+ prevComment?: boolean;
109
+ prevCodeBlock?: boolean;
110
110
  }>>;
111
111
  readonly 'wai-aria': Readonly<import("@markuplint/ml-core").RuleSeed<boolean, import("./wai-aria/types.js").Options>>;
112
112
  };
@@ -1,5 +1,6 @@
1
+ import type { ARIAVersion } from '@markuplint/ml-spec';
1
2
  declare const _default: Readonly<import("@markuplint/ml-core").RuleSeed<import("@markuplint/ml-core").RuleConfigValue, {
2
- ariaVersion: "1.1" | "1.2" | "1.3";
3
+ ariaVersion: ARIAVersion;
3
4
  fragmentRefersNameAttr: boolean;
4
5
  }>>;
5
6
  export default _default;
@@ -22,7 +22,6 @@ childNodes, specs, options, depth) {
22
22
  let prevResult = null;
23
23
  let barelyResult = null;
24
24
  let loopCount = 0;
25
- // eslint-disable-next-line no-constant-condition
26
25
  while (true) {
27
26
  loopCount++;
28
27
  ptLog('Check#%s: %s', loopCount, collection);
@@ -88,7 +87,7 @@ childNodes, specs, options, depth) {
88
87
  result.type === 'MISSING_NODE_ONE_OR_MORE' ||
89
88
  result.type === 'TRANSPARENT_MODEL_DISALLOWS'
90
89
  ? result.type
91
- : missingType ?? 'MISSING_NODE_REQUIRED';
90
+ : (missingType ?? 'MISSING_NODE_REQUIRED');
92
91
  ptLog('%s(in %s); Needs %s', resultType, missingType, result.query);
93
92
  return compereResult({
94
93
  type: resultType,
@@ -1,7 +1,6 @@
1
1
  import color from 'ansi-colors';
2
2
  import { log } from '../debug.js';
3
3
  export const cmLog = log.extend('content-model');
4
- /* eslint-disable import/no-named-as-default-member */
5
4
  export const bgGreen = color.bgGreen;
6
5
  export const green = color.green;
7
6
  export const bgRed = color.bgRed;
@@ -9,4 +8,3 @@ export const bgBlue = color.bgBlue;
9
8
  export const blue = color.blue;
10
9
  export const bgMagenta = color.bgMagenta;
11
10
  export const cyan = color.cyan;
12
- /* eslint-enable import/no-named-as-default-member */
@@ -55,7 +55,7 @@ el, specs, options) {
55
55
  type: result.type,
56
56
  scope: result.type === 'MISSING_NODE_REQUIRED' || result.type === 'MISSING_NODE_ONE_OR_MORE'
57
57
  ? el
58
- : result.unmatched[0] ?? el,
58
+ : (result.unmatched[0] ?? el),
59
59
  query: result.query,
60
60
  hint: result.hint,
61
61
  },
@@ -16,7 +16,7 @@ export declare function isZeroOrMore(content: ReadonlyDeep<PermittedContentPatte
16
16
  export declare function isChoice(content: ReadonlyDeep<PermittedContentPattern>): content is ReadonlyDeep<PermittedContentChoice>;
17
17
  export declare function isTransparent(content: ReadonlyDeep<PermittedContentPattern>): content is ReadonlyDeep<PermittedContentTransparent>;
18
18
  export declare function normalizeModel(pattern: ReadonlyDeep<PermittedContentRequire> | ReadonlyDeep<PermittedContentOptional> | ReadonlyDeep<PermittedContentOneOrMore> | ReadonlyDeep<PermittedContentZeroOrMore>): {
19
- model: ReadonlyDeep<PermittedContentPattern[] | Model>;
19
+ model: ReadonlyDeep<Model | PermittedContentPattern[]>;
20
20
  min: number;
21
21
  max: number;
22
22
  repeat: RepeatSign;
@@ -24,14 +24,14 @@ export declare function normalizeModel(pattern: ReadonlyDeep<PermittedContentReq
24
24
  };
25
25
  export declare function mergeHints(a: Readonly<Hints>, b: Readonly<Hints>): Partial<{
26
26
  missing: Partial<{
27
- barelyMatchedElements?: number | undefined;
28
- need?: string | undefined;
27
+ barelyMatchedElements?: number;
28
+ need?: string;
29
29
  }> | undefined;
30
- max?: number | undefined;
31
- not?: ChildNode | undefined;
32
- transparent?: import("./types.js").Element | undefined;
30
+ max?: number;
31
+ not?: ChildNode;
32
+ transparent?: import("./types.js").Element;
33
33
  }>;
34
- export declare function cleanObject<T extends Object>(object: T): Partial<T>;
34
+ export declare function cleanObject<T extends object>(object: T): Partial<T>;
35
35
  export declare class Collection {
36
36
  #private;
37
37
  constructor(origin: readonly ChildNode[]);
@@ -40,7 +40,7 @@ node, specs) {
40
40
  };
41
41
  }
42
42
  const not = selectorResult
43
- .flatMap(r => (r.matched ? [] : r.not ?? []))
43
+ .flatMap(r => (r.matched ? [] : (r.not ?? [])))
44
44
  .flatMap(descendants)
45
45
  .shift();
46
46
  return {
@@ -17,7 +17,7 @@ export const checkingRequiredProp = ({ el, role, propSpecs }) => t => {
17
17
  const elAriaSpec = getARIA(el.ownerMLDocument.specs, el.localName, el.namespaceURI, el.rule.options.version, el.matches.bind(el));
18
18
  const alt = elAriaSpec?.properties === false
19
19
  ? null
20
- : elAriaSpec?.properties?.without?.find(p => p.name === requiredProp)?.alt ?? null;
20
+ : (elAriaSpec?.properties?.without?.find(p => p.name === requiredProp)?.alt ?? null);
21
21
  if (alt?.method === 'set-attr' && el.hasAttribute(alt.target)) {
22
22
  return;
23
23
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@markuplint/rules",
3
- "version": "4.9.2",
3
+ "version": "4.9.4",
4
4
  "description": "Built-in rules of markuplint",
5
5
  "repository": "git@github.com:markuplint/markuplint.git",
6
6
  "author": "Yusuke Hirao <yusukehirao@me.com>",
@@ -25,18 +25,18 @@
25
25
  "./lib/permitted-contents/debug.js": "./lib/permitted-contents/debug.browser.js"
26
26
  },
27
27
  "dependencies": {
28
- "@markuplint/html-spec": "4.8.1",
29
- "@markuplint/ml-core": "4.8.1",
30
- "@markuplint/ml-spec": "4.6.2",
31
- "@markuplint/selector": "4.6.4",
32
- "@markuplint/shared": "4.4.2",
33
- "@markuplint/types": "4.5.2",
28
+ "@markuplint/html-spec": "4.9.0",
29
+ "@markuplint/ml-core": "4.8.3",
30
+ "@markuplint/ml-spec": "4.6.4",
31
+ "@markuplint/selector": "4.6.6",
32
+ "@markuplint/shared": "4.4.4",
33
+ "@markuplint/types": "4.5.4",
34
34
  "@types/debug": "4.1.12",
35
35
  "@ungap/structured-clone": "1.2.0",
36
36
  "ansi-colors": "4.1.3",
37
37
  "chrono-node": "2.7.6",
38
- "debug": "4.3.5",
39
- "type-fest": "4.20.0"
38
+ "debug": "4.3.6",
39
+ "type-fest": "4.26.0"
40
40
  },
41
- "gitHead": "0200dc1f7b1ffa7455b889696153e25dbae8241f"
41
+ "gitHead": "77cd5a25d5cf28c83253b7bfe02cd25b54e236b0"
42
42
  }
package/.eslintrc DELETED
@@ -1,5 +0,0 @@
1
- {
2
- "rules": {
3
- "import/no-default-export": 0
4
- }
5
- }