@html-eslint/eslint-plugin 0.17.2 → 0.18.0

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.
@@ -16,7 +16,19 @@ module.exports = {
16
16
  },
17
17
 
18
18
  fixable: true,
19
- schema: [],
19
+ schema: [
20
+ {
21
+ type: "object",
22
+ properties: {
23
+ skip: {
24
+ type: "array",
25
+ items: {
26
+ type: "string",
27
+ },
28
+ },
29
+ },
30
+ },
31
+ ],
20
32
  messages: {
21
33
  [MESSAGE_IDS.EXPECT_NEW_LINE_AFTER]:
22
34
  "There should be a linebreak after {{tag}}.",
@@ -26,6 +38,11 @@ module.exports = {
26
38
  },
27
39
 
28
40
  create(context) {
41
+ const option = context.options[0] || { skip: [] };
42
+ const skipTags = option.skip;
43
+
44
+ let isInSkipTags = false;
45
+
29
46
  function checkSiblings(siblings) {
30
47
  siblings
31
48
  .filter((node) => node.type !== "Text")
@@ -78,10 +95,24 @@ module.exports = {
78
95
  }
79
96
  return {
80
97
  [["Tag", "Program"].join(",")](node) {
98
+ if (isInSkipTags) {
99
+ return;
100
+ }
101
+
81
102
  const children = node.type === "Program" ? node.body : node.children;
82
103
  checkSiblings(children);
104
+ if (skipTags.includes(node.name)) {
105
+ isInSkipTags = true;
106
+ return;
107
+ }
83
108
  checkChild(node, children);
84
109
  },
110
+ "Tag:exit"(node) {
111
+ if (skipTags.includes(node.name)) {
112
+ isInSkipTags = false;
113
+ return;
114
+ }
115
+ },
85
116
  };
86
117
  },
87
118
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@html-eslint/eslint-plugin",
3
- "version": "0.17.2",
3
+ "version": "0.18.0",
4
4
  "description": "ESLint plugin for html",
5
5
  "author": "yeonjuan",
6
6
  "homepage": "https://github.com/yeonjuan/html-eslint#readme",
@@ -40,11 +40,11 @@
40
40
  "accessibility"
41
41
  ],
42
42
  "devDependencies": {
43
- "@html-eslint/parser": "^0.17.1",
43
+ "@html-eslint/parser": "^0.18.0",
44
44
  "@types/eslint": "^7.2.10",
45
45
  "@types/estree": "^0.0.47",
46
46
  "es-html-parser": "^0.0.8",
47
47
  "typescript": "^4.4.4"
48
48
  },
49
- "gitHead": "11ef4b320550daeabe9afa2896b3a0decc48ba75"
49
+ "gitHead": "81c110ef8ac1bf444ead6e3df07459a2d80fd2ed"
50
50
  }