Skip to content

🎥 Make videos programmatically with React

remove prettier

JonnyBurgerdbdea822b482
diff --git a/packages/studio-server/src/codemods/update-sequence-props.ts b/packages/studio-server/src/codemods/update-sequence-props.ts
index cf03d9a5d3..3675e32f4a 100644
--- a/packages/studio-server/src/codemods/update-sequence-props.ts
+++ b/packages/studio-server/src/codemods/update-sequence-props.ts
@@ -4,7 +4,7 @@ import type {ExpressionKind} from 'ast-types/lib/gen/kinds';
import * as recast from 'recast';
import {parseAst, serializeAst} from './parse-ast';
-export const updateSequenceProps = async ({
+export const updateSequenceProps = ({
input,
targetLine,
key,
@@ -18,7 +18,7 @@ export const updateSequenceProps = async ({
value: unknown;
enumPaths: EnumPath[];
defaultValue: unknown | null;
-}): Promise<{output: string; oldValueString: string}> => {
+}): {output: string; oldValueString: string} => {
const ast = parseAst(input);
let found = false;
let oldValueString = '';
@@ -114,37 +114,5 @@ export const updateSequenceProps = async ({
);
}
- // eslint-disable-next-line @typescript-eslint/consistent-type-imports
- type PrettierType = typeof import('prettier');
- let prettier: PrettierType | null = null;
-
- try {
- prettier = await import('prettier');
- } catch {
- throw new Error('Prettier cannot be found in the current project.');
- }
-
- const {format, resolveConfig, resolveConfigFile} = prettier as PrettierType;
-
- const configFilePath = await resolveConfigFile();
- if (!configFilePath) {
- throw new Error('The Prettier config file was not found');
- }
-
- const prettierConfig = await resolveConfig(configFilePath);
- if (!prettierConfig) {
- throw new Error(
- 'The Prettier config file was not found. For this feature, the "prettier" package must be installed and a .prettierrc file must exist.',
- );
- }
-
- const finalFile = serializeAst(ast);
-
- const prettified = await format(finalFile, {
- ...prettierConfig,
- filepath: 'test.tsx',
- plugins: [],
- endOfLine: 'auto',
- });
- return {output: prettified, oldValueString};
+ return {output: serializeAst(ast), oldValueString};
};
diff --git a/packages/studio-server/src/preview-server/routes/save-sequence-props.ts b/packages/studio-server/src/preview-server/routes/save-sequence-props.ts
index 8c18644379..0e94f723ad 100644
--- a/packages/studio-server/src/preview-server/routes/save-sequence-props.ts
+++ b/packages/studio-server/src/preview-server/routes/save-sequence-props.ts
@@ -27,7 +27,7 @@ export const saveSequencePropsHandler: ApiHandler<
const fileContents = readFileSync(absolutePath, 'utf-8');
- const {output, oldValueString} = await updateSequenceProps({
+ const {output, oldValueString} = updateSequenceProps({
input: fileContents,
targetLine: line,
key,