PromucFlow_constructor/app/client/src/plugins/Linting/utils/getJSToLint.ts

15 lines
440 B
TypeScript
Raw Normal View History

import type { DataTreeEntity } from "entities/DataTree/dataTreeFactory";
import { isJSAction } from "@appsmith/workers/Evaluation/evaluationUtils";
// Removes "export default" statement from js Object
export function getJSToLint(
entity: DataTreeEntity,
snippet: string,
propertyPath: string,
): string {
return entity && isJSAction(entity) && propertyPath === "body"
? snippet.replace(/export default/g, "")
: snippet;
}