feat(cli): add ignore directives to bundled code (#13309)

This commit adds lint and fmt ignore directives to bundled
code as well as a comment stating that the code was bundled
and shouldn't be edited manually.
This commit is contained in:
juju 2022-01-12 20:05:06 +08:00 committed by GitHub
parent 62291e9b0e
commit 50e8ab8a86
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
7 changed files with 44 additions and 3 deletions

View file

@ -418,10 +418,21 @@ Deno.test({
"/b.ts": `export const b = "b";`,
},
});
const ignoreDirecives = [
"// deno-fmt-ignore-file",
"// deno-lint-ignore-file",
"// This code was bundled using `deno bundle` and it's not recommended to edit it manually",
"",
"",
].join("\n");
assert(diagnostics);
assertEquals(diagnostics.length, 0);
assertEquals(Object.keys(files).length, 2);
assert(files["deno:///bundle.js"].startsWith("(function() {\n"));
assert(
files["deno:///bundle.js"].startsWith(
ignoreDirecives + "(function() {\n",
),
);
assert(files["deno:///bundle.js"].endsWith("})();\n"));
assert(files["deno:///bundle.js.map"]);
},