Skip to content

Commit

Permalink
December maintenance (#1015)
Browse files Browse the repository at this point in the history
  • Loading branch information
sonnyp authored Dec 12, 2024
1 parent 6e1b272 commit ee848db
Show file tree
Hide file tree
Showing 66 changed files with 8,271 additions and 29,164 deletions.
6 changes: 0 additions & 6 deletions .eslintignore

This file was deleted.

73 changes: 0 additions & 73 deletions .eslintrc.js

This file was deleted.

18 changes: 6 additions & 12 deletions .github/workflows/CI.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,21 +11,15 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [14.x, 16.x, 18.x]
node-version: [14.x, 16.x, 18.x, 20.x, 22.x]
steps:
- uses: actions/checkout@v2

- uses: actions/cache@v2
with:
path: ~/.npm
key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }}
restore-keys: |
${{ runner.os }}-node-
- uses: actions/checkout@v4

- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v1
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}
node-version: ${{ matrix.node }}
cache: "npm"

- name: Install prosody
run: |
Expand All @@ -35,7 +29,7 @@ jobs:
sudo apt-get -y install prosody lua-bitop lua-sec
sudo service prosody stop
- run: npm install -g npm
# - run: npm install -g npm
- run: make
- run: make ci

Expand Down
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ server/prosody.pid
!.gitkeep
!.editorconfig
!.gitignore
!.travis.yml

npm-debug.log
lerna-debug.log
Expand Down
3 changes: 0 additions & 3 deletions .husky/pre-commit
Original file line number Diff line number Diff line change
@@ -1,4 +1 @@
#!/bin/sh
. "$(dirname "$0")/_/husky.sh"

npx lint-staged
3 changes: 0 additions & 3 deletions .husky/pre-push
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
#!/bin/sh
. "$(dirname "$0")/_/husky.sh"

BRANCH="$(git rev-parse --abbrev-ref HEAD)"

if [[ "$BRANCH" == "main" ]]; then
Expand Down
2 changes: 2 additions & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,5 @@ node_modules/
**/dist/*.js
bundle.js
server/prosody-modules/

/.nx/workspace-data
5 changes: 1 addition & 4 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
setup:
node packages/xmpp.js/script.js
npm install
./node_modules/.bin/lerna bootstrap
cd packages/xmpp.js/ && npm run prepublish
node bundle.js

Expand All @@ -13,21 +12,19 @@ lint:
test:
cd packages/xmpp.js/ && npm run prepublish
npm install
./node_modules/.bin/lerna bootstrap
node bundle.js
./node_modules/.bin/ava
make lint
make bundlesize

ci:
npm install
./node_modules/.bin/lerna bootstrap
./node_modules/.bin/ava
make lint
make restart
./node_modules/.bin/lerna run prepublish
node bundle.js
./node_modules/.bin/ava --tap --config e2e.config.js
./node_modules/.bin/ava --config e2e.config.js
make bundlesize

clean:
Expand Down
97 changes: 97 additions & 0 deletions eslint.config.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,97 @@
import js from "@eslint/js";
import eslintConfigPrettier from "eslint-config-prettier";
import globals from "globals";
import eslintPluginUnicorn from "eslint-plugin-unicorn";
import eslintNodePlugin from "eslint-plugin-n";
import pluginPromise from "eslint-plugin-promise";

export default [
{
ignores: [
"**/dist/*.js",
"bundle.js",
"packages/xmpp.js/index.js",
"ava.config.js",
"e2e.config.js",
"eslint.config.mjs",
],
},
js.configs.recommended,
eslintPluginUnicorn.configs["flat/recommended"],
eslintNodePlugin.configs["flat/recommended-script"],
pluginPromise.configs["flat/recommended"],
eslintConfigPrettier,
{
languageOptions: {
globals: {
...globals.builtin,
...globals["shared-node-browser"],
},
parserOptions: {
ecmaFeatures: {
jsx: true,
},
},
sourceType: "script",
},

rules: {
strict: ["error", "global"],
"no-empty": ["error", { allowEmptyCatch: true }],
// "no-multi-assign": 0,
"func-names": ["error", "as-needed"],
"operator-linebreak": [
"error",
"after",
{ overrides: { "?": "before", ":": "before" } },
],
"capitalized-comments": 0,
"prefer-rest-params": ["error"],
"prefer-spread": ["error"],
"prefer-destructuring": [
"error",
{
array: false,
object: true,
},
],
"prefer-arrow-callback": ["error", { allowNamedFunctions: true }],
"no-redeclare": ["error", { builtinGlobals: false }],

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

// 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

// unicorn
// https://github.com/sindresorhus/eslint-plugin-unicorn
"unicorn/filename-case": 0,
"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,
},
},
{
files: ["server/ctl.js"],
rules: {
"n/no-unsupported-features/es-syntax": "off",
"n/no-unsupported-features/es-syntax": "off",
},
},
];
6 changes: 3 additions & 3 deletions lerna.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
{
"version": "0.13.1",
"useWorkspaces": true,
"version": "0.13.2",
"packages": ["packages/*"],
"command": {
"publish": {
Expand All @@ -15,5 +14,6 @@
"*.test.js"
]
}
}
},
"$schema": "node_modules/lerna/schemas/lerna-schema.json"
}
Loading

0 comments on commit ee848db

Please sign in to comment.