diff --git a/eslint.config.js b/eslint.config.js index c3f4e97..e6b0119 100644 --- a/eslint.config.js +++ b/eslint.config.js @@ -2,11 +2,13 @@ import js from '@eslint/js'; import globals from 'globals'; import { defineConfig } from 'eslint/config'; import stylistic from '@stylistic/eslint-plugin'; +import importPlugin from 'eslint-plugin-import'; export default defineConfig([ { files: ['**/*.{js,mjs,cjs}'], plugins: { + import: importPlugin, js, '@stylistic': stylistic }, @@ -17,6 +19,9 @@ export default defineConfig([ ...globals.node, ...globals.mocha } + }, + rules: { + 'import/enforce-node-protocol-usage': ['error', 'always'] } } ]); diff --git a/lib/poparser.js b/lib/poparser.js index f66ffec..8a37277 100644 --- a/lib/poparser.js +++ b/lib/poparser.js @@ -1,7 +1,7 @@ import encoding from 'encoding'; import { formatCharset, parseNPluralFromHeadersSafely, parseHeader } from './shared.js'; import { Transform } from 'node:stream'; -import util from 'util'; +import util from 'node:util'; /** * Parses a PO object into translation table diff --git a/package.json b/package.json index ad3811e..5f31a79 100644 --- a/package.json +++ b/package.json @@ -34,6 +34,7 @@ "@eslint/js": "^9.39.2", "@stylistic/eslint-plugin": "^5.6.1", "eslint": "^9.39.2", + "eslint-plugin-import": "^2.32.0", "globals": "^16.5.0" }, "keywords": [ diff --git a/test/mo-compiler-test.js b/test/mo-compiler-test.js index 936adb8..773cc68 100644 --- a/test/mo-compiler-test.js +++ b/test/mo-compiler-test.js @@ -1,10 +1,10 @@ import { describe, it } from 'node:test'; import assert from 'node:assert'; -import { promisify } from 'util'; -import path from 'path'; +import { promisify } from 'node:util'; +import path from 'node:path'; import { mo } from '../index.js'; -import { readFile as fsReadFile } from 'fs'; -import { fileURLToPath } from 'url'; +import { readFile as fsReadFile } from 'node:fs'; +import { fileURLToPath } from 'node:url'; const __filename = fileURLToPath(import.meta.url); const __dirname = path.dirname(__filename); diff --git a/test/mo-parser-test.js b/test/mo-parser-test.js index 46429fd..c0bc9fe 100644 --- a/test/mo-parser-test.js +++ b/test/mo-parser-test.js @@ -1,10 +1,10 @@ import { describe, it } from 'node:test'; import assert from 'node:assert'; -import { promisify } from 'util'; -import path from 'path'; +import { promisify } from 'node:util'; +import path from 'node:path'; import { mo } from '../index.js'; -import { readFile as fsReadFile } from 'fs'; -import { fileURLToPath } from 'url'; +import { readFile as fsReadFile } from 'node:fs'; +import { fileURLToPath } from 'node:url'; const __filename = fileURLToPath(import.meta.url); const __dirname = path.dirname(__filename); diff --git a/test/po-compiler-test.js b/test/po-compiler-test.js index 772112a..078206d 100644 --- a/test/po-compiler-test.js +++ b/test/po-compiler-test.js @@ -1,11 +1,11 @@ -import { EOL } from 'os'; -import { promisify } from 'util'; -import path from 'path'; -import { readFile as fsReadFile } from 'fs'; +import { EOL } from 'node:os'; +import { promisify } from 'node:util'; +import path from 'node:path'; +import { readFile as fsReadFile } from 'node:fs'; import { describe, it } from 'node:test'; import assert from 'node:assert'; import { po } from '../index.js'; -import { fileURLToPath } from 'url'; +import { fileURLToPath } from 'node:url'; const __filename = fileURLToPath(import.meta.url); const __dirname = path.dirname(__filename); diff --git a/test/po-obsolete-test.js b/test/po-obsolete-test.js index aa09bea..0a438fd 100644 --- a/test/po-obsolete-test.js +++ b/test/po-obsolete-test.js @@ -1,11 +1,11 @@ -import { EOL } from 'os'; +import { EOL } from 'node:os'; import { describe, it } from 'node:test'; import assert from 'node:assert'; -import { promisify } from 'util'; -import path from 'path'; -import fs from 'fs'; +import { promisify } from 'node:util'; +import path from 'node:path'; +import fs from 'node:fs'; import * as gettextParser from '../index.js'; -import { fileURLToPath } from 'url'; +import { fileURLToPath } from 'node:url'; const __filename = fileURLToPath(import.meta.url); const __dirname = path.dirname(__filename); diff --git a/test/po-parser-test.js b/test/po-parser-test.js index 2481058..8184cc8 100644 --- a/test/po-parser-test.js +++ b/test/po-parser-test.js @@ -1,10 +1,10 @@ import { describe, it } from 'node:test'; import assert from 'node:assert'; -import { promisify } from 'util'; -import path from 'path'; -import fs from 'fs'; +import { promisify } from 'node:util'; +import path from 'node:path'; +import fs from 'node:fs'; import * as gettextParser from '../index.js'; -import { fileURLToPath } from 'url'; +import { fileURLToPath } from 'node:url'; const __filename = fileURLToPath(import.meta.url); const __dirname = path.dirname(__filename); diff --git a/test/shared.js b/test/shared.js index 6459f7b..11d30cd 100644 --- a/test/shared.js +++ b/test/shared.js @@ -2,11 +2,11 @@ import { describe, it } from 'node:test'; import assert from 'node:assert'; -import { promisify } from 'util'; -import path from 'path'; +import { promisify } from 'node:util'; +import path from 'node:path'; import { formatCharset, parseHeader, generateHeader, foldLine, parseNPluralFromHeadersSafely } from '../lib/shared.js'; -import { readFile as fsReadFile } from 'fs'; -import { fileURLToPath } from 'url'; +import { readFile as fsReadFile } from 'node:fs'; +import { fileURLToPath } from 'node:url'; const __filename = fileURLToPath(import.meta.url); const __dirname = path.dirname(__filename);