Skip to content

Commit

Permalink
Merge c5dd47e into 11aae6c
Browse files Browse the repository at this point in the history
  • Loading branch information
ext committed Mar 1, 2022
2 parents 11aae6c + c5dd47e commit 6141eec
Show file tree
Hide file tree
Showing 3 changed files with 52 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/blacklist/index.ts
Expand Up @@ -6,6 +6,7 @@ import jest from "./jest";
import node from "./node";
import prettier from "./prettier";
import typescript from "./typescript";
import windows from "./windows";
import { directory, extension, filename, rcfile } from "./helpers";

const blacklist: RegExp[] = [
Expand Down Expand Up @@ -121,6 +122,7 @@ const blacklist: RegExp[] = [
...node,
...prettier,
...typescript,
...windows,
];

export default blacklist;
37 changes: 37 additions & 0 deletions src/blacklist/windows.spec.ts
@@ -0,0 +1,37 @@
import { isBlacklisted } from "../blacklist";

it("should disallow CON", () => {
expect.assertions(2);
expect(isBlacklisted("CON")).toBeTruthy();
expect(isBlacklisted("foo/CON")).toBeTruthy();
});

it("should disallow PRN", () => {
expect.assertions(2);
expect(isBlacklisted("PRN")).toBeTruthy();
expect(isBlacklisted("foo/PRN")).toBeTruthy();
});

it("should disallow AUX", () => {
expect.assertions(2);
expect(isBlacklisted("AUX")).toBeTruthy();
expect(isBlacklisted("foo/AUX")).toBeTruthy();
});

it("should disallow NUL", () => {
expect.assertions(2);
expect(isBlacklisted("NUL")).toBeTruthy();
expect(isBlacklisted("foo/NUL")).toBeTruthy();
});

it("should disallow COM", () => {
expect.assertions(2);
expect(isBlacklisted("COM1")).toBeTruthy();
expect(isBlacklisted("foo/COM9")).toBeTruthy();
});

it("should disallow LPT", () => {
expect.assertions(2);
expect(isBlacklisted("LPT1")).toBeTruthy();
expect(isBlacklisted("foo/LPT9")).toBeTruthy();
});
13 changes: 13 additions & 0 deletions src/blacklist/windows.ts
@@ -0,0 +1,13 @@
import { filename } from "./helpers";

/* reserved filenames on windows */
const regexp: RegExp[] = [
filename("CON"),
filename("PRN"),
filename("AUX"),
filename("NUL"),
/(^|\/)COM\d/,
/(^|\/)LPT\d/,
];

export default regexp;

0 comments on commit 6141eec

Please sign in to comment.