Skip to content

Commit ad343ee

Browse files
chore: Integrate oxc and release configs (#87)
1 parent 0e94de6 commit ad343ee

11 files changed

Lines changed: 63 additions & 102 deletions

File tree

.editorconfig

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
# editorconfig.org
2+
root = true
3+
4+
[*.{js,cjs,mjs,jsx,ts,cts,mts,tsx,json,jsonc}]
5+
indent_style = space
6+
indent_size = 2
7+
end_of_line = lf
8+
charset = utf-8
9+
trim_trailing_whitespace = true
10+
insert_final_newline = true
11+
max_line_length = 120

.github/workflows/unit-test.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,6 @@ jobs:
3939
- run: npm run lint
4040
name: Run linter
4141
- run: npm run format:check
42-
name: Run Prettier check
42+
name: Run format check
4343
- run: npm run test
4444
name: Run unit tests

.releaserc

Lines changed: 0 additions & 37 deletions
This file was deleted.

eslint.config.mjs

Lines changed: 0 additions & 15 deletions
This file was deleted.

lib/asyncbox.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import {limitFunction} from 'p-limit';
2+
23
import type {
34
CancellablePromise,
45
LongSleepOptions,

oxfmt.config.mjs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
import appiumConfig, {defineConfig, ignorePatterns} from '@appium/oxc-config/oxfmt';
2+
3+
export default defineConfig({
4+
...appiumConfig,
5+
ignorePatterns: [...ignorePatterns],
6+
});

oxlint.config.mjs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
import appiumConfig, {defineConfig, ignorePatterns} from '@appium/oxc-config/oxlint';
2+
3+
export default defineConfig({
4+
extends: [appiumConfig],
5+
ignorePatterns: [...ignorePatterns],
6+
});

package.json

Lines changed: 30 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,32 @@
11
{
22
"name": "asyncbox",
3+
"version": "6.4.0",
34
"description": "A collection of small async/await utilities",
4-
"tags": [
5+
"keywords": [
6+
"async",
57
"async/await",
6-
"es7",
7-
"async"
8+
"es7"
89
],
9-
"version": "6.4.0",
10-
"author": "jlipps@gmail.com",
10+
"bugs": {
11+
"url": "https://github.com/appium/asyncbox/issues"
12+
},
1113
"license": "Apache-2.0",
14+
"author": "jlipps@gmail.com",
1215
"repository": {
1316
"type": "git",
1417
"url": "https://github.com/appium/asyncbox.git"
1518
},
16-
"bugs": {
17-
"url": "https://github.com/appium/asyncbox/issues"
18-
},
19-
"engines": {
20-
"node": "^20.19.0 || ^22.12.0 || >=24.0.0",
21-
"npm": ">=10"
19+
"bin": {},
20+
"directories": {
21+
"lib": "./lib"
2222
},
23+
"files": [
24+
"lib/**/*",
25+
"build/cjs/lib/**/*",
26+
"build/cjs/package.json",
27+
"build/esm/lib/**/*",
28+
"build/esm/package.json"
29+
],
2330
"type": "module",
2431
"main": "./build/cjs/lib/asyncbox.js",
2532
"module": "./build/esm/lib/asyncbox.js",
@@ -37,17 +44,6 @@
3744
},
3845
"./package.json": "./package.json"
3946
},
40-
"bin": {},
41-
"directories": {
42-
"lib": "./lib"
43-
},
44-
"files": [
45-
"lib/**/*",
46-
"build/cjs/lib/**/*",
47-
"build/cjs/package.json",
48-
"build/esm/lib/**/*",
49-
"build/esm/package.json"
50-
],
5147
"scripts": {
5248
"build": "tsc -b tsconfig.esm.json tsconfig.cjs.json",
5349
"postbuild": "node scripts/postbuild.mjs",
@@ -56,28 +52,23 @@
5652
"dev": "npm run build -- --watch",
5753
"prepare": "npm run rebuild",
5854
"test": "node --test --enable-source-maps --test-force-exit --test-timeout=60000 \"./build/esm/test/**/*.spec.js\" \"./test/*.spec.cjs\"",
59-
"lint": "eslint .",
60-
"format": "prettier -w ./lib ./test",
61-
"format:check": "prettier --check ./lib ./test",
55+
"lint": "oxlint -c oxlint.config.mjs .",
56+
"lint:fix": "oxlint -c oxlint.config.mjs --fix .",
57+
"format": "oxfmt -c oxfmt.config.mjs .",
58+
"format:check": "oxfmt -c oxfmt.config.mjs --check .",
6259
"watch": "npm run dev"
6360
},
64-
"prettier": {
65-
"bracketSpacing": false,
66-
"printWidth": 100,
67-
"singleQuote": true
68-
},
6961
"dependencies": {
7062
"p-limit": "^7.2.0"
7163
},
7264
"devDependencies": {
73-
"@appium/eslint-config-appium-ts": "^3.2.3",
74-
"@appium/tsconfig": "^1.0.0",
75-
"@semantic-release/changelog": "^6.0.1",
76-
"@semantic-release/git": "^10.0.1",
77-
"@types/node": "^26.1.0",
78-
"conventional-changelog-conventionalcommits": "^9.0.0",
79-
"prettier": "^3.0.0",
80-
"semantic-release": "^25.0.2",
81-
"typescript": "^6.0.3"
65+
"@appium/oxc-config": "^1.1.0",
66+
"@appium/semantic-release-config": "^1.1.0",
67+
"@appium/tsconfig": "^1.2.0",
68+
"@types/node": "^26.1.0"
69+
},
70+
"engines": {
71+
"node": "^20.19.0 || ^22.12.0 || >=24.0.0",
72+
"npm": ">=10"
8273
}
8374
}

release.config.mjs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
import releaseConfig from '@appium/semantic-release-config';
2+
3+
export default releaseConfig();

test/asyncbox.spec.ts

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
import assert from 'node:assert/strict';
2+
import {it, describe, beforeEach} from 'node:test';
3+
14
import {
25
sleep,
36
longSleep,
@@ -11,8 +14,6 @@ import {
1114
PromiseCancellationError,
1215
type SleepOptions,
1316
} from '../lib/asyncbox.js';
14-
import {it, describe, beforeEach} from 'node:test';
15-
import assert from 'node:assert/strict';
1617

1718
describe('sleep', function () {
1819
it('should work like setTimeout', async function () {
@@ -93,10 +94,7 @@ describe('sleep', function () {
9394
assert.throws(() => sleep([] as unknown as number), /finite number or an object with ms/);
9495
});
9596
it('should throw TypeError when object has invalid ms', function () {
96-
assert.throws(
97-
() => sleep({} as unknown as SleepOptions),
98-
/options\.ms must be a finite number/,
99-
);
97+
assert.throws(() => sleep({} as unknown as SleepOptions), /options\.ms must be a finite number/);
10098
assert.throws(() => sleep({ms: Number.NaN}), /options\.ms must be a finite number/);
10199
});
102100
it('should accept a null-prototype object with ms', async function () {

0 commit comments

Comments
 (0)