Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: 🐛 unexpected result when attrs are not separated by space #879

Merged
merged 1 commit into from
Oct 16, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 29 additions & 0 deletions __tests__/fixtures/snapshots/no_space_quotation.snapshot
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
------------------------------------options----------------------------------------
{}
------------------------------------content----------------------------------------
<button class="m-2.5 h-5 w-5 scale-125 cursor-pointer p-1" data-tippy-content="Modifier la prestation"
:class="isHovered && !currently_dragging ? 'opacity-100 delay-50' : 'opacity-0 delay-0'"x-data="{ tippyInstance: null }" x-init="tippyInstance = window.tippy($root)" x-on:click="tippyInstance.hide(); $dispatch('open-prestation-modal', {{ $task->id }})">
@include('svg.misc.tag')
</button>
<button class="m-2.5 h-5 w-5 scale-125 cursor-pointer p-1" data-tippy-content="Modifier la durée" :class="isHovered && !currently_dragging ? 'opacity-100 delay-50' : 'opacity-0 delay-0'" x-data="{ tippyInstance: null }" x-init="tippyInstance = window.tippy($root)" x-on:click="tippyInstance.hide(); $dispatch('open-duration-modal', {{ $task->id }})">
@include('svg.misc.extand')
</button>
<button class="m-2.5 h-5 w-5 scale-125 cursor-pointer p-0.5" data-tippy-content="Dupliquer cette tâche" :class="isHovered && !currently_dragging ? 'opacity-100 delay-50' : 'opacity-0 delay-0'" wire:click="duplicate"x-data="{ tippyInstance: null }" x-init="tippyInstance = window.tippy($root)">
@include('svg.misc.duplicate')
</button>
------------------------------------expected----------------------------------------
<button class="m-2.5 h-5 w-5 scale-125 cursor-pointer p-1" data-tippy-content="Modifier la prestation"
:class="isHovered && !currently_dragging ? 'opacity-100 delay-50' : 'opacity-0 delay-0'"x-data="{ tippyInstance: null }"
x-init="tippyInstance = window.tippy($root)" x-on:click="tippyInstance.hide(); $dispatch('open-prestation-modal', {{ $task->id }})">
@include('svg.misc.tag')
</button>
<button class="m-2.5 h-5 w-5 scale-125 cursor-pointer p-1" data-tippy-content="Modifier la durée"
:class="isHovered && !currently_dragging ? 'opacity-100 delay-50' : 'opacity-0 delay-0'" x-data="{ tippyInstance: null }"
x-init="tippyInstance = window.tippy($root)" x-on:click="tippyInstance.hide(); $dispatch('open-duration-modal', {{ $task->id }})">
@include('svg.misc.extand')
</button>
<button class="m-2.5 h-5 w-5 scale-125 cursor-pointer p-0.5" data-tippy-content="Dupliquer cette tâche"
:class="isHovered && !currently_dragging ? 'opacity-100 delay-50' : 'opacity-0 delay-0'"
wire:click="duplicate"x-data="{ tippyInstance: null }" x-init="tippyInstance = window.tippy($root)">
@include('svg.misc.duplicate')
</button>
2 changes: 1 addition & 1 deletion src/formatter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@

import { sortClasses } from '@shufo/tailwindcss-class-sorter';
import Aigle from 'aigle';
import detectIndent from 'detect-indent';

Check failure on line 5 in src/formatter.ts

View workflow job for this annotation

GitHub Actions / build (16.x, ubuntu-latest)

Module '"/home/runner/work/blade-formatter/blade-formatter/node_modules/detect-indent/index"' can only be default-imported using the 'esModuleInterop' flag

Check failure on line 5 in src/formatter.ts

View workflow job for this annotation

GitHub Actions / build (16.x, macos-latest)

Module '"/Users/runner/work/blade-formatter/blade-formatter/node_modules/detect-indent/index"' can only be default-imported using the 'esModuleInterop' flag

Check failure on line 5 in src/formatter.ts

View workflow job for this annotation

GitHub Actions / build (16.x)

Module '"/home/runner/work/blade-formatter/blade-formatter/node_modules/detect-indent/index"' can only be default-imported using the 'esModuleInterop' flag

Check failure on line 5 in src/formatter.ts

View workflow job for this annotation

GitHub Actions / build (14.x)

Module '"/home/runner/work/blade-formatter/blade-formatter/node_modules/detect-indent/index"' can only be default-imported using the 'esModuleInterop' flag

Check failure on line 5 in src/formatter.ts

View workflow job for this annotation

GitHub Actions / build (18.x)

Module '"/home/runner/work/blade-formatter/blade-formatter/node_modules/detect-indent/index"' can only be default-imported using the 'esModuleInterop' flag

Check failure on line 5 in src/formatter.ts

View workflow job for this annotation

GitHub Actions / build (16.x)

Module '"/home/runner/work/blade-formatter/blade-formatter/node_modules/detect-indent/index"' can only be default-imported using the 'esModuleInterop' flag

Check failure on line 5 in src/formatter.ts

View workflow job for this annotation

GitHub Actions / build (14.x)

Module '"/home/runner/work/blade-formatter/blade-formatter/node_modules/detect-indent/index"' can only be default-imported using the 'esModuleInterop' flag

Check failure on line 5 in src/formatter.ts

View workflow job for this annotation

GitHub Actions / build (20.x)

Module '"/home/runner/work/blade-formatter/blade-formatter/node_modules/detect-indent/index"' can only be default-imported using the 'esModuleInterop' flag

Check failure on line 5 in src/formatter.ts

View workflow job for this annotation

GitHub Actions / build (20.x)

Module '"/home/runner/work/blade-formatter/blade-formatter/node_modules/detect-indent/index"' can only be default-imported using the 'esModuleInterop' flag

Check failure on line 5 in src/formatter.ts

View workflow job for this annotation

GitHub Actions / build (18.x)

Module '"/home/runner/work/blade-formatter/blade-formatter/node_modules/detect-indent/index"' can only be default-imported using the 'esModuleInterop' flag

Check failure on line 5 in src/formatter.ts

View workflow job for this annotation

GitHub Actions / build (16.x, windows-latest)

Module '"D:/a/blade-formatter/blade-formatter/node_modules/detect-indent/index"' can only be default-imported using the 'esModuleInterop' flag
import { sortAttributes } from 'html-attribute-sorter';
import beautify, { JSBeautifyOptions } from 'js-beautify';

Check failure on line 7 in src/formatter.ts

View workflow job for this annotation

GitHub Actions / build (16.x, ubuntu-latest)

Module '"/home/runner/work/blade-formatter/blade-formatter/node_modules/@types/js-beautify/index"' can only be default-imported using the 'esModuleInterop' flag

Check failure on line 7 in src/formatter.ts

View workflow job for this annotation

GitHub Actions / build (16.x, macos-latest)

Module '"/Users/runner/work/blade-formatter/blade-formatter/node_modules/@types/js-beautify/index"' can only be default-imported using the 'esModuleInterop' flag

Check failure on line 7 in src/formatter.ts

View workflow job for this annotation

GitHub Actions / build (16.x)

Module '"/home/runner/work/blade-formatter/blade-formatter/node_modules/@types/js-beautify/index"' can only be default-imported using the 'esModuleInterop' flag

Check failure on line 7 in src/formatter.ts

View workflow job for this annotation

GitHub Actions / build (14.x)

Module '"/home/runner/work/blade-formatter/blade-formatter/node_modules/@types/js-beautify/index"' can only be default-imported using the 'esModuleInterop' flag

Check failure on line 7 in src/formatter.ts

View workflow job for this annotation

GitHub Actions / build (18.x)

Module '"/home/runner/work/blade-formatter/blade-formatter/node_modules/@types/js-beautify/index"' can only be default-imported using the 'esModuleInterop' flag

Check failure on line 7 in src/formatter.ts

View workflow job for this annotation

GitHub Actions / build (16.x)

Module '"/home/runner/work/blade-formatter/blade-formatter/node_modules/@types/js-beautify/index"' can only be default-imported using the 'esModuleInterop' flag

Check failure on line 7 in src/formatter.ts

View workflow job for this annotation

GitHub Actions / build (14.x)

Module '"/home/runner/work/blade-formatter/blade-formatter/node_modules/@types/js-beautify/index"' can only be default-imported using the 'esModuleInterop' flag

Check failure on line 7 in src/formatter.ts

View workflow job for this annotation

GitHub Actions / build (20.x)

Module '"/home/runner/work/blade-formatter/blade-formatter/node_modules/@types/js-beautify/index"' can only be default-imported using the 'esModuleInterop' flag

Check failure on line 7 in src/formatter.ts

View workflow job for this annotation

GitHub Actions / build (20.x)

Module '"/home/runner/work/blade-formatter/blade-formatter/node_modules/@types/js-beautify/index"' can only be default-imported using the 'esModuleInterop' flag

Check failure on line 7 in src/formatter.ts

View workflow job for this annotation

GitHub Actions / build (18.x)

Module '"/home/runner/work/blade-formatter/blade-formatter/node_modules/@types/js-beautify/index"' can only be default-imported using the 'esModuleInterop' flag

Check failure on line 7 in src/formatter.ts

View workflow job for this annotation

GitHub Actions / build (16.x, windows-latest)

Module '"D:/a/blade-formatter/blade-formatter/node_modules/@types/js-beautify/index"' can only be default-imported using the 'esModuleInterop' flag
import _ from 'lodash';

Check failure on line 8 in src/formatter.ts

View workflow job for this annotation

GitHub Actions / build (16.x, ubuntu-latest)

Module '"/home/runner/work/blade-formatter/blade-formatter/node_modules/@types/lodash/index"' can only be default-imported using the 'esModuleInterop' flag

Check failure on line 8 in src/formatter.ts

View workflow job for this annotation

GitHub Actions / build (16.x, macos-latest)

Module '"/Users/runner/work/blade-formatter/blade-formatter/node_modules/@types/lodash/index"' can only be default-imported using the 'esModuleInterop' flag

Check failure on line 8 in src/formatter.ts

View workflow job for this annotation

GitHub Actions / build (16.x)

Module '"/home/runner/work/blade-formatter/blade-formatter/node_modules/@types/lodash/index"' can only be default-imported using the 'esModuleInterop' flag

Check failure on line 8 in src/formatter.ts

View workflow job for this annotation

GitHub Actions / build (14.x)

Module '"/home/runner/work/blade-formatter/blade-formatter/node_modules/@types/lodash/index"' can only be default-imported using the 'esModuleInterop' flag

Check failure on line 8 in src/formatter.ts

View workflow job for this annotation

GitHub Actions / build (18.x)

Module '"/home/runner/work/blade-formatter/blade-formatter/node_modules/@types/lodash/index"' can only be default-imported using the 'esModuleInterop' flag

Check failure on line 8 in src/formatter.ts

View workflow job for this annotation

GitHub Actions / build (16.x)

Module '"/home/runner/work/blade-formatter/blade-formatter/node_modules/@types/lodash/index"' can only be default-imported using the 'esModuleInterop' flag

Check failure on line 8 in src/formatter.ts

View workflow job for this annotation

GitHub Actions / build (14.x)

Module '"/home/runner/work/blade-formatter/blade-formatter/node_modules/@types/lodash/index"' can only be default-imported using the 'esModuleInterop' flag

Check failure on line 8 in src/formatter.ts

View workflow job for this annotation

GitHub Actions / build (20.x)

Module '"/home/runner/work/blade-formatter/blade-formatter/node_modules/@types/lodash/index"' can only be default-imported using the 'esModuleInterop' flag

Check failure on line 8 in src/formatter.ts

View workflow job for this annotation

GitHub Actions / build (20.x)

Module '"/home/runner/work/blade-formatter/blade-formatter/node_modules/@types/lodash/index"' can only be default-imported using the 'esModuleInterop' flag

Check failure on line 8 in src/formatter.ts

View workflow job for this annotation

GitHub Actions / build (18.x)

Module '"/home/runner/work/blade-formatter/blade-formatter/node_modules/@types/lodash/index"' can only be default-imported using the 'esModuleInterop' flag

Check failure on line 8 in src/formatter.ts

View workflow job for this annotation

GitHub Actions / build (16.x, windows-latest)

Module '"D:/a/blade-formatter/blade-formatter/node_modules/@types/lodash/index"' can only be default-imported using the 'esModuleInterop' flag
import * as vscodeTmModule from 'vscode-textmate';
import xregexp from 'xregexp';
import { formatPhpComment } from './comment';
Expand Down Expand Up @@ -37,25 +37,25 @@
import * as vsctm from './vsctm';

export default class Formatter {
argumentCheck: any;

Check warning on line 40 in src/formatter.ts

View workflow job for this annotation

GitHub Actions / build (16.x)

Unexpected any. Specify a different type

Check warning on line 40 in src/formatter.ts

View workflow job for this annotation

GitHub Actions / build (14.x)

Unexpected any. Specify a different type

Check warning on line 40 in src/formatter.ts

View workflow job for this annotation

GitHub Actions / build (18.x)

Unexpected any. Specify a different type

Check warning on line 40 in src/formatter.ts

View workflow job for this annotation

GitHub Actions / build (16.x)

Unexpected any. Specify a different type

Check warning on line 40 in src/formatter.ts

View workflow job for this annotation

GitHub Actions / build (14.x)

Unexpected any. Specify a different type

Check warning on line 40 in src/formatter.ts

View workflow job for this annotation

GitHub Actions / build (20.x)

Unexpected any. Specify a different type

Check warning on line 40 in src/formatter.ts

View workflow job for this annotation

GitHub Actions / build (20.x)

Unexpected any. Specify a different type

Check warning on line 40 in src/formatter.ts

View workflow job for this annotation

GitHub Actions / build (18.x)

Unexpected any. Specify a different type

bladeBraces: any;

Check warning on line 42 in src/formatter.ts

View workflow job for this annotation

GitHub Actions / build (16.x)

Unexpected any. Specify a different type

Check warning on line 42 in src/formatter.ts

View workflow job for this annotation

GitHub Actions / build (14.x)

Unexpected any. Specify a different type

Check warning on line 42 in src/formatter.ts

View workflow job for this annotation

GitHub Actions / build (18.x)

Unexpected any. Specify a different type

Check warning on line 42 in src/formatter.ts

View workflow job for this annotation

GitHub Actions / build (16.x)

Unexpected any. Specify a different type

Check warning on line 42 in src/formatter.ts

View workflow job for this annotation

GitHub Actions / build (14.x)

Unexpected any. Specify a different type

Check warning on line 42 in src/formatter.ts

View workflow job for this annotation

GitHub Actions / build (20.x)

Unexpected any. Specify a different type

Check warning on line 42 in src/formatter.ts

View workflow job for this annotation

GitHub Actions / build (20.x)

Unexpected any. Specify a different type

Check warning on line 42 in src/formatter.ts

View workflow job for this annotation

GitHub Actions / build (18.x)

Unexpected any. Specify a different type

bladeComments: any;

Check warning on line 44 in src/formatter.ts

View workflow job for this annotation

GitHub Actions / build (16.x)

Unexpected any. Specify a different type

Check warning on line 44 in src/formatter.ts

View workflow job for this annotation

GitHub Actions / build (14.x)

Unexpected any. Specify a different type

Check warning on line 44 in src/formatter.ts

View workflow job for this annotation

GitHub Actions / build (18.x)

Unexpected any. Specify a different type

Check warning on line 44 in src/formatter.ts

View workflow job for this annotation

GitHub Actions / build (16.x)

Unexpected any. Specify a different type

Check warning on line 44 in src/formatter.ts

View workflow job for this annotation

GitHub Actions / build (14.x)

Unexpected any. Specify a different type

Check warning on line 44 in src/formatter.ts

View workflow job for this annotation

GitHub Actions / build (20.x)

Unexpected any. Specify a different type

Check warning on line 44 in src/formatter.ts

View workflow job for this annotation

GitHub Actions / build (20.x)

Unexpected any. Specify a different type

Check warning on line 44 in src/formatter.ts

View workflow job for this annotation

GitHub Actions / build (18.x)

Unexpected any. Specify a different type

bladeDirectives: any;

Check warning on line 46 in src/formatter.ts

View workflow job for this annotation

GitHub Actions / build (16.x)

Unexpected any. Specify a different type

Check warning on line 46 in src/formatter.ts

View workflow job for this annotation

GitHub Actions / build (14.x)

Unexpected any. Specify a different type

Check warning on line 46 in src/formatter.ts

View workflow job for this annotation

GitHub Actions / build (18.x)

Unexpected any. Specify a different type

Check warning on line 46 in src/formatter.ts

View workflow job for this annotation

GitHub Actions / build (16.x)

Unexpected any. Specify a different type

Check warning on line 46 in src/formatter.ts

View workflow job for this annotation

GitHub Actions / build (14.x)

Unexpected any. Specify a different type

Check warning on line 46 in src/formatter.ts

View workflow job for this annotation

GitHub Actions / build (20.x)

Unexpected any. Specify a different type

Check warning on line 46 in src/formatter.ts

View workflow job for this annotation

GitHub Actions / build (20.x)

Unexpected any. Specify a different type

Check warning on line 46 in src/formatter.ts

View workflow job for this annotation

GitHub Actions / build (18.x)

Unexpected any. Specify a different type

htmlAttributes: Array<string>;

currentIndentLevel: number;

diffs: any;

Check warning on line 52 in src/formatter.ts

View workflow job for this annotation

GitHub Actions / build (16.x)

Unexpected any. Specify a different type

Check warning on line 52 in src/formatter.ts

View workflow job for this annotation

GitHub Actions / build (14.x)

Unexpected any. Specify a different type

Check warning on line 52 in src/formatter.ts

View workflow job for this annotation

GitHub Actions / build (18.x)

Unexpected any. Specify a different type

Check warning on line 52 in src/formatter.ts

View workflow job for this annotation

GitHub Actions / build (16.x)

Unexpected any. Specify a different type

Check warning on line 52 in src/formatter.ts

View workflow job for this annotation

GitHub Actions / build (14.x)

Unexpected any. Specify a different type

Check warning on line 52 in src/formatter.ts

View workflow job for this annotation

GitHub Actions / build (20.x)

Unexpected any. Specify a different type

Check warning on line 52 in src/formatter.ts

View workflow job for this annotation

GitHub Actions / build (20.x)

Unexpected any. Specify a different type

Check warning on line 52 in src/formatter.ts

View workflow job for this annotation

GitHub Actions / build (18.x)

Unexpected any. Specify a different type

indentCharacter: any;

Check warning on line 54 in src/formatter.ts

View workflow job for this annotation

GitHub Actions / build (16.x)

Unexpected any. Specify a different type

Check warning on line 54 in src/formatter.ts

View workflow job for this annotation

GitHub Actions / build (14.x)

Unexpected any. Specify a different type

Check warning on line 54 in src/formatter.ts

View workflow job for this annotation

GitHub Actions / build (18.x)

Unexpected any. Specify a different type

Check warning on line 54 in src/formatter.ts

View workflow job for this annotation

GitHub Actions / build (16.x)

Unexpected any. Specify a different type

Check warning on line 54 in src/formatter.ts

View workflow job for this annotation

GitHub Actions / build (14.x)

Unexpected any. Specify a different type

Check warning on line 54 in src/formatter.ts

View workflow job for this annotation

GitHub Actions / build (20.x)

Unexpected any. Specify a different type

Check warning on line 54 in src/formatter.ts

View workflow job for this annotation

GitHub Actions / build (20.x)

Unexpected any. Specify a different type

Check warning on line 54 in src/formatter.ts

View workflow job for this annotation

GitHub Actions / build (18.x)

Unexpected any. Specify a different type

indentSize: any;

Check warning on line 56 in src/formatter.ts

View workflow job for this annotation

GitHub Actions / build (16.x)

Unexpected any. Specify a different type

Check warning on line 56 in src/formatter.ts

View workflow job for this annotation

GitHub Actions / build (14.x)

Unexpected any. Specify a different type

Check warning on line 56 in src/formatter.ts

View workflow job for this annotation

GitHub Actions / build (18.x)

Unexpected any. Specify a different type

Check warning on line 56 in src/formatter.ts

View workflow job for this annotation

GitHub Actions / build (16.x)

Unexpected any. Specify a different type

Check warning on line 56 in src/formatter.ts

View workflow job for this annotation

GitHub Actions / build (14.x)

Unexpected any. Specify a different type

Check warning on line 56 in src/formatter.ts

View workflow job for this annotation

GitHub Actions / build (20.x)

Unexpected any. Specify a different type

Check warning on line 56 in src/formatter.ts

View workflow job for this annotation

GitHub Actions / build (20.x)

Unexpected any. Specify a different type

Check warning on line 56 in src/formatter.ts

View workflow job for this annotation

GitHub Actions / build (18.x)

Unexpected any. Specify a different type

inlineDirectives: any;

Check warning on line 58 in src/formatter.ts

View workflow job for this annotation

GitHub Actions / build (16.x)

Unexpected any. Specify a different type

Check warning on line 58 in src/formatter.ts

View workflow job for this annotation

GitHub Actions / build (14.x)

Unexpected any. Specify a different type

Check warning on line 58 in src/formatter.ts

View workflow job for this annotation

GitHub Actions / build (18.x)

Unexpected any. Specify a different type

Check warning on line 58 in src/formatter.ts

View workflow job for this annotation

GitHub Actions / build (16.x)

Unexpected any. Specify a different type

Check warning on line 58 in src/formatter.ts

View workflow job for this annotation

GitHub Actions / build (14.x)

Unexpected any. Specify a different type

Check warning on line 58 in src/formatter.ts

View workflow job for this annotation

GitHub Actions / build (20.x)

Unexpected any. Specify a different type

Check warning on line 58 in src/formatter.ts

View workflow job for this annotation

GitHub Actions / build (20.x)

Unexpected any. Specify a different type

Check warning on line 58 in src/formatter.ts

View workflow job for this annotation

GitHub Actions / build (18.x)

Unexpected any. Specify a different type

conditions: any;

Expand Down Expand Up @@ -881,7 +881,7 @@
async preserveHtmlAttributes(content: any) {
return _.replace(
content,
/(?<=<[\w\-\.\:\_]+[^]*\s)(?!x-bind)([^\s\:][^\s]+\s*=\s*(["'])(?<!\\)[^\2]*?(?<!\\)\2)(?=[^]*(?<!=)\/?>)/gms,
/(?<=<[\w\-\.\:\_]+[^]*\s)(?!x-bind)([^\s\:][^\s\'\"]+\s*=\s*(["'])(?<!\\)[^\2]*?(?<!\\)\2)(?=[^]*(?<!=)\/?>)/gms,
(match: string) => `${this.storeHtmlAttribute(match)}`,
);
}
Expand Down
Loading