@markuplint/rules 4.0.0-alpha.4 → 4.0.0-alpha.6

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/.eslintrc ADDED
@@ -0,0 +1,5 @@
1
+ {
2
+ "rules": {
3
+ "import/no-default-export": 0
4
+ }
5
+ }
package/LICENSE CHANGED
@@ -1,6 +1,6 @@
1
1
  MIT License
2
2
 
3
- Copyright (c) 2017-2019 Yusuke Hirao
3
+ Copyright (c) 2017-2023 Yusuke Hirao
4
4
 
5
5
  Permission is hereby granted, free of charge, to any person obtaining a copy
6
6
  of this software and associated documentation files (the "Software"), to deal
@@ -14,7 +14,7 @@ export default createRule({
14
14
  }
15
15
  const classAttr = attr.valueNode;
16
16
  const classList = attr.value
17
- .split(/\s+/g)
17
+ .split(/\s+/)
18
18
  .map(c => c.trim())
19
19
  .filter(Boolean);
20
20
  for (const className of classList) {
package/lib/index.d.ts CHANGED
@@ -15,38 +15,38 @@ declare const rules: {
15
15
  readonly 'id-duplication': Readonly<import("@markuplint/ml-core").RuleSeed<import("@markuplint/ml-core").RuleConfigValue, undefined>>;
16
16
  readonly 'ineffective-attr': Readonly<import("@markuplint/ml-core").RuleSeed<import("@markuplint/ml-core").RuleConfigValue, undefined>>;
17
17
  readonly 'invalid-attr': Readonly<import("@markuplint/ml-core").RuleSeed<boolean, {
18
- allowAttrs?: (string | {
18
+ allowAttrs?: Record<string, {
19
+ enum: [string, ...string[]];
20
+ } | {
21
+ pattern: string;
22
+ } | {
23
+ type: import("packages/@markuplint/ml-spec/lib/index.js").AttributeType;
24
+ }> | (string | {
19
25
  name: string;
20
- value: ({
26
+ value: import("packages/@markuplint/ml-spec/lib/index.js").AttributeType | ({
21
27
  enum: [string, ...string[]];
22
28
  } | {
23
29
  pattern: string;
24
30
  } | {
25
31
  type: import("packages/@markuplint/ml-spec/lib/index.js").AttributeType;
26
- }) | import("packages/@markuplint/ml-spec/lib/index.js").AttributeType;
27
- })[] | Record<string, {
32
+ });
33
+ })[] | undefined;
34
+ disallowAttrs?: Record<string, {
28
35
  enum: [string, ...string[]];
29
36
  } | {
30
37
  pattern: string;
31
38
  } | {
32
39
  type: import("packages/@markuplint/ml-spec/lib/index.js").AttributeType;
33
- }> | undefined;
34
- disallowAttrs?: (string | {
40
+ }> | (string | {
35
41
  name: string;
36
- value: ({
42
+ value: import("packages/@markuplint/ml-spec/lib/index.js").AttributeType | ({
37
43
  enum: [string, ...string[]];
38
44
  } | {
39
45
  pattern: string;
40
46
  } | {
41
47
  type: import("packages/@markuplint/ml-spec/lib/index.js").AttributeType;
42
- }) | import("packages/@markuplint/ml-spec/lib/index.js").AttributeType;
43
- })[] | Record<string, {
44
- enum: [string, ...string[]];
45
- } | {
46
- pattern: string;
47
- } | {
48
- type: import("packages/@markuplint/ml-spec/lib/index.js").AttributeType;
49
- }> | undefined;
48
+ });
49
+ })[] | undefined;
50
50
  ignoreAttrNamePrefix?: string | string[] | undefined;
51
51
  allowToAddPropertiesForPretender?: boolean | undefined;
52
52
  attrs?: Record<string, ({
@@ -72,7 +72,7 @@ declare const rules: {
72
72
  }>>;
73
73
  readonly 'no-hard-code-id': Readonly<import("@markuplint/ml-core").RuleSeed<import("@markuplint/ml-core").RuleConfigValue, undefined>>;
74
74
  readonly 'no-refer-to-non-existent-id': Readonly<import("@markuplint/ml-core").RuleSeed<import("@markuplint/ml-core").RuleConfigValue, {
75
- ariaVersion: "1.1" | "1.2" | "1.3";
75
+ ariaVersion: "1.2" | "1.1" | "1.3";
76
76
  fragmentRefersNameAttr: boolean;
77
77
  }>>;
78
78
  readonly 'no-use-event-handler-attr': Readonly<import("@markuplint/ml-core").RuleSeed<boolean, {
@@ -81,7 +81,7 @@ declare const rules: {
81
81
  readonly 'permitted-contents': Readonly<import("@markuplint/ml-core").RuleSeed<import("./permitted-contents/types.js").TagRule[], import("./permitted-contents/types.js").Options>>;
82
82
  readonly 'placeholder-label-option': Readonly<import("@markuplint/ml-core").RuleSeed<boolean, undefined>>;
83
83
  readonly 'require-accessible-name': Readonly<import("@markuplint/ml-core").RuleSeed<boolean, {
84
- ariaVersion: "1.1" | "1.2" | "1.3";
84
+ ariaVersion: "1.2" | "1.1" | "1.3";
85
85
  }>>;
86
86
  readonly 'require-datetime': Readonly<import("@markuplint/ml-core").RuleSeed<boolean, {
87
87
  langs?: import("./require-datetime/types.js").Lang[] | undefined;
@@ -152,7 +152,7 @@ function optCondition(query, specs) {
152
152
  }
153
153
  let hasCustom = false;
154
154
  let hasText = false;
155
- const selector = query.replace(/^(?::model\(([^)]+)\)|#([a-z-]+))(.*)$/, (_, $model, _model, $last) => {
155
+ const selector = query.replace(/^:model\(([^)]+)\)|^#([a-z-]+)/, (_, $model, _model) => {
156
156
  const _selectors = contentModelCategoryToTagNames(`#${$model ?? _model}`, specs.def);
157
157
  if (_selectors.length === 0) {
158
158
  throw new Error(`${$model ?? _model} is empty`);
@@ -169,7 +169,7 @@ function optCondition(query, specs) {
169
169
  }
170
170
  selectors.push(selector);
171
171
  }
172
- return `:is(${selectors.join(',')})${$last ?? ''}`;
172
+ return `:is(${selectors.join(',')})`;
173
173
  });
174
174
  const result = {
175
175
  selector,
@@ -5,32 +5,32 @@ export default createRule({
5
5
  /**
6
6
  * @see https://en.wikipedia.org/wiki/Bullet_(typography)#In_Unicode
7
7
  */
8
- '\u2022',
9
- '\u2023',
10
- '\u2043',
11
- '\u204C',
12
- '\u204D',
13
- '\u2219',
14
- '\u25CB',
15
- '\u25CF',
16
- '\u25D8',
17
- '\u25E6',
18
- '\u2619',
19
- '\u2765',
20
- '\u2767',
21
- '\u29BE',
22
- '\u29BF',
8
+ '\u2022', // • BULLET (HTML &#8226; · &bull;, &bullet;)
9
+ '\u2023', // ‣ TRIANGULAR BULLET (HTML &#8227;)
10
+ '\u2043', // ⁃ HYPHEN BULLET (HTML &#8259; · &hybull;)
11
+ '\u204C', // ⁌ BLACK LEFTWARDS BULLET (HTML &#8268;)
12
+ '\u204D', // ⁍ BLACK RIGHTWARDS BULLET (HTML &#8269;)
13
+ '\u2219', // ∙ BULLET OPERATOR (HTML &#8729;) for use in mathematical notation primarily as a dot product instead of interupt.
14
+ '\u25CB', // ○ WHITE CIRCLE (HTML &#9675; · &cir;)
15
+ '\u25CF', // ● BLACK CIRCLE (HTML &#9679;)
16
+ '\u25D8', // ◘ INVERSE BULLET (HTML &#9688;)
17
+ '\u25E6', // ◦ WHITE BULLET (HTML &#9702;)
18
+ '\u2619', // ☙ REVERSED ROTATED FLORAL HEART BULLET (HTML &#9753;); see Fleuron (typography)
19
+ '\u2765', // ❥ ROTATED HEAVY BLACK HEART BULLET (HTML &#10085;)
20
+ '\u2767', // ❧ ROTATED FLORAL HEART BULLET (HTML &#10087;); see Fleuron (typography)
21
+ '\u29BE', // ⦾ CIRCLED WHITE BULLET (HTML &#10686; · &olcir;)
22
+ '\u29BF', // ⦿ CIRCLED BULLET (HTML &#10687; · &ofcir;)
23
23
  /**
24
24
  * In Japanese
25
25
  * @see https://ja.wikipedia.org/wiki/中黒#符号位置
26
26
  */
27
- '\u00B7',
28
- '\u0387',
29
- '\u2022',
30
- '\u2219',
31
- '\u22C5',
32
- '\u30FB',
33
- '\uFF65',
27
+ '\u00B7', // MIDDLE DOT
28
+ '\u0387', // GREEK ANO TELIA
29
+ '\u2022', // BULLET
30
+ '\u2219', // BULLET OPERATOR
31
+ '\u22C5', // DOT OPERATOR
32
+ '\u30FB', // KATAKANA MIDDLE DOT
33
+ '\uFF65', // HALFWIDTH KATAKANA MIDDLE DOT
34
34
  /**
35
35
  * In Other Languages
36
36
  */
@@ -38,8 +38,8 @@ export default createRule({
38
38
  /**
39
39
  * From Markdown
40
40
  */
41
- '-',
42
- '*',
41
+ '-', // dashes
42
+ '*', // asterisks
43
43
  '+', // plus signs
44
44
  ],
45
45
  defaultOptions: {
@@ -47,8 +47,8 @@ export default createRule({
47
47
  /**
48
48
  * From Markdown
49
49
  */
50
- '-',
51
- '*',
50
+ '-', // dashes
51
+ '*', // asterisks
52
52
  '+', // plus signs
53
53
  ],
54
54
  noPrev: true,
@@ -49,7 +49,7 @@ export function checkAriaValue(type, value, tokenEnum, booleanish) {
49
49
  return tokenEnum.includes(value);
50
50
  }
51
51
  case 'token list': {
52
- const list = value.split(/\s+/g).map(s => s.trim());
52
+ const list = value.split(/\s+/).map(s => s.trim());
53
53
  return list.every(token => tokenEnum.includes(token));
54
54
  }
55
55
  case 'string':
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@markuplint/rules",
3
- "version": "4.0.0-alpha.4",
3
+ "version": "4.0.0-alpha.6",
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.0.0-alpha.4",
29
- "@markuplint/ml-core": "4.0.0-alpha.4",
30
- "@markuplint/ml-spec": "4.0.0-alpha.4",
31
- "@markuplint/selector": "4.0.0-alpha.4",
32
- "@markuplint/shared": "4.0.0-alpha.4",
33
- "@markuplint/types": "4.0.0-alpha.4",
34
- "@types/debug": "^4.1.10",
28
+ "@markuplint/html-spec": "4.0.0-alpha.6",
29
+ "@markuplint/ml-core": "4.0.0-alpha.6",
30
+ "@markuplint/ml-spec": "4.0.0-alpha.6",
31
+ "@markuplint/selector": "4.0.0-alpha.6",
32
+ "@markuplint/shared": "4.0.0-alpha.6",
33
+ "@markuplint/types": "4.0.0-alpha.6",
34
+ "@types/debug": "^4.1.12",
35
35
  "@ungap/structured-clone": "^1.2.0",
36
36
  "ansi-colors": "^4.1.3",
37
- "chrono-node": "^2.7.0",
37
+ "chrono-node": "^2.7.3",
38
38
  "debug": "^4.3.4",
39
- "type-fest": "^4.5.0"
39
+ "type-fest": "^4.8.2"
40
40
  },
41
- "gitHead": "991b3aef77fde42c79343ee8c807257a35c589d7"
41
+ "gitHead": "06e1242d274c72cf08a10a572b06ac35d1b924a4"
42
42
  }