@html-eslint/eslint-plugin 0.43.0 → 0.44.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.
@@ -64,6 +64,15 @@ class HTMLLanguage {
64
64
  "Expected an key-value record value for 'templateEngineSyntax' option."
65
65
  );
66
66
  }
67
+ if (
68
+ "rawContentTags" in languageOptions &&
69
+ (!Array.isArray(languageOptions.rawContentTags) ||
70
+ !languageOptions.rawContentTags.every((tag) => typeof tag === "string"))
71
+ ) {
72
+ throw new TypeError(
73
+ "Expected an array of strings for 'rawContentTags' option."
74
+ );
75
+ }
67
76
  }
68
77
 
69
78
  /**
@@ -149,8 +149,13 @@ module.exports = {
149
149
  * @returns {boolean}
150
150
  */
151
151
  function shouldSkipChildren(node) {
152
- if (isTag(node) && skipTags.includes(node.name.toLowerCase())) {
153
- return true;
152
+ if (isTag(node)) {
153
+ if (skipTags.includes(node.name.toLowerCase())) {
154
+ return true;
155
+ }
156
+ if (node.children.some((child) => child.type === "RawContent")) {
157
+ return true;
158
+ }
154
159
  }
155
160
  return false;
156
161
  }
@@ -6,6 +6,7 @@
6
6
  const { RULE_CATEGORY } = require("../constants");
7
7
  const { createVisitors } = require("./utils/visitors");
8
8
  const { getRuleUrl } = require("./utils/rule");
9
+ const { hasTemplate } = require("./utils/node");
9
10
 
10
11
  const MESSAGE_IDS = {
11
12
  DUPLICATE_ATTRS: "duplicateAttrs",
@@ -61,7 +62,10 @@ module.exports = {
61
62
  if (Array.isArray(node.attributes)) {
62
63
  const attrsSet = new Set();
63
64
  node.attributes.forEach((attr) => {
64
- if (attr.key && attrsSet.has(attr.key.value.toLowerCase())) {
65
+ if (hasTemplate(attr.key)) {
66
+ return;
67
+ }
68
+ if (attrsSet.has(attr.key.value.toLowerCase())) {
65
69
  context.report({
66
70
  node: attr,
67
71
  data: {
@@ -12,11 +12,6 @@ const DEFAULT_SETTINGS = {
12
12
  },
13
13
  };
14
14
 
15
- /**
16
- * @type {HTMLSettings | null}
17
- */
18
- let cachedSettings = null;
19
-
20
15
  /**
21
16
  * @param {{ html?: MaybeHTMLSettings }} settings
22
17
  * @returns {HTMLSettings}
@@ -36,16 +31,12 @@ function getSettings(settings) {
36
31
  settings.html.templateLiterals.comments) ||
37
32
  DEFAULT_SETTINGS.templateLiterals.comments;
38
33
 
39
- if (cachedSettings) {
40
- return cachedSettings;
41
- }
42
- cachedSettings = {
34
+ return {
43
35
  templateLiterals: {
44
36
  tags: tags.map((tag) => new RegExp(tag, "u")),
45
37
  comments: comments.map((comment) => new RegExp(comment, "u")),
46
38
  },
47
39
  };
48
- return cachedSettings;
49
40
  }
50
41
 
51
42
  /**
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@html-eslint/eslint-plugin",
3
- "version": "0.43.0",
3
+ "version": "0.44.0",
4
4
  "type": "commonjs",
5
5
  "description": "ESLint plugin for HTML",
6
6
  "author": "yeonjuan",
@@ -40,18 +40,18 @@
40
40
  ],
41
41
  "dependencies": {
42
42
  "@eslint/plugin-kit": "^0.3.1",
43
- "@html-eslint/parser": "^0.43.0",
44
- "@html-eslint/template-parser": "^0.43.0",
45
- "@html-eslint/template-syntax-parser": "^0.43.0"
43
+ "@html-eslint/parser": "^0.44.0",
44
+ "@html-eslint/template-parser": "^0.44.0",
45
+ "@html-eslint/template-syntax-parser": "^0.44.0"
46
46
  },
47
47
  "peerDependencies": {
48
48
  "eslint": "^8.0.0 || ^9.0.0"
49
49
  },
50
50
  "devDependencies": {
51
51
  "@eslint/core": "^0.14.0",
52
- "@html-eslint/types": "^0.43.0",
52
+ "@html-eslint/types": "^0.44.0",
53
53
  "@types/estree": "^0.0.47",
54
- "es-html-parser": "0.2.0",
54
+ "es-html-parser": "0.3.0",
55
55
  "eslint": "^9.27.0",
56
56
  "espree": "^10.3.0",
57
57
  "typescript": "^5.8.3"
@@ -59,5 +59,5 @@
59
59
  "engines": {
60
60
  "node": "^18.18.0 || ^20.9.0 || >=21.1.0"
61
61
  },
62
- "gitHead": "662b74c8f2da26c4c61e211d3413bba71f621e5f"
62
+ "gitHead": "e75bca7964df38596359bdaef5f539149a206f29"
63
63
  }
@@ -1 +1 @@
1
- {"version":3,"file":"html-language.d.ts","sourceRoot":"","sources":["../../lib/languages/html-language.js"],"names":[],"mappings":"AASA;;GAEG;AACH;IAEI;;;OAGG;IACH,UAFU,MAAM,CAEM;IAEtB;;;OAGG;IACH,WAFU,CAAC,GAAC,CAAC,CAEK;IAElB;;;OAGG;IACH,aAFU,CAAC,GAAC,CAAC,CAEO;IAEpB;;OAEG;IACH,aAFU,MAAM,CAES;IAEzB;;;OAGG;IACH,aAFU,MAAM,CAAC,MAAM,EAAE,MAAM,EAAE,CAAC,CAEJ;IAGhC;;OAEG;IACH,yCAFW,aAAa,QAqBvB;IAED;;;;;OAKG;IACH,YALW,IAAI,YAEZ;QAA+B,eAAe,EAAtC,aAAa;KACrB,GAAU,YAAY,WAAW,CAAC,CAkBpC;IAED;;;OAGG;IACH,uBAHW,IAAI,eACJ,cAAc,WAAW,CAAC,kBAQpC;CACF;8BAtGyE,cAAc;mCACtD,qBAAqB;0BADmB,cAAc;yBAEhE,QAAQ;iCAF0C,cAAc;mCAAd,cAAc"}
1
+ {"version":3,"file":"html-language.d.ts","sourceRoot":"","sources":["../../lib/languages/html-language.js"],"names":[],"mappings":"AASA;;GAEG;AACH;IAEI;;;OAGG;IACH,UAFU,MAAM,CAEM;IAEtB;;;OAGG;IACH,WAFU,CAAC,GAAC,CAAC,CAEK;IAElB;;;OAGG;IACH,aAFU,CAAC,GAAC,CAAC,CAEO;IAEpB;;OAEG;IACH,aAFU,MAAM,CAES;IAEzB;;;OAGG;IACH,aAFU,MAAM,CAAC,MAAM,EAAE,MAAM,EAAE,CAAC,CAEJ;IAGhC;;OAEG;IACH,yCAFW,aAAa,QA8BvB;IAED;;;;;OAKG;IACH,YALW,IAAI,YAEZ;QAA+B,eAAe,EAAtC,aAAa;KACrB,GAAU,YAAY,WAAW,CAAC,CAkBpC;IAED;;;OAGG;IACH,uBAHW,IAAI,eACJ,cAAc,WAAW,CAAC,kBAQpC;CACF;8BA/GyE,cAAc;mCACtD,qBAAqB;0BADmB,cAAc;yBAEhE,QAAQ;iCAF0C,cAAc;mCAAd,cAAc"}
@@ -1 +1 @@
1
- {"version":3,"file":"no-duplicate-attrs.d.ts","sourceRoot":"","sources":["../../lib/rules/no-duplicate-attrs.js"],"names":[],"mappings":"wBAeU,WAAW,EAAE,CAAC;;gCAbiC,UAAU"}
1
+ {"version":3,"file":"no-duplicate-attrs.d.ts","sourceRoot":"","sources":["../../lib/rules/no-duplicate-attrs.js"],"names":[],"mappings":"wBAgBU,WAAW,EAAE,CAAC;;gCAdiC,UAAU"}
@@ -1 +1 @@
1
- {"version":3,"file":"settings.d.ts","sourceRoot":"","sources":["../../../lib/rules/utils/settings.js"],"names":[],"mappings":"AAgEA;;;;;GAKG;AACH,iDAJW,eAAe,WACf,QAAQ,GAAG,EAAE,CAAC,GACZ,OAAO,CAWnB;AA7BD;;;;GAIG;AACH,0DAJW,wBAAwB,WACxB,QAAQ,GAAG,EAAE,CAAC,GACZ,OAAO,CASnB;qCA5D2D,oBAAoB;6BADrB,aAAa;8CACZ,oBAAoB"}
1
+ {"version":3,"file":"settings.d.ts","sourceRoot":"","sources":["../../../lib/rules/utils/settings.js"],"names":[],"mappings":"AAuDA;;;;;GAKG;AACH,iDAJW,eAAe,WACf,QAAQ,GAAG,EAAE,CAAC,GACZ,OAAO,CAWnB;AA7BD;;;;GAIG;AACH,0DAJW,wBAAwB,WACxB,QAAQ,GAAG,EAAE,CAAC,GACZ,OAAO,CASnB;qCAnD2D,oBAAoB;6BADrB,aAAa;8CACZ,oBAAoB"}