Do not crash when parser can't be inferred
This commit is contained in:
parent
5a7dacfcdd
commit
4bbc0241ec
@ -101,7 +101,7 @@ export async function runPrettier(params: {
|
|||||||
resolveConfig: true
|
resolveConfig: true
|
||||||
});
|
});
|
||||||
|
|
||||||
if (ignored) {
|
if (ignored || inferredParser === null) {
|
||||||
return sourceCode;
|
return sourceCode;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -110,7 +110,7 @@ export async function runPrettier(params: {
|
|||||||
formattedSourceCode = await prettier.format(sourceCode, {
|
formattedSourceCode = await prettier.format(sourceCode, {
|
||||||
...config,
|
...config,
|
||||||
filePath,
|
filePath,
|
||||||
parser: inferredParser ?? undefined
|
parser: inferredParser
|
||||||
});
|
});
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.log(
|
console.log(
|
||||||
|
Loading…
x
Reference in New Issue
Block a user