Remove extra lines in --file-info and --support-info (#17332)

This commit is contained in:
fisker Cheung authored and GitHub committed 2025-04-09 15:23:50 +08:00
1 parent 1b4a63c114
commit fe536ff6b1
5 files changed
+21 -60

No files matched your search

+3 -1
View File
@@ -18,7 +18,9 @@ async function logFileInfoOrDie(context) {
resolveConfig: config !== false,
});
printToScreen(await format(stringify(fileInfo), { parser: "json" }));
const result = await format(stringify(fileInfo), { parser: "json" });
printToScreen(result.trim());
}
export default logFileInfoOrDie;
+3 -1
View File
@@ -14,7 +14,9 @@ async function printSupportInfo() {
),
};
printToScreen(await format(stringify(supportInfo), { parser: "json" }));
const result = await format(stringify(supportInfo), { parser: "json" });
printToScreen(result.trim());
}
export default printSupportInfo;
@@ -2,113 +2,74 @@
exports[`extracts file-info for a file in not_node_modules (stderr) 1`] = `""`;
exports[`extracts file-info for a file in not_node_modules (stdout) 1`] = `
"{ "ignored": false, "inferredParser": "babel" }
"
`;
exports[`extracts file-info for a file in not_node_modules (stdout) 1`] = `"{ "ignored": false, "inferredParser": "babel" }"`;
exports[`extracts file-info for a file in not_node_modules (write) 1`] = `[]`;
exports[`extracts file-info for a js file (stderr) 1`] = `""`;
exports[`extracts file-info for a js file (stdout) 1`] = `
"{ "ignored": false, "inferredParser": "babel" }
"
`;
exports[`extracts file-info for a js file (stdout) 1`] = `"{ "ignored": false, "inferredParser": "babel" }"`;
exports[`extracts file-info for a js file (write) 1`] = `[]`;
exports[`extracts file-info for a known markdown file with no extension (stderr) 1`] = `""`;
exports[`extracts file-info for a known markdown file with no extension (stdout) 1`] = `
"{ "ignored": false, "inferredParser": "markdown" }
"
`;
exports[`extracts file-info for a known markdown file with no extension (stdout) 1`] = `"{ "ignored": false, "inferredParser": "markdown" }"`;
exports[`extracts file-info for a known markdown file with no extension (write) 1`] = `[]`;
exports[`extracts file-info for a markdown file (stderr) 1`] = `""`;
exports[`extracts file-info for a markdown file (stdout) 1`] = `
"{ "ignored": false, "inferredParser": "markdown" }
"
`;
exports[`extracts file-info for a markdown file (stdout) 1`] = `"{ "ignored": false, "inferredParser": "markdown" }"`;
exports[`extracts file-info for a markdown file (write) 1`] = `[]`;
exports[`extracts file-info with ignored=false for a file in node_modules when --with-node-modules provided (stderr) 1`] = `""`;
exports[`extracts file-info with ignored=false for a file in node_modules when --with-node-modules provided (stdout) 1`] = `
"{ "ignored": false, "inferredParser": "babel" }
"
`;
exports[`extracts file-info with ignored=false for a file in node_modules when --with-node-modules provided (stdout) 1`] = `"{ "ignored": false, "inferredParser": "babel" }"`;
exports[`extracts file-info with ignored=false for a file in node_modules when --with-node-modules provided (write) 1`] = `[]`;
exports[`extracts file-info with ignored=true for a file in .prettierignore (stderr) 1`] = `""`;
exports[`extracts file-info with ignored=true for a file in .prettierignore (stdout) 1`] = `
"{ "ignored": true, "inferredParser": null }
"
`;
exports[`extracts file-info with ignored=true for a file in .prettierignore (stdout) 1`] = `"{ "ignored": true, "inferredParser": null }"`;
exports[`extracts file-info with ignored=true for a file in .prettierignore (write) 1`] = `[]`;
exports[`extracts file-info with ignored=true for a file in a hand-picked ignore file (stderr) 1`] = `""`;
exports[`extracts file-info with ignored=true for a file in a hand-picked ignore file (stdout) 1`] = `
"{ "ignored": true, "inferredParser": null }
"
`;
exports[`extracts file-info with ignored=true for a file in a hand-picked ignore file (stdout) 1`] = `"{ "ignored": true, "inferredParser": null }"`;
exports[`extracts file-info with ignored=true for a file in a hand-picked ignore file (write) 1`] = `[]`;
exports[`extracts file-info with inferredParser=foo when a plugin is hand-picked (stderr) 1`] = `""`;
exports[`extracts file-info with inferredParser=foo when a plugin is hand-picked (stdout) 1`] = `
"{ "ignored": false, "inferredParser": "foo" }
"
`;
exports[`extracts file-info with inferredParser=foo when a plugin is hand-picked (stdout) 1`] = `"{ "ignored": false, "inferredParser": "foo" }"`;
exports[`extracts file-info with inferredParser=foo when a plugin is hand-picked (write) 1`] = `[]`;
exports[`extracts file-info with inferredParser=null for file.foo (stderr) 1`] = `""`;
exports[`extracts file-info with inferredParser=null for file.foo (stdout) 1`] = `
"{ "ignored": false, "inferredParser": null }
"
`;
exports[`extracts file-info with inferredParser=null for file.foo (stdout) 1`] = `"{ "ignored": false, "inferredParser": null }"`;
exports[`extracts file-info with inferredParser=null for file.foo (write) 1`] = `[]`;
exports[`extracts file-info with with ignored=true for a file in node_modules (stderr) 1`] = `""`;
exports[`extracts file-info with with ignored=true for a file in node_modules (stdout) 1`] = `
"{ "ignored": true, "inferredParser": null }
"
`;
exports[`extracts file-info with with ignored=true for a file in node_modules (stdout) 1`] = `"{ "ignored": true, "inferredParser": null }"`;
exports[`extracts file-info with with ignored=true for a file in node_modules (write) 1`] = `[]`;
exports[`file-info should not try resolve config with --no-config (stdout) 1`] = `
"{ "ignored": false, "inferredParser": "babel" }
"
`;
exports[`file-info should not try resolve config with --no-config (stdout) 1`] = `"{ "ignored": false, "inferredParser": "babel" }"`;
exports[`file-info should try resolve config (stderr) 1`] = `""`;
exports[`file-info should try resolve config (stdout) 1`] = `
"{ "ignored": false, "inferredParser": "override-js-parser" }
"
`;
exports[`file-info should try resolve config (stdout) 1`] = `"{ "ignored": false, "inferredParser": "override-js-parser" }"`;
exports[`file-info should try resolve config (write) 1`] = `[]`;
exports[`non-exists ignore path (stderr) 1`] = `""`;
exports[`non-exists ignore path (stdout) 1`] = `
"{ "ignored": false, "inferredParser": "babel" }
"
`;
exports[`non-exists ignore path (stdout) 1`] = `"{ "ignored": false, "inferredParser": "babel" }"`;
exports[`non-exists ignore path (write) 1`] = `[]`;
@@ -76,10 +76,7 @@ exports[`--write with unknown path and no parser multiple files (write) 1`] = `
exports[`--write with unknown path and no parser specific file (stderr) 1`] = `"[error] No parser could be inferred for file "<cli>/infer-parser/FOO"."`;
exports[`Interpreters (stdout) 1`] = `
"{ "ignored": false, "inferredParser": "babel" }
"
`;
exports[`Interpreters (stdout) 1`] = `"{ "ignored": false, "inferredParser": "babel" }"`;
exports[`Known/Unknown (stdout) 1`] = `"known.js"`;
@@ -1153,8 +1153,7 @@ exports[`CLI --support-info (stdout) 1`] = `
"type": "boolean"
}
]
}
"
}"
`;
exports[`CLI --support-info (write) 1`] = `[]`;