Skip to content

Commit b055abd

Browse files
author
Simon Renoult
committed
refactor: add 'node:' prefix to imports
1 parent cb96150 commit b055abd

16 files changed

+71
-61
lines changed

.eslintrc.js

Lines changed: 0 additions & 20 deletions
This file was deleted.

.eslintrc.json

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
{
2+
"root": true,
3+
"parser": "@typescript-eslint/parser",
4+
"plugins": ["@typescript-eslint", "prettier"],
5+
"extends": [
6+
"prettier",
7+
"eslint:recommended",
8+
"plugin:@typescript-eslint/eslint-recommended",
9+
"plugin:@typescript-eslint/recommended"
10+
],
11+
"rules": {
12+
"prettier/prettier": "error",
13+
"no-console": "off",
14+
"@typescript-eslint/no-use-before-define": "off",
15+
"@typescript-eslint/no-explicit-any": "off",
16+
"sort-imports": [
17+
"error",
18+
{ "ignoreCase": true, "allowSeparatedGroups": true }
19+
]
20+
}
21+
}

src/io/cli.ts

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,13 @@
1-
import { URL } from "url";
1+
import { execSync } from "node:child_process";
2+
import { lstatSync } from "node:fs";
3+
import { sep } from "node:path";
4+
import { tmpdir } from "node:os";
5+
import { URL } from "node:url";
6+
7+
import { Command, program } from "commander";
28

39
import { buildDebugger, getPackageJson } from "../utils";
410
import { ComplexityStrategy, Format, Options, Sort } from "../lib/types";
5-
import { lstatSync } from "fs";
6-
import { execSync } from "child_process";
7-
import { Command, program } from "commander";
8-
import { tmpdir } from "os";
9-
import { sep } from "path";
1011

1112
const internal = { debug: buildDebugger("cli") };
1213

src/io/index.ts

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
1+
import { execSync } from "node:child_process";
2+
import { existsSync } from "node:fs";
3+
14
import Cli from "./cli";
2-
import Output from "./output";
35
import { Options } from "../lib/types";
6+
import Output from "./output";
47
import Statistics from "../lib";
5-
import { execSync } from "child_process";
6-
import { existsSync } from "fs";
78

89
export default async function main(): Promise<void> {
910
const options = await Cli.parse();

src/io/output.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
import * as Table from "cli-table3";
22

3-
import Statistics from "../lib/statistics";
4-
import { Options } from "../lib/types";
53
import { buildDebugger, withDuration } from "../utils";
4+
import { Options } from "../lib/types";
5+
import Statistics from "../lib/statistics";
66

77
const internal = { debug: buildDebugger("output") };
88

src/lib/churn/churn.ts

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,11 @@
1-
import { execSync } from "child_process";
1+
import { execSync } from "node:child_process";
2+
import { existsSync } from "node:fs";
3+
import { resolve } from "node:path";
4+
25
import * as micromatch from "micromatch";
36

4-
import { Options, Path } from "../types";
57
import { buildDebugger, withDuration } from "../../utils";
6-
import { resolve } from "path";
7-
import { existsSync } from "fs";
8+
import { Options, Path } from "../types";
89

910
const internal = { debug: buildDebugger("churn") };
1011
const PER_LINE = "\n";

src/lib/complexity/cyclomatic.ts

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
1-
import { readFileSync } from "fs";
2-
import { transformSync } from "@babel/core";
3-
import { extname } from "path";
1+
import { extname } from "node:path";
2+
import { readFileSync } from "node:fs";
3+
44
import { buildDebugger, UnsupportedExtension } from "../../utils";
5+
import { transformSync } from "@babel/core";
56

67
// eslint-disable-next-line @typescript-eslint/no-var-requires
78
const escomplex = require("escomplex");

src/lib/complexity/halstead.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
import { readFileSync } from "fs";
2-
import { transformSync } from "@babel/core";
3-
import { extname } from "path";
41
import { buildDebugger, UnsupportedExtension } from "../../utils";
2+
import { extname } from "node:path";
3+
import { readFileSync } from "node:fs";
4+
import { transformSync } from "@babel/core";
55

66
// eslint-disable-next-line @typescript-eslint/no-var-requires
77
const escomplex = require("escomplex");

src/lib/complexity/index.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
1-
import { resolve } from "path";
1+
import { resolve } from "node:path";
22

3-
import { Options, Path } from "../types";
43
import { buildDebugger, UnsupportedExtension, withDuration } from "../../utils";
5-
import computeSloc from "./sloc";
4+
import { Options, Path } from "../types";
65
import { calculate as calculateCyclomatic } from "./cyclomatic";
76
import { calculate as calculateHalstead } from "./halstead";
7+
import computeSloc from "./sloc";
88

99
type ComplexityEntry = { path: Path; complexity: number };
1010
const internal = { debug: buildDebugger("complexity") };

src/lib/complexity/sloc.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import * as sloc from "node-sloc";
2-
import { createReadStream } from "fs";
2+
import { createReadStream } from "node:fs";
33

44
export default async function compute(absolutePath: string): Promise<number> {
55
// eslint-disable-next-line @typescript-eslint/ban-ts-comment

0 commit comments

Comments
 (0)