Skip to content

Commit 1362624

Browse files
committed
Modern syntax to import built-in node modules
1 parent 318c972 commit 1362624

9 files changed

Lines changed: 12 additions & 11 deletions

File tree

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -203,7 +203,7 @@ type ValidatorResults = {
203203

204204
### 4. Mocha example
205205
```javascript
206-
import assert from 'assert';
206+
import assert from 'node:assert';
207207
import { w3cHtmlValidator } from 'w3c-html-validator';
208208

209209
describe('Home page', () => {

package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@
7878
"mocha": "~11.7",
7979
"rimraf": "~6.1",
8080
"run-scripts-util": "~1.3",
81-
"typescript": "~5.9",
82-
"typescript-eslint": "~8.57"
81+
"typescript": "~6.0",
82+
"typescript-eslint": "~8.58"
8383
}
8484
}

spec/cli.spec.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
// Imports
55
import { assertDeepStrictEqual } from 'assert-deep-strict-equal';
66
import { cliArgvUtil } from 'cli-argv-util';
7-
import fs from 'fs';
7+
import fs from 'node:fs';
88

99
// Setup
1010
const readTextFile = (filename) => fs.readFileSync(filename, 'utf-8').replace(/\r/g, '');

spec/errors.spec.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@
33

44
// Imports
55
import { assertDeepStrictEqual } from 'assert-deep-strict-equal';
6-
import assert from 'assert';
7-
import fs from 'fs';
6+
import assert from 'node:assert';
7+
import fs from 'node:fs';
88

99
// Setup
1010
import { w3cHtmlValidator } from '../dist/w3c-html-validator.js';

spec/package.spec.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33

44
// Imports
55
import { assertDeepStrictEqual } from 'assert-deep-strict-equal';
6-
import fs from 'fs';
6+
import fs from 'node:fs';
77

88
// Setup
99
import { w3cHtmlValidator } from '../dist/w3c-html-validator.js';

spec/reporter.spec.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@
33

44
// Imports
55
import { assertDeepStrictEqual } from 'assert-deep-strict-equal';
6-
import assert from 'assert';
7-
import fs from 'fs';
6+
import assert from 'node:assert';
7+
import fs from 'node:fs';
88

99
// Setup
1010
import { w3cHtmlValidator } from '../dist/w3c-html-validator.js';

spec/validator.spec.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33

44
// Imports
55
import { assertDeepStrictEqual } from 'assert-deep-strict-equal';
6-
import fs from 'fs';
6+
import fs from 'node:fs';
77

88
// Setup
99
import { w3cHtmlValidator } from '../dist/w3c-html-validator.js';

src/w3c-html-validator.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
import { cliArgvUtil } from 'cli-argv-util';
2222
import { globSync } from 'glob';
2323
import chalk, { ChalkInstance } from 'chalk';
24-
import fs from 'fs';
24+
import fs from 'node:fs';
2525
import log from 'fancy-log';
2626
import request from 'superagent';
2727
import slash from 'slash';

tsconfig.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
"target": "ES2022",
1111
"module": "nodenext",
1212
"moduleResolution": "nodenext",
13+
"types": ["node"],
1314
"exactOptionalPropertyTypes": true,
1415
"forceConsistentCasingInFileNames": true,
1516
"noFallthroughCasesInSwitch": true,

0 commit comments

Comments
 (0)