1
0
Fork 0
mirror of https://github.com/denoland/deno.git synced 2024-12-25 00:29:09 -05:00

fix(lint): revert no-deprecated-api for Deno.run (#17880)

This commit is contained in:
David Sherret 2023-02-22 11:14:53 -05:00 committed by GitHub
parent a2d942a778
commit b4b718d6ae
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
9 changed files with 4 additions and 40 deletions

4
Cargo.lock generated
View file

@ -1138,9 +1138,9 @@ dependencies = [
[[package]] [[package]]
name = "deno_lint" name = "deno_lint"
version = "0.38.0" version = "0.40.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "85201db46e6a8b4aeea4b5d574fd28e95477590ad08e128f2f043ec60442d550" checksum = "663d65cb008cddda1d705cd397d5d80fd37716e708b4182ca076244e18132ace"
dependencies = [ dependencies = [
"anyhow", "anyhow",
"deno_ast", "deno_ast",

View file

@ -47,7 +47,7 @@ deno_core = { workspace = true, features = ["include_js_files_for_snapshotting"]
deno_doc = "0.55.0" deno_doc = "0.55.0"
deno_emit = "0.15.0" deno_emit = "0.15.0"
deno_graph = "0.43.3" deno_graph = "0.43.3"
deno_lint = { version = "0.38.0", features = ["docs"] } deno_lint = { version = "0.40.0", features = ["docs"] }
deno_lockfile.workspace = true deno_lockfile.workspace = true
deno_runtime = { workspace = true, features = ["dont_create_runtime_snapshot", "include_js_files_for_snapshotting"] } deno_runtime = { workspace = true, features = ["dont_create_runtime_snapshot", "include_js_files_for_snapshotting"] }
deno_task_shell = "0.8.1" deno_task_shell = "0.8.1"

View file

@ -10,7 +10,6 @@ const path = new URL("./deno_http_flash_ops.js", import.meta.url).pathname;
const cpus = navigator.hardwareConcurrency / 2; const cpus = navigator.hardwareConcurrency / 2;
const processes = new Array(cpus); const processes = new Array(cpus);
for (let i = 0; i < cpus; i++) { for (let i = 0; i < cpus; i++) {
// deno-lint-ignore no-deprecated-deno-api
const proc = Deno.run({ const proc = Deno.run({
cmd: [executable, "run", "-A", "--unstable", path, Deno.args[0]], cmd: [executable, "run", "-A", "--unstable", path, Deno.args[0]],
}); });

View file

@ -10,7 +10,6 @@ const path = new URL("./deno_http_flash.js", import.meta.url).pathname;
const cpus = navigator.hardwareConcurrency / 2; const cpus = navigator.hardwareConcurrency / 2;
const processes = new Array(cpus); const processes = new Array(cpus);
for (let i = 0; i < cpus; i++) { for (let i = 0; i < cpus; i++) {
// deno-lint-ignore no-deprecated-deno-api
const proc = Deno.run({ const proc = Deno.run({
cmd: [executable, "run", "-A", "--unstable", path, Deno.args[0]], cmd: [executable, "run", "-A", "--unstable", path, Deno.args[0]],
}); });

View file

@ -7,7 +7,6 @@ Deno.test("complex", function () {
Deno.test("sub process with stdin", async () => { Deno.test("sub process with stdin", async () => {
// ensure launching deno run with stdin doesn't affect coverage // ensure launching deno run with stdin doesn't affect coverage
const code = "console.log('5')"; const code = "console.log('5')";
// deno-lint-ignore no-deprecated-deno-api
const p = await Deno.run({ const p = await Deno.run({
cmd: [Deno.execPath(), "run", "-"], cmd: [Deno.execPath(), "run", "-"],
stdin: "piped", stdin: "piped",
@ -26,7 +25,6 @@ Deno.test("sub process with stdin", async () => {
Deno.test("sub process with deno eval", async () => { Deno.test("sub process with deno eval", async () => {
// ensure launching deno eval doesn't affect coverage // ensure launching deno eval doesn't affect coverage
const code = "console.log('5')"; const code = "console.log('5')";
// deno-lint-ignore no-deprecated-deno-api
const p = await Deno.run({ const p = await Deno.run({
cmd: [Deno.execPath(), "eval", code], cmd: [Deno.execPath(), "eval", code],
stdout: "piped", stdout: "piped",

View file

@ -1,5 +1,4 @@
Deno.test("output", async () => { Deno.test("output", async () => {
// deno-lint-ignore no-deprecated-deno-api
const p = Deno.run({ const p = Deno.run({
cmd: [Deno.execPath(), "eval", "console.log(0); console.error(1);"], cmd: [Deno.execPath(), "eval", "console.log(0); console.error(1);"],
}); });

View file

@ -2085,7 +2085,6 @@ Deno.test({
"--header", "--header",
"Accept-Encoding: deflate, gzip", "Accept-Encoding: deflate, gzip",
]; ];
// deno-lint-ignore no-deprecated-deno-api
const proc = Deno.run({ cmd, stdout: "piped", stderr: "null" }); const proc = Deno.run({ cmd, stdout: "piped", stderr: "null" });
const status = await proc.status(); const status = await proc.status();
assert(status.success); assert(status.success);
@ -2148,7 +2147,6 @@ Deno.test({
"--header", "--header",
"Accept-Encoding: deflate, gzip", "Accept-Encoding: deflate, gzip",
]; ];
// deno-lint-ignore no-deprecated-deno-api
const proc = Deno.run({ cmd, stdout: "piped", stderr: "null" }); const proc = Deno.run({ cmd, stdout: "piped", stderr: "null" });
const status = await proc.status(); const status = await proc.status();
assert(status.success); assert(status.success);

View file

@ -11,7 +11,6 @@ Deno.test(
{ permissions: { read: true, run: false } }, { permissions: { read: true, run: false } },
function runPermissions() { function runPermissions() {
assertThrows(() => { assertThrows(() => {
// deno-lint-ignore no-deprecated-deno-api
Deno.run({ Deno.run({
cmd: [Deno.execPath(), "eval", "console.log('hello world')"], cmd: [Deno.execPath(), "eval", "console.log('hello world')"],
}); });
@ -22,7 +21,6 @@ Deno.test(
Deno.test( Deno.test(
{ permissions: { run: true, read: true } }, { permissions: { run: true, read: true } },
async function runSuccess() { async function runSuccess() {
// deno-lint-ignore no-deprecated-deno-api
const p = Deno.run({ const p = Deno.run({
// freeze the array to ensure it's not modified // freeze the array to ensure it's not modified
cmd: Object.freeze([ cmd: Object.freeze([
@ -45,7 +43,6 @@ Deno.test(
Deno.test( Deno.test(
{ permissions: { run: true, read: true } }, { permissions: { run: true, read: true } },
async function runUrl() { async function runUrl() {
// deno-lint-ignore no-deprecated-deno-api
const p = Deno.run({ const p = Deno.run({
cmd: [ cmd: [
new URL(`file:///${Deno.execPath()}`), new URL(`file:///${Deno.execPath()}`),
@ -69,7 +66,6 @@ Deno.test(
async function runStdinRid0(): Promise< async function runStdinRid0(): Promise<
void void
> { > {
// deno-lint-ignore no-deprecated-deno-api
const p = Deno.run({ const p = Deno.run({
cmd: [Deno.execPath(), "eval", "console.log('hello world')"], cmd: [Deno.execPath(), "eval", "console.log('hello world')"],
stdin: 0, stdin: 0,
@ -89,7 +85,6 @@ Deno.test(
{ permissions: { run: true, read: true } }, { permissions: { run: true, read: true } },
function runInvalidStdio() { function runInvalidStdio() {
assertThrows(() => assertThrows(() =>
// deno-lint-ignore no-deprecated-deno-api
Deno.run({ Deno.run({
cmd: [Deno.execPath(), "eval", "console.log('hello world')"], cmd: [Deno.execPath(), "eval", "console.log('hello world')"],
// @ts-expect-error because Deno.run should throw on invalid stdin. // @ts-expect-error because Deno.run should throw on invalid stdin.
@ -97,7 +92,6 @@ Deno.test(
}) })
); );
assertThrows(() => assertThrows(() =>
// deno-lint-ignore no-deprecated-deno-api
Deno.run({ Deno.run({
cmd: [Deno.execPath(), "eval", "console.log('hello world')"], cmd: [Deno.execPath(), "eval", "console.log('hello world')"],
// @ts-expect-error because Deno.run should throw on invalid stdout. // @ts-expect-error because Deno.run should throw on invalid stdout.
@ -105,7 +99,6 @@ Deno.test(
}) })
); );
assertThrows(() => assertThrows(() =>
// deno-lint-ignore no-deprecated-deno-api
Deno.run({ Deno.run({
cmd: [Deno.execPath(), "eval", "console.log('hello world')"], cmd: [Deno.execPath(), "eval", "console.log('hello world')"],
// @ts-expect-error because Deno.run should throw on invalid stderr. // @ts-expect-error because Deno.run should throw on invalid stderr.
@ -118,7 +111,6 @@ Deno.test(
Deno.test( Deno.test(
{ permissions: { run: true, read: true } }, { permissions: { run: true, read: true } },
async function runCommandFailedWithCode() { async function runCommandFailedWithCode() {
// deno-lint-ignore no-deprecated-deno-api
const p = Deno.run({ const p = Deno.run({
cmd: [Deno.execPath(), "eval", "Deno.exit(41 + 1)"], cmd: [Deno.execPath(), "eval", "Deno.exit(41 + 1)"],
}); });
@ -135,7 +127,6 @@ Deno.test(
permissions: { run: true, read: true }, permissions: { run: true, read: true },
}, },
async function runCommandFailedWithSignal() { async function runCommandFailedWithSignal() {
// deno-lint-ignore no-deprecated-deno-api
const p = Deno.run({ const p = Deno.run({
cmd: [ cmd: [
Deno.execPath(), Deno.execPath(),
@ -159,7 +150,6 @@ Deno.test(
Deno.test({ permissions: { run: true } }, function runNotFound() { Deno.test({ permissions: { run: true } }, function runNotFound() {
let error; let error;
try { try {
// deno-lint-ignore no-deprecated-deno-api
Deno.run({ cmd: ["this file hopefully doesn't exist"] }); Deno.run({ cmd: ["this file hopefully doesn't exist"] });
} catch (e) { } catch (e) {
error = e; error = e;
@ -191,7 +181,6 @@ tryExit();
`; `;
Deno.writeFileSync(`${cwd}/${programFile}`, enc.encode(program)); Deno.writeFileSync(`${cwd}/${programFile}`, enc.encode(program));
// deno-lint-ignore no-deprecated-deno-api
const p = Deno.run({ const p = Deno.run({
cwd, cwd,
cmd: [Deno.execPath(), "run", "--allow-read", programFile], cmd: [Deno.execPath(), "run", "--allow-read", programFile],
@ -215,7 +204,6 @@ Deno.test(
async function runStdinPiped(): Promise< async function runStdinPiped(): Promise<
void void
> { > {
// deno-lint-ignore no-deprecated-deno-api
const p = Deno.run({ const p = Deno.run({
cmd: [ cmd: [
Deno.execPath(), Deno.execPath(),
@ -247,7 +235,6 @@ Deno.test(
async function runStdoutPiped(): Promise< async function runStdoutPiped(): Promise<
void void
> { > {
// deno-lint-ignore no-deprecated-deno-api
const p = Deno.run({ const p = Deno.run({
cmd: [ cmd: [
Deno.execPath(), Deno.execPath(),
@ -284,7 +271,6 @@ Deno.test(
async function runStderrPiped(): Promise< async function runStderrPiped(): Promise<
void void
> { > {
// deno-lint-ignore no-deprecated-deno-api
const p = Deno.run({ const p = Deno.run({
cmd: [ cmd: [
Deno.execPath(), Deno.execPath(),
@ -319,7 +305,6 @@ Deno.test(
Deno.test( Deno.test(
{ permissions: { run: true, read: true } }, { permissions: { run: true, read: true } },
async function runOutput() { async function runOutput() {
// deno-lint-ignore no-deprecated-deno-api
const p = Deno.run({ const p = Deno.run({
cmd: [ cmd: [
Deno.execPath(), Deno.execPath(),
@ -340,7 +325,6 @@ Deno.test(
async function runStderrOutput(): Promise< async function runStderrOutput(): Promise<
void void
> { > {
// deno-lint-ignore no-deprecated-deno-api
const p = Deno.run({ const p = Deno.run({
cmd: [ cmd: [
Deno.execPath(), Deno.execPath(),
@ -366,7 +350,6 @@ Deno.test(
write: true, write: true,
}); });
// deno-lint-ignore no-deprecated-deno-api
const p = Deno.run({ const p = Deno.run({
cmd: [ cmd: [
Deno.execPath(), Deno.execPath(),
@ -399,7 +382,6 @@ Deno.test(
await Deno.writeFile(fileName, encoder.encode("hello")); await Deno.writeFile(fileName, encoder.encode("hello"));
const file = await Deno.open(fileName); const file = await Deno.open(fileName);
// deno-lint-ignore no-deprecated-deno-api
const p = Deno.run({ const p = Deno.run({
cmd: [ cmd: [
Deno.execPath(), Deno.execPath(),
@ -419,7 +401,6 @@ Deno.test(
Deno.test( Deno.test(
{ permissions: { run: true, read: true } }, { permissions: { run: true, read: true } },
async function runEnv() { async function runEnv() {
// deno-lint-ignore no-deprecated-deno-api
const p = Deno.run({ const p = Deno.run({
cmd: [ cmd: [
Deno.execPath(), Deno.execPath(),
@ -442,7 +423,6 @@ Deno.test(
Deno.test( Deno.test(
{ permissions: { run: true, read: true } }, { permissions: { run: true, read: true } },
async function runClose() { async function runClose() {
// deno-lint-ignore no-deprecated-deno-api
const p = Deno.run({ const p = Deno.run({
cmd: [ cmd: [
Deno.execPath(), Deno.execPath(),
@ -466,7 +446,6 @@ Deno.test(
Deno.test( Deno.test(
{ permissions: { run: true, read: true } }, { permissions: { run: true, read: true } },
async function runKillAfterStatus() { async function runKillAfterStatus() {
// deno-lint-ignore no-deprecated-deno-api
const p = Deno.run({ const p = Deno.run({
cmd: [Deno.execPath(), "eval", 'console.log("hello")'], cmd: [Deno.execPath(), "eval", 'console.log("hello")'],
}); });
@ -523,7 +502,6 @@ Deno.test(
Deno.test( Deno.test(
{ permissions: { run: true, read: true } }, { permissions: { run: true, read: true } },
async function killSuccess() { async function killSuccess() {
// deno-lint-ignore no-deprecated-deno-api
const p = Deno.run({ const p = Deno.run({
cmd: [Deno.execPath(), "eval", "setTimeout(() => {}, 10000)"], cmd: [Deno.execPath(), "eval", "setTimeout(() => {}, 10000)"],
}); });
@ -547,7 +525,6 @@ Deno.test(
); );
Deno.test({ permissions: { run: true, read: true } }, function killFailed() { Deno.test({ permissions: { run: true, read: true } }, function killFailed() {
// deno-lint-ignore no-deprecated-deno-api
const p = Deno.run({ const p = Deno.run({
cmd: [Deno.execPath(), "eval", "setTimeout(() => {}, 10000)"], cmd: [Deno.execPath(), "eval", "setTimeout(() => {}, 10000)"],
}); });
@ -565,7 +542,6 @@ Deno.test({ permissions: { run: true, read: true } }, function killFailed() {
Deno.test( Deno.test(
{ permissions: { run: true, read: true, env: true } }, { permissions: { run: true, read: true, env: true } },
async function clearEnv(): Promise<void> { async function clearEnv(): Promise<void> {
// deno-lint-ignore no-deprecated-deno-api
const p = Deno.run({ const p = Deno.run({
cmd: [ cmd: [
Deno.execPath(), Deno.execPath(),
@ -598,7 +574,6 @@ Deno.test(
ignore: Deno.build.os === "windows", ignore: Deno.build.os === "windows",
}, },
async function uid(): Promise<void> { async function uid(): Promise<void> {
// deno-lint-ignore no-deprecated-deno-api
const p = Deno.run({ const p = Deno.run({
cmd: [ cmd: [
"id", "id",
@ -612,7 +587,6 @@ Deno.test(
if (currentUid !== "0") { if (currentUid !== "0") {
assertThrows(() => { assertThrows(() => {
// deno-lint-ignore no-deprecated-deno-api
Deno.run({ Deno.run({
cmd: [ cmd: [
"echo", "echo",
@ -631,7 +605,6 @@ Deno.test(
ignore: Deno.build.os === "windows", ignore: Deno.build.os === "windows",
}, },
async function gid(): Promise<void> { async function gid(): Promise<void> {
// deno-lint-ignore no-deprecated-deno-api
const p = Deno.run({ const p = Deno.run({
cmd: [ cmd: [
"id", "id",
@ -645,7 +618,6 @@ Deno.test(
if (currentGid !== "0") { if (currentGid !== "0") {
assertThrows(() => { assertThrows(() => {
// deno-lint-ignore no-deprecated-deno-api
Deno.run({ Deno.run({
cmd: [ cmd: [
"echo", "echo",
@ -664,7 +636,6 @@ Deno.test(
ignore: Deno.build.os === "windows", ignore: Deno.build.os === "windows",
}, },
async function non_existent_cwd(): Promise<void> { async function non_existent_cwd(): Promise<void> {
// deno-lint-ignore no-deprecated-deno-api
const p = Deno.run({ const p = Deno.run({
cmd: [ cmd: [
Deno.execPath(), Deno.execPath(),

@ -1 +1 @@
Subproject commit b057caf2338df8ef887de464bba0ca085fa8a2b1 Subproject commit ff2ffb4fd917cabe4441fdb1d8f5e842ce58be9a