@d-zero/markuplint-config 5.0.0-alpha.3 → 5.0.0-alpha.31

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/LICENSE CHANGED
@@ -1,6 +1,6 @@
1
1
  MIT License
2
2
 
3
- Copyright (c) 2023 D-ZERO Co., Ltd.
3
+ Copyright (c) 2024 D-ZERO Co., Ltd.
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
package/README.md CHANGED
@@ -1,4 +1,33 @@
1
1
  # `@d-zero/markuplint-config`
2
2
 
3
- - 使用: 🆗 使用可
4
- - 解説: 🚧 準備中
3
+ ## 個別インストール
4
+
5
+ ```sh
6
+ yarn add -D @d-zero/markuplint-config
7
+ ```
8
+
9
+ ## 使い方
10
+
11
+ `.markuplintrc`を作成し、[`extends`](https://markuplint.dev/ja/docs/configuration/properties#extends)機能を使って読み込みます。
12
+
13
+ ```json
14
+ {
15
+ "extends": ["@d-zero/markuplint-config"]
16
+ }
17
+ ```
18
+
19
+ ### 拡張
20
+
21
+ プロジェクトに合わせて設定を追加します。
22
+
23
+ ```json
24
+ {
25
+ "extends": ["@d-zero/markuplint-config"],
26
+ "rules": {
27
+ // 例: クラス名の命名規則を変更する
28
+ "class-naming": {
29
+ "value": "/^c-(?<ComponentName>[a-z][a-z0-9]*(?:-[a-z0-9]+)*)$/"
30
+ }
31
+ }
32
+ }
33
+ ```
package/base.js ADDED
@@ -0,0 +1,11 @@
1
+ export default {
2
+ extends: ['markuplint:recommended-static-html'],
3
+ nodeRules: [
4
+ {
5
+ selector: "script[src^='https://']",
6
+ rules: {
7
+ 'required-attr': false,
8
+ },
9
+ },
10
+ ],
11
+ };
package/index.js ADDED
@@ -0,0 +1,38 @@
1
+ import base from './base.js';
2
+ import name from './name.js';
3
+ import pug from './pug.js';
4
+
5
+ /**
6
+ * @type {import('@markuplint/ml-config').Config}
7
+ */
8
+ export default {
9
+ ...base,
10
+ ...pug,
11
+ ...name,
12
+ parser: {
13
+ ...base.parser,
14
+ ...pug.parser,
15
+ ...name.parser,
16
+ },
17
+ rules: {
18
+ ...base.rules,
19
+ ...pug.rules,
20
+ ...name.rules,
21
+ },
22
+ nodeRules: [
23
+ //
24
+ ...(base.nodeRules ?? []),
25
+ ...(pug.nodeRules ?? []),
26
+ ...(name.nodeRules ?? []),
27
+ ],
28
+ childNodeRules: [
29
+ //
30
+ ...(base.childNodeRules ?? []),
31
+ ...(pug.childNodeRules ?? []),
32
+ ...(name.childNodeRules ?? []),
33
+ ],
34
+ overrideMode: 'merge',
35
+ overrides: {
36
+ ...pug.overrides,
37
+ },
38
+ };
package/name.js ADDED
@@ -0,0 +1,46 @@
1
+ /**
2
+ * @type {import('@markuplint/ml-config').Config}
3
+ */
4
+ export default {
5
+ rules: {
6
+ 'class-naming': {
7
+ severity: 'error',
8
+ value: '/^c-(?<ComponentName>[a-z][a-z0-9]*(?:-[a-z0-9]+)*)$/',
9
+ reason:
10
+ 'クラス名の形式はディーゼロのコーディングガイドラインに則って命名する必要があります。 http://tmpl.d-zero.com/__guideline/coding-guideline/html.html#%F0%9F%92%8E-%E3%82%B3%E3%83%B3%E3%83%9B%E3%82%9A%E3%83%BC%E3%83%8D%E3%83%B3%E3%83%88',
11
+ },
12
+ },
13
+ childNodeRules: [
14
+ {
15
+ regexSelector: {
16
+ attrName: 'class',
17
+ attrValue: '/^c-(?<ComponentName>[a-z][a-z0-9]*(?:-[a-z0-9]+)*)$/',
18
+ },
19
+ inheritance: true,
20
+ rules: {
21
+ 'class-naming': {
22
+ severity: 'error',
23
+ value: [
24
+ '/^c-{{ ComponentName }}__[a-z][a-z0-9]*(?:-[a-z0-9]+)*$/',
25
+ '/^c-(?!{{ ComponentName }})[a-z][a-z0-9]*(?:-[a-z0-9]+)*$/',
26
+ '/^c-{{ ComponentName }}[a-z0-9]*(?:-[a-z0-9]+)*$/',
27
+ ],
28
+ reason:
29
+ 'ディーゼロのコーディングガイドラインではコンポーネントの中はそのコンポーネントのエレメントか、他のコンポーネントである必要があります。 http://tmpl.d-zero.com/__guideline/coding-guideline/html.html#%E3%82%B3%E3%83%B3%E3%83%9B%E3%82%9A%E3%83%BC%E3%83%8D%E3%83%B3%E3%83%88%E3%81%AE%E6%A7%8B%E6%88%90%E3%81%A8%E3%82%AF%E3%83%A9%E3%82%B9%E5%91%BD%E5%90%8D%E8%A6%8F%E5%89%87',
30
+ },
31
+ },
32
+ },
33
+ {
34
+ selector: "[class='c-content-main']",
35
+ inheritance: true,
36
+ rules: {
37
+ 'class-naming': {
38
+ severity: 'error',
39
+ value: '/^(?!c-).+$|^$/',
40
+ reason:
41
+ 'ディーゼロのコーディングガイドラインでは「c-content-main」の中は「c-」で始めないルールとなっています。 http://tmpl.d-zero.com/__guideline/coding-guideline/html.html#%E3%82%A8%E3%83%AC%E3%83%A1%E3%83%B3%E3%83%88%E3%81%AE%E3%82%AF%E3%83%A9%E3%82%B9%E3%81%AE%E4%BE%8B%E5%A4%96%E3%81%A8%E3%82%AF%E3%83%A9%E3%82%B9%E8%BF%BD%E5%8A%A0%E3%81%AE%E3%83%AB%E3%83%BC%E3%83%AB',
42
+ },
43
+ },
44
+ },
45
+ ],
46
+ };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@d-zero/markuplint-config",
3
- "version": "5.0.0-alpha.3",
3
+ "version": "5.0.0-alpha.31",
4
4
  "description": "Configurations of Markuplint",
5
5
  "repository": "https://github.com/d-zero-dev/linters.git",
6
6
  "author": "D-ZERO Co., Ltd.",
@@ -9,13 +9,22 @@
9
9
  "publishConfig": {
10
10
  "access": "public"
11
11
  },
12
+ "engines": {
13
+ "node": ">=22.0.0"
14
+ },
15
+ "type": "module",
16
+ "exports": {
17
+ ".": "./index.js",
18
+ "./base": "./base.js",
19
+ "./name": "./name.js",
20
+ "./pug": "./pug.js"
21
+ },
12
22
  "files": [
13
- ".markuplintrc.json"
23
+ "*.js"
14
24
  ],
15
- "main": ".markuplintrc.json",
16
25
  "dependencies": {
17
- "@markuplint/pug-parser": "4.0.0-alpha.11",
18
- "markuplint": "4.0.0-alpha.11"
26
+ "@markuplint/pug-parser": "4.6.2",
27
+ "markuplint": "4.8.1"
19
28
  },
20
- "gitHead": "5defdbdfc5b5afe08035e476f289cbad0c7d2e27"
29
+ "gitHead": "a889b518610d8e7884938881540f0a0248dc0d7e"
21
30
  }
package/pug.js ADDED
@@ -0,0 +1,18 @@
1
+ import path from 'node:path';
2
+
3
+ /**
4
+ * @type {import('@markuplint/ml-config').Config}
5
+ */
6
+ export default {
7
+ parser: {
8
+ '.pug$': '@markuplint/pug-parser',
9
+ },
10
+ overrideMode: 'merge',
11
+ overrides: {
12
+ [path.resolve(process.cwd(), '**', '*.pug')]: {
13
+ rules: {
14
+ 'character-reference': false,
15
+ },
16
+ },
17
+ },
18
+ };
@@ -1,52 +0,0 @@
1
- {
2
- "extends": ["markuplint:recommended"],
3
- "parser": {
4
- ".pug$": "@markuplint/pug-parser"
5
- },
6
- "rules": {
7
- "class-naming": {
8
- "severity": "error",
9
- "value": "/^c-(?<ComponentName>[a-z][a-z0-9]*(?:-[a-z0-9]+)*)$/",
10
- "reason": "クラス名の形式はディーゼロのコーディングガイドラインに則って命名する必要があります。 http://tmpl.d-zero.com/__guideline/coding-guideline/html.html#%F0%9F%92%8E-%E3%82%B3%E3%83%B3%E3%83%9B%E3%82%9A%E3%83%BC%E3%83%8D%E3%83%B3%E3%83%88"
11
- }
12
- },
13
- "nodeRules": [
14
- {
15
- "selector": "script[src^='https://']",
16
- "rules": {
17
- "required-attr": false
18
- }
19
- }
20
- ],
21
- "childNodeRules": [
22
- {
23
- "regexSelector": {
24
- "attrName": "class",
25
- "attrValue": "/^c-(?<ComponentName>[a-z][a-z0-9]*(?:-[a-z0-9]+)*)$/"
26
- },
27
- "inheritance": true,
28
- "rules": {
29
- "class-naming": {
30
- "severity": "error",
31
- "value": [
32
- "/^c-{{ ComponentName }}__[a-z][a-z0-9]*(?:-[a-z0-9]+)*$/",
33
- "/^c-(?!{{ ComponentName }})[a-z][a-z0-9]*(?:-[a-z0-9]+)*$/",
34
- "/^c-{{ ComponentName }}[a-z0-9]*(?:-[a-z0-9]+)*$/"
35
- ],
36
- "reason": "ディーゼロのコーディングガイドラインではコンポーネントの中はそのコンポーネントのエレメントか、他のコンポーネントである必要があります。 http://tmpl.d-zero.com/__guideline/coding-guideline/html.html#%E3%82%B3%E3%83%B3%E3%83%9B%E3%82%9A%E3%83%BC%E3%83%8D%E3%83%B3%E3%83%88%E3%81%AE%E6%A7%8B%E6%88%90%E3%81%A8%E3%82%AF%E3%83%A9%E3%82%B9%E5%91%BD%E5%90%8D%E8%A6%8F%E5%89%87"
37
- }
38
- }
39
- },
40
- {
41
- "selector": "[class='c-content-main']",
42
- "inheritance": true,
43
- "rules": {
44
- "class-naming": {
45
- "severity": "error",
46
- "value": "/^(?!c-).+$|^$/",
47
- "reason": "ディーゼロのコーディングガイドラインでは「c-content-main」の中は「c-」で始めないルールとなっています。 http://tmpl.d-zero.com/__guideline/coding-guideline/html.html#%E3%82%A8%E3%83%AC%E3%83%A1%E3%83%B3%E3%83%88%E3%81%AE%E3%82%AF%E3%83%A9%E3%82%B9%E3%81%AE%E4%BE%8B%E5%A4%96%E3%81%A8%E3%82%AF%E3%83%A9%E3%82%B9%E8%BF%BD%E5%8A%A0%E3%81%AE%E3%83%AB%E3%83%BC%E3%83%AB"
48
- }
49
- }
50
- }
51
- ]
52
- }