Skip to content

BREAKING(fs,dotenv): drop Deno v1.x support #6624

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ jobs:
fail-fast: false
matrix:
deno:
- v1.x
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If we drop v1 CI, we don't what packages work in v1 anymore (any package could randomly break in v1 in the future development)

- v2.x
- canary
os:
Expand Down
5 changes: 2 additions & 3 deletions _tools/lint_plugin.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
// Copyright 2018-2025 the Deno authors. MIT license.
// @ts-nocheck Deno.lint namespace does not pass type checking in Deno 1.x

/**
* Lint plugin that enforces the
Expand Down Expand Up @@ -258,15 +257,15 @@ export default {
const value = argument.value;
if (typeof value !== "string") return;

if (value[0] !== value[0].toUpperCase()) {
if (value[0] !== value[0]!.toUpperCase()) {
context.report({
node: argument,
message: "Error message starts with a lowercase.",
hint:
"Capitalize the error message. See https://docs.deno.com/runtime/contributing/style_guide/#error-messages for more details.",
fix(fixer) {
const newValue = argument.raw.at(0) +
value[0].toUpperCase() +
value[0]!.toUpperCase() +
value.slice(1) +
argument.raw.at(-1);
return fixer.replaceText(argument, newValue);
Expand Down
7 changes: 1 addition & 6 deletions dotenv/mod_test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ import {
} from "@std/assert";
import { load, type LoadOptions, loadSync } from "./mod.ts";
import * as path from "@std/path";
import { IS_DENO_2 } from "../internal/_is_deno_2.ts";

const moduleDir = path.dirname(path.fromFileUrl(import.meta.url));
const testdataDir = path.resolve(moduleDir, "testdata");
Expand Down Expand Up @@ -174,11 +173,7 @@ Deno.test(
};
assertThrows(
() => loadSync(loadOptions),
IS_DENO_2
// TODO(iuioiua): Just use `Deno.errors.NotCapable` once Deno 2 is released.
// deno-lint-ignore no-explicit-any
? (Deno as any).errors.NotCapable
: Deno.errors.PermissionDenied,
Deno.errors.NotCapable,
`Requires env access to "EMPTY", run again with the --allow-env flag`,
);
},
Expand Down
19 changes: 2 additions & 17 deletions fs/ensure_dir_test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ import { assertEquals, assertRejects, assertThrows } from "@std/assert";
import * as path from "@std/path";
import { ensureDir, ensureDirSync } from "./ensure_dir.ts";
import { ensureFile, ensureFileSync } from "./ensure_file.ts";
import { IS_DENO_2 } from "../internal/_is_deno_2.ts";

const moduleDir = path.dirname(path.fromFileUrl(import.meta.url));
const testdataDir = path.resolve(moduleDir, "testdata", "ensure_dir");
Expand Down Expand Up @@ -182,14 +181,7 @@ Deno.test({

// ensureDir fails because this test doesn't have write permissions,
// but don't swallow that error.
await assertRejects(
async () => await ensureDir(baseDir),
IS_DENO_2
// TODO(iuioiua): Just use `Deno.errors.NotCapable` once Deno 2 is released.
// deno-lint-ignore no-explicit-any
? (Deno as any).errors.NotCapable
: Deno.errors.PermissionDenied,
);
await assertRejects(() => ensureDir(baseDir), Deno.errors.NotCapable);
},
});

Expand All @@ -204,14 +196,7 @@ Deno.test({

// ensureDirSync fails because this test doesn't have write permissions,
// but don't swallow that error.
assertThrows(
() => ensureDirSync(baseDir),
IS_DENO_2
// TODO(iuioiua): Just use `Deno.errors.NotCapable` once Deno 2 is released.
// deno-lint-ignore no-explicit-any
? (Deno as any).errors.NotCapable
: Deno.errors.PermissionDenied,
);
assertThrows(() => ensureDirSync(baseDir), Deno.errors.NotCapable);
},
});

Expand Down
19 changes: 2 additions & 17 deletions fs/ensure_file_test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
import { assertRejects, assertThrows } from "@std/assert";
import * as path from "@std/path";
import { ensureFile, ensureFileSync } from "./ensure_file.ts";
import { IS_DENO_2 } from "../internal/_is_deno_2.ts";

const moduleDir = path.dirname(path.fromFileUrl(import.meta.url));
const testdataDir = path.resolve(moduleDir, "testdata");
Expand Down Expand Up @@ -132,14 +131,7 @@ Deno.test({

// ensureFile fails because this test doesn't have write permissions,
// but don't swallow that error.
await assertRejects(
async () => await ensureFile(testFile),
IS_DENO_2
// TODO(iuioiua): Just use `Deno.errors.NotCapable` once Deno 2 is released.
// deno-lint-ignore no-explicit-any
? (Deno as any).errors.NotCapable
: Deno.errors.PermissionDenied,
);
await assertRejects(() => ensureFile(testFile), Deno.errors.NotCapable);
},
});

Expand All @@ -152,14 +144,7 @@ Deno.test({

// ensureFileSync fails because this test doesn't have write permissions,
// but don't swallow that error.
assertThrows(
() => ensureFileSync(testFile),
IS_DENO_2
// TODO(iuioiua): Just use `Deno.errors.NotCapable` once Deno 2 is released.
// deno-lint-ignore no-explicit-any
? (Deno as any).errors.NotCapable
: Deno.errors.PermissionDenied,
);
assertThrows(() => ensureFileSync(testFile), Deno.errors.NotCapable);
},
});

Expand Down
21 changes: 4 additions & 17 deletions fs/ensure_symlink_test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ import {
} from "@std/assert";
import * as path from "@std/path";
import { ensureSymlink, ensureSymlinkSync } from "./ensure_symlink.ts";
import { IS_DENO_2 } from "../internal/_is_deno_2.ts";

const moduleDir = path.dirname(path.fromFileUrl(import.meta.url));
const testdataDir = path.resolve(moduleDir, "testdata");
Expand Down Expand Up @@ -354,14 +353,8 @@ Deno.test(
const linkFile = path.join(testdataDir, "link.ts");

await assertRejects(
async () => {
await ensureSymlink(testFile, linkFile);
},
IS_DENO_2
// TODO(iuioiua): Just use `Deno.errors.NotCapable` once Deno 2 is released.
// deno-lint-ignore no-explicit-any
? (Deno as any).errors.NotCapable
: Deno.errors.PermissionDenied,
() => ensureSymlink(testFile, linkFile),
Deno.errors.NotCapable,
);
},
);
Expand All @@ -374,14 +367,8 @@ Deno.test(
const linkFile = path.join(testdataDir, "link.ts");

assertThrows(
() => {
ensureSymlinkSync(testFile, linkFile);
},
IS_DENO_2
// TODO(iuioiua): Just use `Deno.errors.NotCapable` once Deno 2 is released.
// deno-lint-ignore no-explicit-any
? (Deno as any).errors.NotCapable
: Deno.errors.PermissionDenied,
() => ensureSymlinkSync(testFile, linkFile),
Deno.errors.NotCapable,
);
},
);
27 changes: 5 additions & 22 deletions fs/expand_glob_test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ import {
type ExpandGlobOptions,
expandGlobSync,
} from "./expand_glob.ts";
import { IS_DENO_2 } from "../internal/_is_deno_2.ts";

async function expandGlobArray(
globString: string,
Expand Down Expand Up @@ -114,28 +113,16 @@ Deno.test(
async function () {
{
await assertRejects(
async () => {
await expandGlobArray("*", EG_OPTIONS);
},
IS_DENO_2
// TODO(iuioiua): Just use `Deno.errors.NotCapable` once Deno 2 is released.
// deno-lint-ignore no-explicit-any
? (Deno as any).errors.NotCapable
: Deno.errors.PermissionDenied,
() => expandGlobArray("*", EG_OPTIONS),
Deno.errors.NotCapable,
"run again with the --allow-read flag",
);
}

{
assertThrows(
() => {
expandGlobSyncArray("*", EG_OPTIONS);
},
IS_DENO_2
// TODO(iuioiua): Just use `Deno.errors.NotCapable` once Deno 2 is released.
// deno-lint-ignore no-explicit-any
? (Deno as any).errors.NotCapable
: Deno.errors.PermissionDenied,
() => expandGlobSyncArray("*", EG_OPTIONS),
Deno.errors.NotCapable,
"run again with the --allow-read flag",
);
}
Expand Down Expand Up @@ -307,11 +294,7 @@ Deno.test(
assert(!success);
assertEquals(code, 1);
assertEquals(decoder.decode(stdout), "");
assertStringIncludes(
decoder.decode(stderr),
// TODO(iuioiua): Just use `Deno.errors.NotCapable` once Deno 2 is released.
IS_DENO_2 ? "NotCapable" : "PermissionDenied",
);
assertStringIncludes(decoder.decode(stderr), "NotCapable");
},
);

Expand Down
3 changes: 0 additions & 3 deletions internal/_is_deno_2.ts

This file was deleted.

Loading