@markuplint/rules 4.0.0-alpha.7 → 4.0.0-alpha.8

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.
@@ -1,5 +1,8 @@
1
1
  import { createRule } from '@markuplint/ml-core';
2
2
  export default createRule({
3
+ meta: {
4
+ category: 'validation',
5
+ },
3
6
  async verify({ document, report, t }) {
4
7
  const message = t('{0} is {1:c}', t('the {0}', 'attribute name'), 'duplicated');
5
8
  await document.walkOn('Element', node => {
@@ -4,6 +4,9 @@ const quoteList = {
4
4
  single: "'",
5
5
  };
6
6
  export default createRule({
7
+ meta: {
8
+ category: 'style',
9
+ },
7
10
  defaultSeverity: 'warning',
8
11
  defaultValue: 'double',
9
12
  async verify({ document, report, t }) {
@@ -1,5 +1,8 @@
1
1
  import { createRule, getAttrSpecs } from '@markuplint/ml-core';
2
2
  export default createRule({
3
+ meta: {
4
+ category: 'style',
5
+ },
3
6
  defaultSeverity: 'warning',
4
7
  defaultValue: 'lower',
5
8
  async verify({ document, report, t }) {
@@ -1,5 +1,8 @@
1
1
  import { createRule } from '@markuplint/ml-core';
2
2
  export default createRule({
3
+ meta: {
4
+ category: 'style',
5
+ },
3
6
  defaultSeverity: 'warning',
4
7
  defaultValue: 'lower',
5
8
  async verify({ document, report, t }) {
@@ -2,6 +2,9 @@ import { createRule, getLocationFromChars } from '@markuplint/ml-core';
2
2
  const defaultChars = ['"', '&', '<', '>'];
3
3
  const ignoreParentElement = new Set(['script', 'style']);
4
4
  export default createRule({
5
+ meta: {
6
+ category: 'style',
7
+ },
5
8
  async verify({ document, report, t }) {
6
9
  const targetNodes = [];
7
10
  await document.walkOn('Text', node => {
@@ -2,6 +2,9 @@ import { createRule } from '@markuplint/ml-core';
2
2
  import { toNoEmptyStringArrayFromStringOrArray } from '@markuplint/shared';
3
3
  import { match } from '../helpers.js';
4
4
  export default createRule({
5
+ meta: {
6
+ category: 'naming-convention',
7
+ },
5
8
  defaultSeverity: 'warning',
6
9
  defaultValue: null,
7
10
  async verify({ document, report, t }) {
@@ -1,5 +1,8 @@
1
1
  import { createRule, getAttrSpecs } from '@markuplint/ml-core';
2
2
  export default createRule({
3
+ meta: {
4
+ category: 'validation',
5
+ },
3
6
  async verify({ document, report, t }) {
4
7
  await document.walkOn('Attr', attr => {
5
8
  const attrSpecs = getAttrSpecs(attr.ownerElement, document.specs);
@@ -1,5 +1,8 @@
1
1
  import { createRule, getSpec } from '@markuplint/ml-core';
2
2
  export default createRule({
3
+ meta: {
4
+ category: 'validation',
5
+ },
3
6
  async verify({ document, report, t }) {
4
7
  await document.walkOn('Element', el => {
5
8
  if (!(el.namespaceURI === 'http://www.w3.org/1999/xhtml' ||
@@ -1,5 +1,8 @@
1
1
  import { createRule } from '@markuplint/ml-core';
2
2
  export default createRule({
3
+ meta: {
4
+ category: 'validation',
5
+ },
3
6
  defaultValue: [],
4
7
  async verify({ document, report, t }) {
5
8
  for (const query of document.rule.value) {
@@ -1,5 +1,8 @@
1
1
  import { createRule } from '@markuplint/ml-core';
2
2
  export default createRule({
3
+ meta: {
4
+ category: 'validation',
5
+ },
3
6
  defaultValue: 'always',
4
7
  defaultOptions: {
5
8
  denyObsoleteType: true,
@@ -1,6 +1,9 @@
1
1
  import { createRule } from '@markuplint/ml-core';
2
2
  import { isVoidElement } from '@markuplint/ml-spec';
3
3
  export default createRule({
4
+ meta: {
5
+ category: 'style',
6
+ },
4
7
  defaultSeverity: 'warning',
5
8
  async verify({ document, report, t }) {
6
9
  if (document.endTag === 'never') {
@@ -1,5 +1,8 @@
1
1
  import { createRule } from '@markuplint/ml-core';
2
2
  export default createRule({
3
+ meta: {
4
+ category: 'validation',
5
+ },
3
6
  async verify({ document, report, t }) {
4
7
  const message = t('{0} is {1:c}', t('{0} of {1}', t('the {0}', 'value'), t('the "{0*}" {1}', 'id', 'attribute')), 'duplicated');
5
8
  const idStack = [];
@@ -1,6 +1,9 @@
1
1
  import { createRule, getAttrSpecs } from '@markuplint/ml-core';
2
2
  import { toNoEmptyStringArrayFromStringOrArray } from '@markuplint/shared';
3
3
  export default createRule({
4
+ meta: {
5
+ category: 'style',
6
+ },
4
7
  defaultSeverity: 'warning',
5
8
  async verify({ document, report, t }) {
6
9
  await document.walkOn('Attr', attr => {
@@ -4,6 +4,9 @@ import { log as ruleLog } from '../debug.js';
4
4
  import { isValidAttr, match } from '../helpers.js';
5
5
  const log = ruleLog.extend('invalid-attr');
6
6
  export default createRule({
7
+ meta: {
8
+ category: 'validation',
9
+ },
7
10
  defaultOptions: {},
8
11
  async verify({ document, report, t }) {
9
12
  await document.walkOn('Attr', attr => {
@@ -1,6 +1,9 @@
1
1
  import { createRule } from '@markuplint/ml-core';
2
2
  const controlSelector = ["input:not([type='hidden' i])", 'select', 'textarea'].join(',');
3
3
  export default createRule({
4
+ meta: {
5
+ category: 'a11y',
6
+ },
4
7
  defaultSeverity: 'warning',
5
8
  async verify({ document, report, t }) {
6
9
  await document.walkOn('Element', el => {
@@ -10,6 +10,9 @@ const selectors = {
10
10
  };
11
11
  const topLevelRoles = ['banner', 'main', 'complementary', 'contentinfo'];
12
12
  export default createRule({
13
+ meta: {
14
+ category: 'a11y',
15
+ },
13
16
  defaultSeverity: 'warning',
14
17
  defaultOptions: {
15
18
  ignoreRoles: [],
@@ -1,5 +1,8 @@
1
1
  import { createRule, getAttrSpecs } from '@markuplint/ml-core';
2
2
  export default createRule({
3
+ meta: {
4
+ category: 'style',
5
+ },
3
6
  defaultSeverity: 'warning',
4
7
  async verify({ document, report, t }) {
5
8
  await document.walkOn('Attr', attr => {
@@ -1,6 +1,9 @@
1
1
  import { createRule, getAttrSpecs } from '@markuplint/ml-core';
2
2
  import { toNormalizedValue } from '../helpers.js';
3
3
  export default createRule({
4
+ meta: {
5
+ category: 'style',
6
+ },
4
7
  defaultSeverity: 'warning',
5
8
  async verify({ document, report, t }) {
6
9
  await document.walkOn('Attr', attr => {
@@ -1,6 +1,9 @@
1
1
  import { createRule } from '@markuplint/ml-core';
2
2
  import { isNothingContentModel, isPalpableElement } from '@markuplint/ml-spec';
3
3
  export default createRule({
4
+ meta: {
5
+ category: 'validation',
6
+ },
4
7
  defaultSeverity: 'warning',
5
8
  defaultOptions: {
6
9
  extendsExposableElements: true,
@@ -1,5 +1,8 @@
1
1
  import { createRule } from '@markuplint/ml-core';
2
2
  export default createRule({
3
+ meta: {
4
+ category: 'maintainability',
5
+ },
3
6
  defaultSeverity: 'warning',
4
7
  async verify({ document, report, t }) {
5
8
  if (!document.isFragment) {
@@ -3,6 +3,9 @@ import { ARIA_RECOMMENDED_VERSION } from '@markuplint/ml-spec';
3
3
  import { decodeEntities, decodeHref } from '@markuplint/shared';
4
4
  const HYPERLINK_SELECTOR = 'a[href], area[href]';
5
5
  export default createRule({
6
+ meta: {
7
+ category: 'a11y',
8
+ },
6
9
  defaultOptions: {
7
10
  ariaVersion: ARIA_RECOMMENDED_VERSION,
8
11
  fragmentRefersNameAttr: false,
@@ -1,6 +1,9 @@
1
1
  import { createRule } from '@markuplint/ml-core';
2
2
  import { match } from '../helpers.js';
3
3
  export default createRule({
4
+ meta: {
5
+ category: 'maintainability',
6
+ },
4
7
  defaultSeverity: 'warning',
5
8
  defaultOptions: {},
6
9
  async verify({ document, report, t }) {
@@ -2,6 +2,9 @@ import { createRule } from '@markuplint/ml-core';
2
2
  import { contentModel } from './content-model.js';
3
3
  import { transparentMode } from './represent-transparent-nodes.js';
4
4
  export default createRule({
5
+ meta: {
6
+ category: 'validation',
7
+ },
5
8
  defaultValue: [],
6
9
  defaultOptions: {
7
10
  ignoreHasMutableChildren: true,
@@ -1,5 +1,8 @@
1
1
  import { createRule } from '@markuplint/ml-core';
2
2
  export default createRule({
3
+ meta: {
4
+ category: 'validation',
5
+ },
3
6
  verify({ document, report, t }) {
4
7
  for (const select of document.querySelectorAll('select')) {
5
8
  if (hasPlaceholderLabelOption(select)) {
@@ -2,6 +2,9 @@ import { createRule, getRoleSpec, getComputedRole } from '@markuplint/ml-core';
2
2
  import { ARIA_RECOMMENDED_VERSION, isExposed } from '@markuplint/ml-spec';
3
3
  import { accnameMayBeMutable } from '../helpers.js';
4
4
  export default createRule({
5
+ meta: {
6
+ category: 'a11y',
7
+ },
5
8
  defaultOptions: {
6
9
  ariaVersion: ARIA_RECOMMENDED_VERSION,
7
10
  },
@@ -2,6 +2,9 @@ import { createRule } from '@markuplint/ml-core';
2
2
  import { check } from '@markuplint/types';
3
3
  import { getCandidateDatetimeString } from './utils.js';
4
4
  export default createRule({
5
+ meta: {
6
+ category: 'validation',
7
+ },
5
8
  defaultOptions: {
6
9
  langs: undefined,
7
10
  },
@@ -1,6 +1,9 @@
1
1
  import { createRule, getAttrSpecs } from '@markuplint/ml-core';
2
2
  import { attrMatches, match } from '../helpers.js';
3
3
  export default createRule({
4
+ meta: {
5
+ category: 'validation',
6
+ },
4
7
  defaultValue: [],
5
8
  async verify({ document, report, t }) {
6
9
  await document.walkOn('Element', el => {
@@ -1,5 +1,8 @@
1
1
  import { createRule } from '@markuplint/ml-core';
2
2
  export default createRule({
3
+ meta: {
4
+ category: 'validation',
5
+ },
3
6
  defaultValue: [],
4
7
  defaultOptions: {
5
8
  ignoreHasMutableContents: true,
@@ -1,5 +1,8 @@
1
1
  import { createRule } from '@markuplint/ml-core';
2
2
  export default createRule({
3
+ meta: {
4
+ category: 'a11y',
5
+ },
3
6
  defaultOptions: {
4
7
  'expected-once': true,
5
8
  'in-document-fragment': false,
@@ -1,6 +1,9 @@
1
1
  import { createRule } from '@markuplint/ml-core';
2
2
  import { decodeEntities } from '@markuplint/shared';
3
3
  export default createRule({
4
+ meta: {
5
+ category: 'a11y',
6
+ },
4
7
  defaultValue: [
5
8
  /**
6
9
  * @see https://en.wikipedia.org/wiki/Bullet_(typography)#In_Unicode
@@ -16,6 +16,9 @@ import { checkingRequiredOwnedElements } from './checkings/required-owned-elemen
16
16
  import { checkingRequiredProp } from './checkings/required-prop.js';
17
17
  import { checkingValue } from './checkings/value.js';
18
18
  export default createRule({
19
+ meta: {
20
+ category: 'a11y',
21
+ },
19
22
  defaultOptions: {
20
23
  checkingValue: true,
21
24
  checkingDeprecatedProps: true,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@markuplint/rules",
3
- "version": "4.0.0-alpha.7",
3
+ "version": "4.0.0-alpha.8",
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.7",
29
- "@markuplint/ml-core": "4.0.0-alpha.7",
30
- "@markuplint/ml-spec": "4.0.0-alpha.7",
31
- "@markuplint/selector": "4.0.0-alpha.7",
32
- "@markuplint/shared": "4.0.0-alpha.7",
33
- "@markuplint/types": "4.0.0-alpha.7",
28
+ "@markuplint/html-spec": "4.0.0-alpha.8",
29
+ "@markuplint/ml-core": "4.0.0-alpha.8",
30
+ "@markuplint/ml-spec": "4.0.0-alpha.8",
31
+ "@markuplint/selector": "4.0.0-alpha.8",
32
+ "@markuplint/shared": "4.0.0-alpha.8",
33
+ "@markuplint/types": "4.0.0-alpha.8",
34
34
  "@types/debug": "^4.1.12",
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.9.0"
40
40
  },
41
- "gitHead": "571129bf6498541125e1e7c3907d5ed9af53459a"
41
+ "gitHead": "5bcd25f13ff804af0d09aaabd87e495af668e6a8"
42
42
  }