[iobroker-bot] Add node: prefix to Node.js built-in module requires and imports#501
Open
ioBroker-Bot wants to merge 1 commit intorg-engineering:masterfrom
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
German description can be found below
Deutsche Beschreibung weiter unten
General information
This PR has been created by iobroker-bot. Please review the changes carefully and merge the PR if the review is ok.
Feel free to contact me (@ioBroker-Bot) if you have any questions or feel that a PR is faulty. Please open an issue at repository https://github.com/ioBroker/ioBroker.repochecker to report a faulty PR.
And THANKS A LOT for maintaining this adapter from me and all users.
Let's work together for the best user experience.
your
ioBroker Check and Service Bot
@mcm1957 for evidence
Changes provided by this PR
This PR fixes the suggestion [S5043] Node.js built-in modules should be required/imported using the node: prefix reported by the ioBroker repository checker.
Background
Starting with Node.js 14.18.0 / 16.0.0, built-in modules can be imported using the
node:URL scheme (e.g.,require('node:fs')instead ofrequire('fs')). This is now the recommended way to reference built-in modules because:Changes
This PR updates all
require()calls,import ... fromstatements, and dynamicimport()calls in the adapter source files to use thenode:prefix for Node.js built-in modules.For example:
require('fs')→require('node:fs')require('path')→require('node:path')import fs from 'fs'→import fs from 'node:fs'import { readFile } from 'fs'→import { readFile } from 'node:fs'The following directories and files are excluded from the scan:
admin,build,doc,src-admin,src-widgets,admin-src,test,node_modules,.git,.vscode,.dev-servertasks.js,Gruntfile.js,gulpfile.jsDeutsche Beschreibung
Allgemeine Informationen
Dieser PR wurde von iobroker-bot erstellt. Bitte die Änderungen sorgfältig prüfen und den PR bei erfolgreicher Prüfung mergen.
Bei Fragen oder falls ein PR fehlerhaft erscheint, bitte mich (@ioBroker-Bot) kontaktieren. Bitte ein Issue im Repository https://github.com/ioBroker/ioBroker.repochecker öffnen, um einen fehlerhaften PR zu melden.
Und VIELEN DANK für die Pflege dieses Adapters von mir und allen Nutzern.
Gemeinsam für die beste Benutzererfahrung arbeiten.
Euer
ioBroker Check and Service Bot
@mcm1957 zur Kenntnisnahme
Durch diesen PR bereitgestellte Änderungen
Dieser PR behebt die Anregung [S5043] Node.js-interne Module sollten mit dem node: Präfix eingebunden werden, die vom ioBroker Repository Checker gemeldet wurde.
Hintergrund
Seit Node.js 14.18.0 / 16.0.0 können integrierte Module mit dem
node:URL-Schema importiert werden (z.B.require('node:fs')stattrequire('fs')). Dies ist nun die empfohlene Methode zur Referenzierung eingebauter Module, weil:Änderungen
Dieser PR aktualisiert alle
require()-Aufrufe,import ... from-Anweisungen und dynamischeimport()-Aufrufe in den Adapter-Quelldateien, um dasnode:-Präfix für Node.js-interne Module zu verwenden.Zum Beispiel:
require('fs')→require('node:fs')require('path')→require('node:path')import fs from 'fs'→import fs from 'node:fs'import { readFile } from 'fs'→import { readFile } from 'node:fs'Folgende Verzeichnisse und Dateien sind vom Scan ausgeschlossen:
admin,build,doc,src-admin,src-widgets,admin-src,test,node_modules,.git,.vscode,.dev-servertasks.js,Gruntfile.js,gulpfile.jsTemplate: S5043-useNodePrefix