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

Update named-exports-only to update default import to named #31

Closed brandongregoryscott closed 2 years ago

brandongregoryscott commented 2 years ago

Update named-exports-only rule to update import references for the updated export, i.e.

// button.tsx
const Button = () => {
    return <button></button>;
};

export default Button;
// page.tsx
import Button from "./button";

const Page = () => {
    return (
        <div>
            <Button />
            <Button />
        </div>
    )
};

will be transformed to:

// button.tsx
const Button = () => {
    return <button></button>;
};

export { Button };
// page.tsx
import { Button } from "./button";

const Page = () => {
    return (
        <div>
            <Button />
            <Button />
        </div>
    )
};