brandongregoryscott / eslint-plugin-collation

ESLint plugin for making your code easier to read, with autofix and TypeScript support
https://eslint-plugin-collation.brandonscott.me
Apache License 2.0
4 stars 0 forks source link

Bug: alphabetize-jsx-props only sorts nested JsxElements 1 level, it seems #35

Closed brandongregoryscott closed 2 years ago

brandongregoryscott commented 2 years ago

While there's a current test that covers this scenario:

// input
<Button marginY={8} marginRight={12} iconAfter={<CogIcon size={24} color="gray" />}>
    Settings
</Button>

// expected
<Button iconAfter={<CogIcon color="gray" size={24} />} marginRight={12} marginY={8}>
    Settings
</Button>

A forgotten node error will throw on this setup:

// input
<Pane>
    <FormField
        label="Preview"
        hint={
            <InlineAlert>
                Curve and Release changes will not be reflected until
                saving and reopening.
            </InlineAlert>
        }>
        <Button marginY={8} marginRight={12} iconAfter={<CogIcon size={24} color="gray" />}>
            Settings
        </Button>
    </FormField>
</Pane>

// expected
<Pane>
    <FormField
        hint={
            <InlineAlert>
                Curve and Release changes will not be reflected until
                saving and reopening.
            </InlineAlert>
        }
        label="Preview">
        <Button iconAfter={<CogIcon color="gray" size={24} />} marginRight={12} marginY={8}>
            Settings
        </Button>
    </FormField>
</Pane>
brandongregoryscott commented 2 years ago

Resolved with https://github.com/brandongregoryscott/collation/commit/3e1df555c582a18ce8b39aad30ce7f821fa7e0e8