Skip to content

Commit

Permalink
style: Apply updated Prettier style
Browse files Browse the repository at this point in the history
  • Loading branch information
eemeli committed Jul 24, 2024
1 parent 61140fa commit 6e58318
Show file tree
Hide file tree
Showing 2 changed files with 57 additions and 49 deletions.
2 changes: 1 addition & 1 deletion src/compose/compose-collection.ts
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ export function composeCollection(
? anchor.offset > tagToken.offset
? anchor
: tagToken
: anchor ?? tagToken
: (anchor ?? tagToken)
if (lastProp && (!nl || nl.offset < lastProp.offset)) {
const message = 'Missing newline after block sequence props'
onError(lastProp, 'MISSING_CHAR', message)
Expand Down
104 changes: 56 additions & 48 deletions tests/cli.ts
Original file line number Diff line number Diff line change
Expand Up @@ -143,63 +143,71 @@ const skip = Number(major) < 20
'Lexer',
'hello: world',
['lex', '--json', '--indent', '2'],
['[\n "\\u0002",\n "\\u001f",\n "hello",\n ":",\n " ",\n "\\u001f",\n "world"\n]']
[
'[\n "\\u0002",\n "\\u001f",\n "hello",\n ":",\n " ",\n "\\u001f",\n "world"\n]'
]
)
ok(
'CST parser',
'hello: world\n',
['cst', '--json', '--indent', '2'],
[JSON.stringify([
{
type: 'document',
offset: 0,
start: [],
value: {
type: 'block-map',
offset: 0,
indent: 0,
items: [
{
start: [],
key: {
type: 'scalar',
offset: 0,
indent: 0,
source: 'hello'
},
sep: [
[
JSON.stringify(
[
{
type: 'document',
offset: 0,
start: [],
value: {
type: 'block-map',
offset: 0,
indent: 0,
items: [
{
type: 'map-value-ind',
offset: 5,
indent: 0,
source: ':'
},
{
type: "space",
offset: 6,
indent: 0,
source: ' '
}
],
value: {
type: 'scalar',
offset: 7,
indent: 0,
source: 'world',
end: [
{
type: 'newline',
offset: 12,
start: [],
key: {
type: 'scalar',
offset: 0,
indent: 0,
source: 'hello'
},
sep: [
{
type: 'map-value-ind',
offset: 5,
indent: 0,
source: ':'
},
{
type: 'space',
offset: 6,
indent: 0,
source: ' '
}
],
value: {
type: 'scalar',
offset: 7,
indent: 0,
source: '\n'
source: 'world',
end: [
{
type: 'newline',
offset: 12,
indent: 0,
source: '\n'
}
]
}
]
}
}
]
}
]
}
}
], null, 2)]
}
],
null,
2
)
]
)
})
describe('--doc', () => {
Expand Down

0 comments on commit 6e58318

Please sign in to comment.