Skip to content

Latest commit

 

History

History
68 lines (47 loc) · 1.35 KB

File metadata and controls

68 lines (47 loc) · 1.35 KB

@putout/plugin-socket-io NPM version

The library for web and native user interfaces

(c) socket-io.dev

🐊Putout plugin helps to migrate to new version of socket.io. Not bundled.

Install

npm i putout @putout/plugin-socket-io-hooks -D

Add .putout.json with:

{
    "plugins": ["socket-io"]
}

Rules

Config

{
    "rules": {
        "socket-io/convert-io-listen-to-new-server": "on",
        "socket-io/declare": "on"
    }
}

declare

+import {Server} from 'socket.io';
new Server(server);

convert-io-listen-to-new-server

ESM has no listen exported, only Server. So it is better to change it to simplify migration. Check out in 🐊Putout Editor.

❌ Example of incorrect code

io.listen(server);

✅ Example of correct code

new Server(server);

License

MIT