Skip to content

Commit

Permalink
Merge pull request #505 from shufo/fix/syntax-error-include
Browse files Browse the repository at this point in the history
  • Loading branch information
shufo authored Mar 3, 2022
2 parents f60b202 + 3533fee commit d259581
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 0 deletions.
14 changes: 14 additions & 0 deletions __tests__/formatter.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2555,4 +2555,18 @@ describe('formatter', () => {

await util.doubleFormatCheck(content, expected);
});

test('@include directive should not add an extra comma on long view name #504', async () => {
const content = [`@include('livewire.cx.equipment-list-internal.account', ['account' => $account])`].join('\n');

const expected = [
`@include(`,
` 'livewire.cx.equipment-list-internal.account',`,
` ['account' => $account]`,
`)`,
``,
].join('\n');

await util.doubleFormatCheck(content, expected);
});
});
1 change: 1 addition & 0 deletions src/formatter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -968,6 +968,7 @@ export default class Formatter {
const inside = util
.formatRawStringAsPhp(`func_inline_for_${p3}${p4}`, 80, true)
.replace(/([\n\s]*)->([\n\s]*)/gs, '->')
.replace(/,(\s*?\))/gis, (_match5, p5) => p5)
.trim()
// @ts-expect-error ts-migrate(2554) FIXME: Expected 0 arguments, but got 1.
.trimRight('\n');
Expand Down

0 comments on commit d259581

Please sign in to comment.