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

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,
@@ -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.5",
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,12 +25,12 @@
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",
28
+ "@markuplint/html-spec": "4.0.0-alpha.5",
29
+ "@markuplint/ml-core": "4.0.0-alpha.5",
30
+ "@markuplint/ml-spec": "4.0.0-alpha.5",
31
+ "@markuplint/selector": "4.0.0-alpha.5",
32
+ "@markuplint/shared": "4.0.0-alpha.5",
33
+ "@markuplint/types": "4.0.0-alpha.5",
34
34
  "@types/debug": "^4.1.10",
35
35
  "@ungap/structured-clone": "^1.2.0",
36
36
  "ansi-colors": "^4.1.3",
@@ -38,5 +38,5 @@
38
38
  "debug": "^4.3.4",
39
39
  "type-fest": "^4.5.0"
40
40
  },
41
- "gitHead": "991b3aef77fde42c79343ee8c807257a35c589d7"
41
+ "gitHead": "0c3e4690662edf1765bcc4b6411ec5507c1e2ea3"
42
42
  }