Socket
Socket
Sign inDemoInstall

@html-eslint/parser

Package Overview
Dependencies
Maintainers
1
Versions
42
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@html-eslint/parser - npm Package Compare versions

Comparing version 0.4.0 to 0.4.1

33

lib/ast-converter/node-converter.js

@@ -8,3 +8,2 @@ const utils = require("./utils");

nodeName,
attrs,
sourceCodeLocation,

@@ -14,23 +13,29 @@ ...extra

const type = utils.toType(nodeName);
return {
const baseNode = {
type,
...extra,
...utils.toESLocation(sourceCodeLocation, childNodes),
// start tag
};
addTags(baseNode, sourceCodeLocation);
addAttrs(baseNode, sourceCodeLocation);
return baseNode;
}
function addTags(node, sourceCodeLocation) {
return Object.assign(node, {
startTag:
sourceCodeLocation && sourceCodeLocation.startTag
? {
...utils.toESLocation(sourceCodeLocation.startTag),
}
? utils.toESLocation(sourceCodeLocation.startTag)
: null,
// end tag
endTag:
sourceCodeLocation && sourceCodeLocation.endTag
? {
...utils.toESLocation(sourceCodeLocation.endTag),
}
? utils.toESLocation(sourceCodeLocation.endTag)
: null,
// attributes
attrs: attrs
? attrs.map((attr) => ({
});
}
function addAttrs(node, sourceCodeLocation) {
return Object.assign(node, {
attrs: node.attrs
? node.attrs.map((attr) => ({
...attr,

@@ -42,3 +47,3 @@ ...(sourceCodeLocation && sourceCodeLocation.attrs

: [],
};
});
}

@@ -45,0 +50,0 @@

@@ -119,3 +119,5 @@ function getLocFromChildNodes(childNodes) {

return text.split("\n").map((textLine) => {
const indentLength = (textLine.match(/[^\S\n\r]/g) || []).length;
const lengthWithoutIndent = textLine.trimStart().length;
const indentLength = textLine.length - lengthWithoutIndent;
rangeStart += indentLength;

@@ -139,4 +141,4 @@ startOffset += indentLength;

};
rangeStart += textLine.trimStart().length + 1;
startOffset += textLine.trimStart().length + 1;
rangeStart += lengthWithoutIndent + 1;
startOffset += lengthWithoutIndent + 1;
line += 1;

@@ -143,0 +145,0 @@ return lineNode;

{
"name": "@html-eslint/parser",
"version": "0.4.0",
"version": "0.4.1",
"description": "Parser for @html-eslint/eslint-plugin",

@@ -32,3 +32,3 @@ "author": "yeonjuan",

},
"gitHead": "eef02fe80c18eead290d77b41b38b4281a2599ef"
"gitHead": "0171c6eccb93800af6af3e6988dd5c6bcd0f4958"
}
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc