Skip to content

Commit

Permalink
refactor: use node: specifier imports and full relative path imports (
Browse files Browse the repository at this point in the history
#490)

* refactor: replace NodeJS internal module imports with `node:` specifier imports

* refactor: use full relative paths

* chore: update jest config
  • Loading branch information
wolfy1339 authored Dec 5, 2023
1 parent 549b71b commit 2eaf846
Show file tree
Hide file tree
Showing 7 changed files with 13 additions and 9 deletions.
3 changes: 3 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,9 @@
"functions": 100,
"lines": 100
}
},
"moduleNameMapper": {
"^(.+)\\.jsx?$": "$1"
}
},
"release": {
Expand Down
4 changes: 2 additions & 2 deletions src/index.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import { Octokit } from "@octokit/core";
import type { RequestError } from "@octokit/request-error";

import { errorRequest } from "./error-request";
import { wrapRequest } from "./wrap-request";
import { errorRequest } from "./error-request.js";
import { wrapRequest } from "./wrap-request.js";

export const VERSION = "0.0.0-development";

Expand Down
2 changes: 1 addition & 1 deletion src/wrap-request.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// @ts-nocheck
import Bottleneck from "bottleneck/light";
import { RequestError } from "@octokit/request-error";
import { errorRequest } from "./error-request";
import { errorRequest } from "./error-request.js";

export async function wrapRequest(state, octokit, request, options) {
const limiter = new Bottleneck();
Expand Down
2 changes: 1 addition & 1 deletion test/octokit.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { Octokit } from "@octokit/core";
import { RequestError } from "@octokit/request-error";
import { retry } from "../src";
import { retry } from "../src/index.ts";

function testPlugin(octokit: Octokit) {
const t0 = Date.now();
Expand Down
6 changes: 3 additions & 3 deletions test/retry.test.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { TestOctokit } from "./octokit";
import { errorRequest } from "../src/error-request";
import { TestOctokit } from "./octokit.ts";
import { errorRequest } from "../src/error-request.ts";
import { RequestError } from "@octokit/request-error";
import { RequestMethod } from "@octokit/types";
import type { RequestMethod } from "@octokit/types";

describe("Automatic Retries", function () {
it("Should be possible to disable the plugin", async function () {
Expand Down
2 changes: 1 addition & 1 deletion test/smoke.test.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { retry } from "../src";
import { retry } from "../src/index.ts";

describe("Smoke test", () => {
it("is a function", () => {
Expand Down
3 changes: 2 additions & 1 deletion test/tsconfig.test.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@
"compilerOptions": {
"emitDeclarationOnly": false,
"noEmit": true,
"verbatimModuleSyntax": false
"verbatimModuleSyntax": false,
"allowImportingTsExtensions": true
},
"include": ["src/**/*"]
}

0 comments on commit 2eaf846

Please sign in to comment.