Conversation
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
There was a problem hiding this comment.
Pull Request Overview
This pull request converts the sockjs-client library from CommonJS to ES modules, upgrading it to use modern JavaScript syntax and ES module imports/exports. The changes involve updating all files to use ES6 class syntax, arrow functions, and ES modules while also implementing linting improvements.
- Conversion from CommonJS (
require/module.exports) to ES modules (import/export) - Migration from function constructors to ES6 classes with static properties
- Modernization of JavaScript syntax including arrow functions and destructuring
Reviewed Changes
Copilot reviewed 60 out of 61 changed files in this pull request and generated 7 comments.
| File | Description |
|---|---|
| package.json | Updates module type, dependencies, Node version requirements, and adds xo linting configuration |
| lib/ files | Comprehensive conversion to ES modules with modern class syntax throughout all source files |
| .eslintrc/.eslintignore | Removes old ESLint configuration files in favor of xo linting |
| let source; | ||
| let prop; | ||
| for (source in args) { | ||
| if (Object.prototype.hasOwnProperty.call(args, source)) { | ||
| for (prop in source) { | ||
| if (Object.prototype.hasOwnProperty.call(source, prop)) { | ||
| obj[prop] = source[prop]; | ||
| object[prop] = source[prop]; | ||
| } |
There was a problem hiding this comment.
The for...in loop is iterating over array indices rather than array elements. This should be for (const source of args) to iterate over the actual source objects.
| import {attachEvent, detachEvent} from '../utils/event.js'; | ||
| import {createIframe, iframeEnabled} from '../utils/iframe.js'; | ||
| import {getOrigin, addPath, isOriginEqual} from '../utils/url.js'; | ||
| import {version} from '../package.json'; |
There was a problem hiding this comment.
Importing from package.json may not work in all ES module environments. Consider creating a separate version.js file or using a different approach to access the version.
| debug = require('debug')('sockjs-client:main'); | ||
| } | ||
| import {URL} from 'url-parse'; | ||
| import {version} from '../package.json'; |
There was a problem hiding this comment.
Importing from package.json may not work in all ES module environments. Consider creating a separate version.js file or using a different approach to access the version.
| import {version} from '../package.json'; | |
| import {version} from './version.js'; |
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
No description provided.