Skip to content

Commit

Permalink
Drop IE support for the bundled script (#1028)
Browse files Browse the repository at this point in the history
  • Loading branch information
sonnyp authored Dec 21, 2024
1 parent db2490e commit 6dfd32e
Show file tree
Hide file tree
Showing 14 changed files with 29 additions and 72 deletions.
18 changes: 2 additions & 16 deletions babel.config.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -26,21 +26,7 @@ module.exports = function config(api) {
}

return {
presets: [
[
"@babel/preset-env",
{
targets: {
ie: "10",
},
loose: true,
},
],
],
plugins: [
"@babel/plugin-transform-runtime",
"babel-plugin-transform-async-to-promises",
"@babel/plugin-proposal-object-rest-spread",
],
presets: [["@babel/preset-env"]],
plugins: ["@babel/plugin-transform-runtime"],
};
};
31 changes: 14 additions & 17 deletions eslint.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,16 +33,17 @@ export default [
rules: {
strict: ["error", "global"],
"no-empty": ["error", { allowEmptyCatch: true }],
// "no-multi-assign": 0,
// "no-multi-assign": "off",
"func-names": ["error", "as-needed"],
"operator-linebreak": [
"error",
"after",
{ overrides: { "?": "before", ":": "before" } },
],
"capitalized-comments": 0,
"capitalized-comments": "off",
"prefer-rest-params": ["error"],
"prefer-spread": ["error"],
"prefer-object-spread": ["error"],
"prefer-destructuring": [
"error",
{
Expand All @@ -55,30 +56,26 @@ export default [

// node
// https://github.com/eslint-community/eslint-plugin-n/
"n/no-unpublished-require": 0, // doesn't play nice with monorepo
"n/no-unpublished-require": "off", // doesn't play nice with monorepo
"n/no-extraneous-require": ["error", { allowModules: ["@xmpp/test"] }],
"n/no-extraneous-import": ["error", { allowModules: ["@xmpp/test"] }],
"n/hashbang": "off",

// promise
// https://github.com/xjamundx/eslint-plugin-promise
// promise/prefer-await-to-then: [error]
// promise/prefer-await-to-callbacks: [error]
// unicorn https://github.com/sindresorhus/eslint-plugin-unicorn
"promise/prefer-await-to-then": "off",
"promise/prefer-await-to-callbacks": "off",

// unicorn
// https://github.com/sindresorhus/eslint-plugin-unicorn
"unicorn/filename-case": 0,
"unicorn/filename-case": "off",
"unicorn/catch-error-name": ["error", { name: "err" }],
"unicorn/prevent-abbreviations": 0,
"unicorn/prefer-number-properties": 0,
"unicorn/no-useless-undefined": 0,
"unicorn/no-null": 0,
"unicorn/prefer-module": 0,
"unicorn/numeric-separators-style": 0, // Requires Node.js 12.8
"unicorn/prefer-event-target": 0,
"unicorn/prefer-top-level-await": 0,
"unicorn/prefer-node-protocol": 0,
"unicorn/prevent-abbreviations": "off",
"unicorn/no-useless-undefined": "off",
"unicorn/no-null": "off",
"unicorn/prefer-event-target": "off",
// "unicorn/prefer-top-level-await": "off",
"unicorn/prefer-node-protocol": "off",
"unicorn/prefer-export-from": "off",
},
},
Expand Down Expand Up @@ -107,7 +104,7 @@ export default [
// {
// alwaysAwait: true,
// // For jest-extended expect().pass
// minArgs: 0,
// minArgs: "off",
// },
// ],
"promise/no-callback-in-promise": "off",
Expand Down
25 changes: 0 additions & 25 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 3 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,13 @@
"type": "module",
"devDependencies": {
"@babel/core": "^7.26.0",
"@babel/plugin-proposal-object-rest-spread": "^7.16.5",
"@babel/plugin-transform-modules-commonjs": "^7.26.3",
"@babel/plugin-transform-react-jsx": "^7.25.9",
"@babel/plugin-transform-runtime": "^7.25.9",
"@babel/preset-env": "^7.26.0",
"@babel/runtime": "^7.26.0",
"babel-jest": "^29.7.0",
"babel-plugin-jsx-pragmatic": "^1.0.2",
"babel-plugin-transform-async-to-promises": "^0.8.18",
"babelify": "^10.0.0",
"babylon": "^6.18.0",
"browser-pack-flat": "^3.5.0",
Expand Down Expand Up @@ -49,11 +47,12 @@
"bundlesize": [
{
"path": "./packages/client/dist/xmpp.min.js",
"maxSize": "17 KB"
"maxSize": "15 KB"
}
],
"lint-staged": {
"*.{js,cjs,mjs}": "eslint --cache --fix",
"*.{json,md,html,css,yaml,yml}": "prettier --write"
}
},
"browserslist": "defaults"
}
2 changes: 1 addition & 1 deletion packages/client/example.js
Original file line number Diff line number Diff line change
Expand Up @@ -47,4 +47,4 @@ xmpp.on("online", async (address) => {
await xmpp.send(message);
});

xmpp.start().catch(console.error);
await xmpp.start();
2 changes: 1 addition & 1 deletion packages/component/example.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,4 +36,4 @@ xmpp.on("online", async (address) => {
await xmpp.send(message);
});

xmpp.start().catch(console.error);
await xmpp.start();
2 changes: 1 addition & 1 deletion packages/id/test.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ test("returns a non empty string", () => {

test("duplicates", () => {
const id = xid();
for (let i = 0; i < 10000; i++) {
for (let i = 0; i < 10_000; i++) {
expect(id).not.toBe(xid());
}
});
2 changes: 1 addition & 1 deletion packages/jid/lib/JID.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ class JID {

[Symbol.toPrimitive](hint) {
if (hint === "number") {
return NaN;
return Number.NaN;
}

return this.toString();
Expand Down
3 changes: 1 addition & 2 deletions packages/jid/test/toPrimitive.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,5 @@ test("cocerce to string", () => {

test("cocerce to NaN", () => {
const addr = new JID("foo", "bar");
expect(isNaN(+addr)).toBe(true);
expect(isNaN(addr + 4)).toBe(true);
expect(Number.isNaN(+addr)).toBe(true);
});
3 changes: 2 additions & 1 deletion packages/resolve/example.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { resolve } from "@xmpp/resolve";

resolve("jabberfr.org").then(console.log).catch(console.error);
const result = await resolve("jabberfr.org");
console.log(result);
2 changes: 1 addition & 1 deletion packages/tls/lib/Connection.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { parseURI } from "@xmpp/connection/lib/util";
import { parseURI } from "@xmpp/connection/lib/util.js";
import ConnectionTCP from "@xmpp/connection-tcp";
import Socket from "./Socket.js";

Expand Down
1 change: 0 additions & 1 deletion packages/xml/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,6 @@ The `attrs` property is an object that holds xml attributes of the element.

```js
message.attrs.type = "chat";
Object.assign(message.attrs, { type: "chat" });
```

### text
Expand Down
1 change: 1 addition & 0 deletions packages/xmpp.js/test.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
/* eslint-disable unicorn/prefer-module */
import fs from "fs";
import path from "path";

Expand Down
2 changes: 1 addition & 1 deletion server/ctl.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ const commands = {
};

if (commands[method]) {
commands[method]().catch(console.error);
await commands[method]();
} else {
console.error("Valid commands are start/stop/restart/status.");
}

0 comments on commit 6dfd32e

Please sign in to comment.