yaml-eslint-parser
Advanced tools
Comparing version 0.0.5 to 0.0.6
@@ -27,3 +27,3 @@ export declare type Range = [number, number]; | ||
} | ||
export declare type YAMLNode = YAMLProgram | YAMLDocument | YAMLDirective | YAMLContent | YAMLPair | YAMLWithMark | YAMLAnchor | YAMLTag; | ||
export declare type YAMLNode = YAMLProgram | YAMLDocument | YAMLDirective | YAMLContent | YAMLPair | YAMLWithMeta | YAMLAnchor | YAMLTag; | ||
export interface YAMLProgram extends BaseYAMLNode { | ||
@@ -40,3 +40,3 @@ type: "Program"; | ||
directives: YAMLDirective[]; | ||
content: YAMLContent | YAMLWithMark | null; | ||
content: YAMLContent | YAMLWithMeta | null; | ||
parent: YAMLProgram; | ||
@@ -52,4 +52,4 @@ anchors: { | ||
} | ||
export interface YAMLWithMark extends BaseYAMLNode { | ||
type: "YAMLWithMark"; | ||
export interface YAMLWithMeta extends BaseYAMLNode { | ||
type: "YAMLWithMeta"; | ||
anchor: YAMLAnchor | null; | ||
@@ -63,3 +63,3 @@ tag: YAMLTag | null; | ||
name: string; | ||
parent: YAMLWithMark; | ||
parent: YAMLWithMeta; | ||
} | ||
@@ -69,6 +69,6 @@ export interface YAMLTag extends BaseYAMLNode { | ||
tag: string; | ||
parent: YAMLWithMark; | ||
parent: YAMLWithMeta; | ||
} | ||
interface BaseYAMLContentNode extends BaseYAMLNode { | ||
parent: YAMLDocument | YAMLPair | YAMLSequence | YAMLWithMark; | ||
parent: YAMLDocument | YAMLPair | YAMLSequence | YAMLWithMeta; | ||
} | ||
@@ -89,4 +89,4 @@ export declare type YAMLContent = YAMLMapping | YAMLSequence | YAMLScalar | YAMLAlias; | ||
type: "YAMLPair"; | ||
key: YAMLContent | YAMLWithMark | null; | ||
value: YAMLContent | YAMLWithMark | null; | ||
key: YAMLContent | YAMLWithMeta | null; | ||
value: YAMLContent | YAMLWithMeta | null; | ||
parent: YAMLMapping; | ||
@@ -98,3 +98,3 @@ } | ||
style: "block"; | ||
entries: (YAMLContent | YAMLWithMark)[]; | ||
entries: (YAMLContent | YAMLWithMeta)[]; | ||
} | ||
@@ -104,3 +104,3 @@ export interface YAMLFlowSequence extends BaseYAMLContentNode { | ||
style: "flow"; | ||
entries: (YAMLContent | YAMLWithMark)[]; | ||
entries: (YAMLContent | YAMLWithMeta)[]; | ||
} | ||
@@ -107,0 +107,0 @@ export declare type YAMLScalar = YAMLPlainScalar | YAMLDoubleQuotedScalar | YAMLSingleQuotedScalar | YAMLBlockLiteralScalar | YAMLBlockFoldedScalar; |
@@ -200,2 +200,8 @@ "use strict"; | ||
} | ||
const last = ast.pairs[ast.pairs.length - 1]; | ||
if (last && ast.range[1] !== last.range[1]) { | ||
// adjust location | ||
ast.range[1] = last.range[1]; | ||
ast.loc.end = clone(last.loc.end); | ||
} | ||
return convertAnchorAndTag(node, tokens, code, parent, ast, doc, ast); | ||
@@ -222,2 +228,7 @@ } | ||
ast.value = convertMappingValue(node.children[1], tokens, code, ast, doc); | ||
if (ast.value && ast.range[1] !== ast.value.range[1]) { | ||
// adjust location | ||
ast.range[1] = ast.value.range[1]; | ||
ast.loc.end = clone(ast.value.loc.end); | ||
} | ||
return ast; | ||
@@ -252,2 +263,8 @@ } | ||
} | ||
const last = ast.entries[ast.entries.length - 1]; | ||
if (last && ast.range[1] !== last.range[1]) { | ||
// adjust location | ||
ast.range[1] = last.range[1]; | ||
ast.loc.end = clone(last.loc.end); | ||
} | ||
return convertAnchorAndTag(node, tokens, code, parent, ast, doc, ast); | ||
@@ -543,3 +560,3 @@ } | ||
const ast = { | ||
type: "YAMLWithMark", | ||
type: "YAMLWithMeta", | ||
anchor: null, | ||
@@ -546,0 +563,0 @@ tag: null, |
@@ -1,2 +0,2 @@ | ||
import { YAMLProgram, YAMLContent, YAMLDocument, YAMLMapping, YAMLSequence, YAMLScalar, YAMLAlias, YAMLPair, YAMLWithMark } from "./ast"; | ||
import { YAMLProgram, YAMLContent, YAMLDocument, YAMLMapping, YAMLSequence, YAMLScalar, YAMLAlias, YAMLPair, YAMLWithMeta } from "./ast"; | ||
declare type YAMLContentValue = string | number | boolean | null | YAMLContentValue[] | YAMLMappingValue; | ||
@@ -11,3 +11,3 @@ declare type YAMLMappingValue = { | ||
export declare function getStaticYAMLValue(node: YAMLAlias): YAMLContentValue; | ||
export declare function getStaticYAMLValue(node: YAMLProgram | YAMLDocument | YAMLContent | YAMLPair | YAMLWithMark): YAMLContentValue; | ||
export declare function getStaticYAMLValue(node: YAMLProgram | YAMLDocument | YAMLContent | YAMLPair | YAMLWithMeta): YAMLContentValue; | ||
/** | ||
@@ -14,0 +14,0 @@ * Checks if the given string is true |
@@ -57,3 +57,3 @@ "use strict"; | ||
}, | ||
YAMLWithMark(node) { | ||
YAMLWithMeta(node) { | ||
if (node.tag) { | ||
@@ -60,0 +60,0 @@ if (node.value == null) { |
@@ -12,3 +12,3 @@ "use strict"; | ||
YAMLSequence: ["entries"], | ||
YAMLWithMark: ["anchor", "tag", "value"], | ||
YAMLWithMeta: ["anchor", "tag", "value"], | ||
YAMLScalar: [], | ||
@@ -15,0 +15,0 @@ YAMLAlias: [], |
{ | ||
"name": "yaml-eslint-parser", | ||
"version": "0.0.5", | ||
"version": "0.0.6", | ||
"description": "A YAML parser that produces output compatible with ESLint", | ||
@@ -5,0 +5,0 @@ "main": "lib/index.js", |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
42508
1139