Skip to content
This repository was archived by the owner on Dec 8, 2023. It is now read-only.
This repository was archived by the owner on Dec 8, 2023. It is now read-only.

replace_import doesn't work if there are no other AST nodes #205

@morgante

Description

@morgante

If a file is only a single AST node, using replace_import fails.

Sample file:

import { ThemeProvider } from '@mui/styles';

Pattern:

engine marzano(0.1)
language js

`ThemeProvider` as $target where {
    $target <: replace_import($old, new=`"@mui/material/styles"`), 
}

Expected output:

import { ThemeProvider } from "@mui/material/styles";

Actual output:

import { ThemeProvider } from "@mui/material/styles";

import { ThemeProvider } from '@mui/styles';

Adding even a blank after the import is sufficient to restore the expected/correct behavior.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions