fix(yaml): end comment in nested mapping (#4918)
* test: add tests * fix(yaml): end comment in nested mappingmaster
parent
10df246772
commit
b6077e175e
|
@ -61,7 +61,7 @@
|
|||
"unicode-regex": "1.0.1",
|
||||
"unified": "6.1.6",
|
||||
"yaml": "1.0.0-rc.7",
|
||||
"yaml-unist-parser": "1.0.0-rc.2"
|
||||
"yaml-unist-parser": "1.0.0-rc.3"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@babel/cli": "7.0.0-beta.49",
|
||||
|
|
|
@ -381,6 +381,8 @@ function _print(node, parentNode, path, options, print) {
|
|||
needsSpaceInFrontOfMappingValue(node) ? " " : "",
|
||||
":",
|
||||
hasLeadingComments(node.value.node) ||
|
||||
(hasEndComments(node.value) &&
|
||||
node.value.node.type !== "null") ||
|
||||
(parentNode.type === "mapping" &&
|
||||
hasTrailingComments(node.key.node) &&
|
||||
isInlineNode(node.value.node)) ||
|
||||
|
|
|
@ -31,7 +31,8 @@ f:
|
|||
empty_content:
|
||||
# hello world
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
a: 123
|
||||
a:
|
||||
123
|
||||
# impicitMappginValue
|
||||
|
||||
? b
|
||||
|
@ -62,6 +63,37 @@ empty_content:
|
|||
|
||||
`;
|
||||
|
||||
exports[`end-comment.yml - yaml-verify 1`] = `
|
||||
parent:
|
||||
one: 1
|
||||
# two: 2
|
||||
|
||||
a:
|
||||
b:
|
||||
#b
|
||||
#a
|
||||
|
||||
A:
|
||||
B:
|
||||
#A
|
||||
#A
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
parent:
|
||||
one: 1
|
||||
# two: 2
|
||||
|
||||
a:
|
||||
b:
|
||||
#b
|
||||
#a
|
||||
|
||||
A:
|
||||
? B
|
||||
#A
|
||||
#A
|
||||
|
||||
`;
|
||||
|
||||
exports[`root.yml - yaml-verify 1`] = `
|
||||
#hello world
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
|
|
@ -0,0 +1,13 @@
|
|||
parent:
|
||||
one: 1
|
||||
# two: 2
|
||||
|
||||
a:
|
||||
b:
|
||||
#b
|
||||
#a
|
||||
|
||||
A:
|
||||
B:
|
||||
#A
|
||||
#A
|
|
@ -262,7 +262,7 @@ omap:
|
|||
- aardvark: African pig-like ant eater. Ugly.
|
||||
- anteater: South-American ant eater. Two species.
|
||||
- anaconda: South-American constrictor snake. Scaly.
|
||||
# Etc.
|
||||
# Etc.
|
||||
# Flow style
|
||||
Numbers: !!omap [one: 1, two: 2, three: 3]
|
||||
|
||||
|
|
|
@ -6008,9 +6008,9 @@ yallist@^3.0.0, yallist@^3.0.2:
|
|||
version "3.0.2"
|
||||
resolved "https://registry.yarnpkg.com/yallist/-/yallist-3.0.2.tgz#8452b4bb7e83c7c188d8041c1a837c773d6d8bb9"
|
||||
|
||||
yaml-unist-parser@1.0.0-rc.2:
|
||||
version "1.0.0-rc.2"
|
||||
resolved "https://registry.yarnpkg.com/yaml-unist-parser/-/yaml-unist-parser-1.0.0-rc.2.tgz#a9c3597fe8507d7b80c7c51fc1c1ae4773ccdd30"
|
||||
yaml-unist-parser@1.0.0-rc.3:
|
||||
version "1.0.0-rc.3"
|
||||
resolved "https://registry.yarnpkg.com/yaml-unist-parser/-/yaml-unist-parser-1.0.0-rc.3.tgz#d7b396353da92c75bb471a9e65973ba967e0b4f6"
|
||||
dependencies:
|
||||
lines-and-columns "^1.1.6"
|
||||
tslib "^1.9.1"
|
||||
|
|
Loading…
Reference in New Issue