diff --git a/.editorconfig b/.editorconfig new file mode 100644 index 0000000..b0985da --- /dev/null +++ b/.editorconfig @@ -0,0 +1,11 @@ +# editorconfig.org +root = true + +[*.{js,cjs,mjs,jsx,ts,cts,mts,tsx,json,jsonc}] +indent_style = space +indent_size = 2 +end_of_line = lf +charset = utf-8 +trim_trailing_whitespace = true +insert_final_newline = true +max_line_length = 120 diff --git a/.github/workflows/unit-test.yml b/.github/workflows/unit-test.yml index 4dcf981..15c7916 100644 --- a/.github/workflows/unit-test.yml +++ b/.github/workflows/unit-test.yml @@ -39,6 +39,6 @@ jobs: - run: npm run lint name: Run linter - run: npm run format:check - name: Run Prettier check + name: Run format check - run: npm run test name: Run unit tests diff --git a/.releaserc b/.releaserc deleted file mode 100644 index 93cf006..0000000 --- a/.releaserc +++ /dev/null @@ -1,37 +0,0 @@ -{ - "plugins": [ - ["@semantic-release/commit-analyzer", { - "preset": "angular", - "releaseRules": [ - {"type": "chore", "release": "patch"} - ] - }], - ["@semantic-release/release-notes-generator", { - "preset": "conventionalcommits", - "presetConfig": { - "types": [ - {"type": "feat", "section": "Features"}, - {"type": "fix", "section": "Bug Fixes"}, - {"type": "perf", "section": "Performance Improvements"}, - {"type": "revert", "section": "Reverts"}, - {"type": "chore", "section": "Miscellaneous Chores"}, - {"type": "refactor", "section": "Code Refactoring"}, - {"type": "docs", "section": "Documentation", "hidden": true}, - {"type": "style", "section": "Styles", "hidden": true}, - {"type": "test", "section": "Tests", "hidden": true}, - {"type": "build", "section": "Build System", "hidden": true}, - {"type": "ci", "section": "Continuous Integration", "hidden": true} - ] - } - }], - ["@semantic-release/changelog", { - "changelogFile": "CHANGELOG.md" - }], - "@semantic-release/npm", - ["@semantic-release/git", { - "assets": ["docs", "package.json", "CHANGELOG.md"], - "message": "chore(release): ${nextRelease.version} [skip ci]\n\n${nextRelease.notes}" - }], - "@semantic-release/github" - ] -} diff --git a/eslint.config.mjs b/eslint.config.mjs deleted file mode 100644 index b963381..0000000 --- a/eslint.config.mjs +++ /dev/null @@ -1,15 +0,0 @@ -import appiumConfig from '@appium/eslint-config-appium-ts'; -import {defineConfig, globalIgnores} from 'eslint/config'; - -export default defineConfig([ - { - extends: [appiumConfig], - }, - { - files: ['test/**/*.{js,ts}'], - rules: { - 'func-names': 'off' - } - }, - globalIgnores(['build']), -]); diff --git a/lib/asyncbox.ts b/lib/asyncbox.ts index 18fa183..b078811 100644 --- a/lib/asyncbox.ts +++ b/lib/asyncbox.ts @@ -1,4 +1,5 @@ import {limitFunction} from 'p-limit'; + import type { CancellablePromise, LongSleepOptions, diff --git a/oxfmt.config.mjs b/oxfmt.config.mjs new file mode 100644 index 0000000..4752f81 --- /dev/null +++ b/oxfmt.config.mjs @@ -0,0 +1,6 @@ +import appiumConfig, {defineConfig, ignorePatterns} from '@appium/oxc-config/oxfmt'; + +export default defineConfig({ + ...appiumConfig, + ignorePatterns: [...ignorePatterns], +}); diff --git a/oxlint.config.mjs b/oxlint.config.mjs new file mode 100644 index 0000000..34ea238 --- /dev/null +++ b/oxlint.config.mjs @@ -0,0 +1,6 @@ +import appiumConfig, {defineConfig, ignorePatterns} from '@appium/oxc-config/oxlint'; + +export default defineConfig({ + extends: [appiumConfig], + ignorePatterns: [...ignorePatterns], +}); diff --git a/package.json b/package.json index 1043351..3ff7b5e 100644 --- a/package.json +++ b/package.json @@ -1,25 +1,32 @@ { "name": "asyncbox", + "version": "6.4.0", "description": "A collection of small async/await utilities", - "tags": [ + "keywords": [ + "async", "async/await", - "es7", - "async" + "es7" ], - "version": "6.4.0", - "author": "jlipps@gmail.com", + "bugs": { + "url": "https://github.com/appium/asyncbox/issues" + }, "license": "Apache-2.0", + "author": "jlipps@gmail.com", "repository": { "type": "git", "url": "https://github.com/appium/asyncbox.git" }, - "bugs": { - "url": "https://github.com/appium/asyncbox/issues" - }, - "engines": { - "node": "^20.19.0 || ^22.12.0 || >=24.0.0", - "npm": ">=10" + "bin": {}, + "directories": { + "lib": "./lib" }, + "files": [ + "lib/**/*", + "build/cjs/lib/**/*", + "build/cjs/package.json", + "build/esm/lib/**/*", + "build/esm/package.json" + ], "type": "module", "main": "./build/cjs/lib/asyncbox.js", "module": "./build/esm/lib/asyncbox.js", @@ -37,17 +44,6 @@ }, "./package.json": "./package.json" }, - "bin": {}, - "directories": { - "lib": "./lib" - }, - "files": [ - "lib/**/*", - "build/cjs/lib/**/*", - "build/cjs/package.json", - "build/esm/lib/**/*", - "build/esm/package.json" - ], "scripts": { "build": "tsc -b tsconfig.esm.json tsconfig.cjs.json", "postbuild": "node scripts/postbuild.mjs", @@ -56,28 +52,23 @@ "dev": "npm run build -- --watch", "prepare": "npm run rebuild", "test": "node --test --enable-source-maps --test-force-exit --test-timeout=60000 \"./build/esm/test/**/*.spec.js\" \"./test/*.spec.cjs\"", - "lint": "eslint .", - "format": "prettier -w ./lib ./test", - "format:check": "prettier --check ./lib ./test", + "lint": "oxlint -c oxlint.config.mjs .", + "lint:fix": "oxlint -c oxlint.config.mjs --fix .", + "format": "oxfmt -c oxfmt.config.mjs .", + "format:check": "oxfmt -c oxfmt.config.mjs --check .", "watch": "npm run dev" }, - "prettier": { - "bracketSpacing": false, - "printWidth": 100, - "singleQuote": true - }, "dependencies": { "p-limit": "^7.2.0" }, "devDependencies": { - "@appium/eslint-config-appium-ts": "^3.2.3", - "@appium/tsconfig": "^1.0.0", - "@semantic-release/changelog": "^6.0.1", - "@semantic-release/git": "^10.0.1", - "@types/node": "^26.1.0", - "conventional-changelog-conventionalcommits": "^9.0.0", - "prettier": "^3.0.0", - "semantic-release": "^25.0.2", - "typescript": "^6.0.3" + "@appium/oxc-config": "^1.1.0", + "@appium/semantic-release-config": "^1.1.0", + "@appium/tsconfig": "^1.2.0", + "@types/node": "^26.1.0" + }, + "engines": { + "node": "^20.19.0 || ^22.12.0 || >=24.0.0", + "npm": ">=10" } } diff --git a/release.config.mjs b/release.config.mjs new file mode 100644 index 0000000..83f3400 --- /dev/null +++ b/release.config.mjs @@ -0,0 +1,3 @@ +import releaseConfig from '@appium/semantic-release-config'; + +export default releaseConfig(); diff --git a/test/asyncbox.spec.ts b/test/asyncbox.spec.ts index 7114455..312afcc 100644 --- a/test/asyncbox.spec.ts +++ b/test/asyncbox.spec.ts @@ -1,3 +1,6 @@ +import assert from 'node:assert/strict'; +import {it, describe, beforeEach} from 'node:test'; + import { sleep, longSleep, @@ -11,8 +14,6 @@ import { PromiseCancellationError, type SleepOptions, } from '../lib/asyncbox.js'; -import {it, describe, beforeEach} from 'node:test'; -import assert from 'node:assert/strict'; describe('sleep', function () { it('should work like setTimeout', async function () { @@ -93,10 +94,7 @@ describe('sleep', function () { assert.throws(() => sleep([] as unknown as number), /finite number or an object with ms/); }); it('should throw TypeError when object has invalid ms', function () { - assert.throws( - () => sleep({} as unknown as SleepOptions), - /options\.ms must be a finite number/, - ); + assert.throws(() => sleep({} as unknown as SleepOptions), /options\.ms must be a finite number/); assert.throws(() => sleep({ms: Number.NaN}), /options\.ms must be a finite number/); }); it('should accept a null-prototype object with ms', async function () { diff --git a/tsconfig.json b/tsconfig.json index b69f826..745b79a 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -6,9 +6,6 @@ "types": ["node"], "checkJs": true }, - "include": [ - "lib", - "test" - ], + "include": ["lib", "test"], "exclude": ["test/*.cjs"] }