svg-eslint-parser 0.0.6 → 0.0.7

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/dist/index.d.ts CHANGED
@@ -258,6 +258,10 @@ interface SimpleNode<T extends NodeTypes> extends BaseNode {
258
258
  value: string;
259
259
  }
260
260
  type TextNode = SimpleNode<NodeTypes.Text>;
261
+ interface ESLintComment extends Locations {
262
+ type: 'Block' | 'Line';
263
+ value: string;
264
+ }
261
265
  /**
262
266
  * attribute nodes
263
267
  * @pg
@@ -339,7 +343,7 @@ type NestableNode = CommentNode | DoctypeNode | TagNode | TextNode | XMLDeclarat
339
343
  */
340
344
  interface Program extends BaseNode {
341
345
  body: DocumentNode[];
342
- comments: string[];
346
+ comments: ESLintComment[];
343
347
  tokens: AnyToken[];
344
348
  type: NodeTypes.Program;
345
349
  }
@@ -501,7 +505,7 @@ interface TokenizeHandler {
501
505
  handleContentEnd?: (state: TokenizerState) => void;
502
506
  }
503
507
  declare namespace index_d_exports {
504
- export { AnyContextualNode, AnyNode, AnyToken, AttributeKeyNode, AttributeNode, AttributeValueNode, BaseNode, CommentNode, ConstructTreeHandler, ConstructTreeState, ContextualAttributeNode, ContextualCommentNode, ContextualDoctypeAttributeNode, ContextualDoctypeNode, ContextualDocumentNode, ContextualNode, ContextualTagNode, ContextualXMLDeclarationAttributeNode, ContextualXMLDeclarationNode, DoctypeAttributeNode, DoctypeAttributeValueNode, DoctypeNode, DocumentNode, ErrorNode, Locations, NestableNode, Options, ParseForESLintResult, ParseResult, PartialBy, Position, Program, Range, SimpleNode, SourceLocation, TagNode, TextNode, Token, TokenizeHandler, TokenizerState, XMLDeclarationAttributeKeyNode, XMLDeclarationAttributeNode, XMLDeclarationAttributeValueNode, XMLDeclarationNode };
508
+ export { AnyContextualNode, AnyNode, AnyToken, AttributeKeyNode, AttributeNode, AttributeValueNode, BaseNode, CommentNode, ConstructTreeHandler, ConstructTreeState, ContextualAttributeNode, ContextualCommentNode, ContextualDoctypeAttributeNode, ContextualDoctypeNode, ContextualDocumentNode, ContextualNode, ContextualTagNode, ContextualXMLDeclarationAttributeNode, ContextualXMLDeclarationNode, DoctypeAttributeNode, DoctypeAttributeValueNode, DoctypeNode, DocumentNode, ESLintComment, ErrorNode, Locations, NestableNode, Options, ParseForESLintResult, ParseResult, PartialBy, Position, Program, Range, SimpleNode, SourceLocation, TagNode, TextNode, Token, TokenizeHandler, TokenizerState, XMLDeclarationAttributeKeyNode, XMLDeclarationAttributeNode, XMLDeclarationAttributeValueNode, XMLDeclarationNode };
505
509
  }
506
510
  //#endregion
507
511
  //#region src/parser/parseForESLint.d.ts
@@ -621,4 +625,4 @@ declare const name: string;
621
625
  declare const VisitorKeys: eslint0.SourceCode.VisitorKeys;
622
626
  declare function parse(code: string, options?: Options): Program;
623
627
  //#endregion
624
- export { type index_d_exports as AST, type ASTVisitor, AnyContextualNode, AnyNode, AnyToken, AttributeKeyNode, AttributeNode, AttributeValueNode, BaseNode, COMMENT_END, COMMENT_START, CommentNode, ConstructTreeContextTypes, ConstructTreeHandler, ConstructTreeState, ContextualAttributeNode, ContextualCommentNode, ContextualDoctypeAttributeNode, ContextualDoctypeNode, ContextualDocumentNode, ContextualNode, ContextualTagNode, ContextualXMLDeclarationAttributeNode, ContextualXMLDeclarationNode, DEPRECATED_SVG_ELEMENTS, DoctypeAttributeNode, DoctypeAttributeValueNode, DoctypeNode, DocumentNode, ErrorNode, Locations, NestableNode, NodeTypes, Options, ParseError, ParseForESLintResult, ParseResult, PartialBy, Position, Program, RE_CLOSE_TAG_NAME, RE_INCOMPLETE_CLOSING_TAG, RE_OPEN_TAG_NAME, RE_OPEN_TAG_START, Range, SELF_CLOSING_ELEMENTS, SPECIAL_CHAR, SVG_ELEMENTS, SimpleNode, SourceLocation, TagNode, TextNode, Token, TokenTypes, TokenizeHandler, TokenizerContextTypes, TokenizerState, VisitorKeys, XMLDeclarationAttributeKeyNode, XMLDeclarationAttributeNode, XMLDeclarationAttributeValueNode, XMLDeclarationNode, XML_DECLARATION_END, XML_DECLARATION_START, cloneNode, cloneNodeWithParent, countNodes, filterNodes, findFirstNodeByType, findNodeByType, getNodeDepth, getParentChain, isNodeType, mapNodes, meta, name, parse, parseForESLint, traverseAST, validateNode, walkAST };
628
+ export { type index_d_exports as AST, type ASTVisitor, AnyContextualNode, AnyNode, AnyToken, AttributeKeyNode, AttributeNode, AttributeValueNode, BaseNode, COMMENT_END, COMMENT_START, CommentNode, ConstructTreeContextTypes, ConstructTreeHandler, ConstructTreeState, ContextualAttributeNode, ContextualCommentNode, ContextualDoctypeAttributeNode, ContextualDoctypeNode, ContextualDocumentNode, ContextualNode, ContextualTagNode, ContextualXMLDeclarationAttributeNode, ContextualXMLDeclarationNode, DEPRECATED_SVG_ELEMENTS, DoctypeAttributeNode, DoctypeAttributeValueNode, DoctypeNode, DocumentNode, ESLintComment, ErrorNode, Locations, NestableNode, NodeTypes, Options, ParseError, ParseForESLintResult, ParseResult, PartialBy, Position, Program, RE_CLOSE_TAG_NAME, RE_INCOMPLETE_CLOSING_TAG, RE_OPEN_TAG_NAME, RE_OPEN_TAG_START, Range, SELF_CLOSING_ELEMENTS, SPECIAL_CHAR, SVG_ELEMENTS, SimpleNode, SourceLocation, TagNode, TextNode, Token, TokenTypes, TokenizeHandler, TokenizerContextTypes, TokenizerState, VisitorKeys, XMLDeclarationAttributeKeyNode, XMLDeclarationAttributeNode, XMLDeclarationAttributeValueNode, XMLDeclarationNode, XML_DECLARATION_END, XML_DECLARATION_START, cloneNode, cloneNodeWithParent, countNodes, filterNodes, findFirstNodeByType, findNodeByType, getNodeDepth, getParentChain, isNodeType, mapNodes, meta, name, parse, parseForESLint, traverseAST, validateNode, walkAST };
package/dist/index.js CHANGED
@@ -3,7 +3,7 @@ import { unionWith } from "eslint-visitor-keys";
3
3
 
4
4
  //#region package.json
5
5
  var name$1 = "svg-eslint-parser";
6
- var version = "0.0.6";
6
+ var version = "0.0.7";
7
7
 
8
8
  //#endregion
9
9
  //#region src/meta.ts
@@ -2459,18 +2459,24 @@ function traverse(node, visitor) {
2459
2459
  //#region src/parser/parseForESLint.ts
2460
2460
  function parseForESLint(source, options = {}) {
2461
2461
  const { ast, tokens } = parse$1(source, options);
2462
- const comments = [];
2463
2462
  const programNode = {
2464
2463
  type: NodeTypes.Program,
2465
2464
  body: [ast],
2466
- comments,
2465
+ comments: [],
2467
2466
  tokens: tokens.filter((token) => token.type !== TokenTypes.CommentOpen && token.type !== TokenTypes.CommentClose && token.type !== TokenTypes.CommentContent),
2468
2467
  range: ast.range,
2469
2468
  loc: ast.loc
2470
2469
  };
2470
+ const comments = [];
2471
2471
  traverse(programNode, (node) => {
2472
- if (node.type === NodeTypes.Comment && "content" in node) comments.push(node.content);
2472
+ if (node.type === NodeTypes.Comment) comments.push({
2473
+ type: "Block",
2474
+ value: node.content,
2475
+ range: node.range,
2476
+ loc: node.loc
2477
+ });
2473
2478
  });
2479
+ programNode.comments = comments;
2474
2480
  return {
2475
2481
  ast: programNode,
2476
2482
  visitorKeys,
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "svg-eslint-parser",
3
3
  "type": "module",
4
- "version": "0.0.6",
4
+ "version": "0.0.7",
5
5
  "description": "An SVG parser that produces output compatible with ESLint.",
6
6
  "keywords": [
7
7
  "eslint-parser",