Support async parser (#12748)

This commit is contained in:
fisker Cheung authored and GitHub committed 2022-05-04 11:15:48 +08:00
1 parent 62a59c341c
commit e14411c278
17 files changed
+217 -50

No files matched your search

@@ -0,0 +1,14 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP
exports[`async-parser.txt format 1`] = `
====================================options=====================================
parsers: ["async-parser"]
printWidth: 80
| printWidth
=====================================input======================================
A text will format as "Formatted by async-parser plugin".
=====================================output=====================================
Formatted by async-parser plugin
================================================================================
`;
@@ -0,0 +1 @@
A text will format as "Formatted by async-parser plugin".
@@ -0,0 +1,9 @@
import createEsmUtils from "esm-utils";
const { require } = createEsmUtils(import.meta);
const plugins = [
require("../../../../config/prettier-plugins/prettier-plugin-async-parser/index.cjs"),
];
run_spec(import.meta, ["async-parser"], { plugins });
@@ -0,0 +1,40 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP
exports[`async-parser.txt format 1`] = `
====================================options=====================================
parsers: ["async-parser"]
printWidth: 80
| printWidth
=====================================input======================================
A text will format as "Formatted by async-parser plugin".
=====================================output=====================================
Formatted by async-parser plugin
================================================================================
`;
exports[`with-aync-parser-code-block.md format 1`] = `
====================================options=====================================
parsers: ["markdown"]
printWidth: 80
| printWidth
=====================================input======================================
\`\`\`async-parser
Since we don't allow async parser in embed format, so this will not be changed.
\`\`\`
\`\`\`uppercase-rocks
This text should be uppercased.
\`\`\`
=====================================output=====================================
\`\`\`async-parser
Since we don't allow async parser in embed format, so this will not be changed.
\`\`\`
\`\`\`uppercase-rocks
THIS TEXT SHOULD BE UPPERCASED.
\`\`\`
================================================================================
`;
@@ -0,0 +1,10 @@
import createEsmUtils from "esm-utils";
const { require } = createEsmUtils(import.meta);
const plugins = [
require("../../../../config/prettier-plugins/prettier-plugin-async-parser/index.cjs"),
require("../../../../config/prettier-plugins/prettier-plugin-uppercase-rocks/index.cjs"),
];
run_spec(import.meta, ["markdown"], { plugins });
@@ -0,0 +1,7 @@
```async-parser
Since we don't allow async parser in embed format, so this will not be changed.
```
```uppercase-rocks
This text should be uppercased.
```