From 5a05c6f9acef1c46601e23df43d9a3dedd0cfbba Mon Sep 17 00:00:00 2001 From: Manta Anantachai Saothong Date: Thu, 25 Jun 2026 13:15:01 +0700 Subject: [PATCH 1/4] chore: skipping problematic dependency upgrade --- .github/dependabot.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/dependabot.yml b/.github/dependabot.yml index da65821..e8585de 100644 --- a/.github/dependabot.yml +++ b/.github/dependabot.yml @@ -20,6 +20,8 @@ updates: update-types: - 'version-update:semver-minor' - 'version-update:semver-patch' + ignore: + - dependency-name: '@types/estree' # Skip the error updating this specific package commit-message: prefix: 'chore(deps)' From bf2b968336d65dfb705d1200f41da29d00fc194d Mon Sep 17 00:00:00 2001 From: Manta Anantachai Saothong Date: Thu, 25 Jun 2026 13:15:32 +0700 Subject: [PATCH 2/4] build: bumping version --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index fc3023d..4f9ce79 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "positioning-strategy", - "version": "5.0.0", + "version": "5.0.1", "homepage": "https://github.com/taskworld/positioning-strategy#readme", "bugs": { "url": "https://github.com/taskworld/positioning-strategy/issues" From b65dfd9804071a6394aec8577c551105936b3d37 Mon Sep 17 00:00:00 2001 From: Manta Anantachai Saothong Date: Thu, 25 Jun 2026 13:56:22 +0700 Subject: [PATCH 3/4] chore: modern linter config --- .oxfmtrc.json | 18 ----------------- .oxlintrc.json | 45 ----------------------------------------- .vscode/settings.json | 7 ++++++- index.test.ts | 9 ++++----- oxfmt.config.ts | 19 +++++++++++++++++ oxlint.config.ts | 47 +++++++++++++++++++++++++++++++++++++++++++ package.json | 4 ++-- 7 files changed, 78 insertions(+), 71 deletions(-) delete mode 100644 .oxfmtrc.json delete mode 100644 .oxlintrc.json create mode 100644 oxfmt.config.ts create mode 100644 oxlint.config.ts diff --git a/.oxfmtrc.json b/.oxfmtrc.json deleted file mode 100644 index f16ef56..0000000 --- a/.oxfmtrc.json +++ /dev/null @@ -1,18 +0,0 @@ -{ - "$schema": "./node_modules/oxfmt/configuration_schema.json", - "arrowParens": "always", - "bracketSameLine": false, - "bracketSpacing": true, - "endOfLine": "lf", - "ignorePatterns": ["**/*.js", "**/*.map", "**/*.d.ts", "coverage"], - "insertFinalNewline": true, - "jsxSingleQuote": false, - "objectWrap": "preserve", - "printWidth": 100, - "quoteProps": "as-needed", - "semi": false, - "singleAttributePerLine": false, - "singleQuote": true, - "tabWidth": 2, - "trailingComma": "es5" -} diff --git a/.oxlintrc.json b/.oxlintrc.json deleted file mode 100644 index 79a3f61..0000000 --- a/.oxlintrc.json +++ /dev/null @@ -1,45 +0,0 @@ -{ - "$schema": "./node_modules/oxlint/configuration_schema.json", - "plugins": ["import", "typescript", "unicorn", "vitest"], - "env": { - "browser": true - }, - "ignorePatterns": ["**/*.js", "**/*.map", "**/*.d.ts", "coverage"], - "categories": { - "correctness": "error", - "suspicious": "error" - }, - "rules": { - "eslint/eqeqeq": "error", - "eslint/no-shadow": "off", // Too picky - "eslint/no-nested-ternary": "warn", - "eslint/no-unused-vars": "off", // Rely on TypeScript compiler instead - - "import/no-named-as-default": "off", // Too picky - "import/no-unassigned-import": "off", // Does not recognize CSS imports - - "jest/consistent-test-it": ["error", { "fn": "it" }], - "jest/no-alias-methods": "error", - "jest/no-conditional-in-test": "warn", - "jest/no-identical-title": "error", - "jest/padding-around-test-blocks": "error", - "jest/prefer-equality-matcher": "error", - "jest/prefer-hooks-in-order": "error", - "jest/prefer-to-contain": "error", - "jest/prefer-to-have-length": "error", - "jest/valid-title": "off", // Rely on https://oxc.rs/docs/guide/usage/linter/rules/vitest/prefer-describe-function-title - - "typescript/no-base-to-string": "off", // Too picky - "typescript/no-floating-promises": "warn", // Too many errors - "typescript/no-explicit-any": "warn", // Too many errors - "typescript/no-unnecessary-type-assertion": "warn", // Too many errors - "typescript/no-unsafe-type-assertion": "warn", // Too many errors - "typescript/unbound-method": "off", // Too picky - - "unicorn/explicit-length-check": "warn", - "unicorn/no-array-sort": "off", // Risk of backward-compatibility break - - "vitest/expect-expect": "off", // Does not work with our `assertVisual` utility function - "vitest/prefer-describe-function-title": "warn" - } -} diff --git a/.vscode/settings.json b/.vscode/settings.json index 1d98b09..fe580a2 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -1,5 +1,10 @@ { "editor.indentSize": 2, "editor.defaultFormatter": "oxc.oxc-vscode", - "oxc.typeAware": true + "search.exclude": { + "**/node_modules": true, + "coverage": true, + "*.js": true, + "*.map": true + } } diff --git a/index.test.ts b/index.test.ts index 52c2430..9059221 100644 --- a/index.test.ts +++ b/index.test.ts @@ -1,5 +1,5 @@ import { describe, expect, it } from 'vitest' -import { calculateChildPosition, type Dimension, type Offset } from './index.ts' +import { calculateChildPosition, type Dimension, type Offset, type Strategy } from './index.ts' const viewportRect: Dimension = { width: 80, height: 20 } const buttonRect: Offset & Dimension = { @@ -8,18 +8,17 @@ const buttonRect: Offset & Dimension = { width: 4, height: 2, } -const moveTo = (left: number, top: number) => (rect) => ({ ...rect, top, left }) -const moveBy = (dx: number, dy: number) => (rect) => ({ +const moveBy = (dx: number, dy: number) => (rect: Offset & Dimension) => ({ ...rect, top: rect.top + dy, left: rect.left + dx, }) describe('strategies', () => { - const testStrategy = (strategyName, expectedResult) => { + const testStrategy = (strategyName: Strategy, expectedResult: string) => { const menuRect = { width: 12, height: 6 } - it(`${strategyName}`, () => { + it(strategyName, () => { const args: Parameters = [ strategyName, buttonRect, diff --git a/oxfmt.config.ts b/oxfmt.config.ts new file mode 100644 index 0000000..c3dbf83 --- /dev/null +++ b/oxfmt.config.ts @@ -0,0 +1,19 @@ +import { defineConfig } from 'oxfmt' + +export default defineConfig({ + arrowParens: 'always', + bracketSameLine: false, + bracketSpacing: true, + endOfLine: 'lf', + ignorePatterns: ['**/*.js', '**/*.map', '**/*.d.ts', 'coverage'], + insertFinalNewline: true, + jsxSingleQuote: false, + objectWrap: 'preserve', + printWidth: 100, + quoteProps: 'as-needed', + semi: false, + singleAttributePerLine: false, + singleQuote: true, + tabWidth: 2, + trailingComma: 'es5', +}) diff --git a/oxlint.config.ts b/oxlint.config.ts new file mode 100644 index 0000000..5babb96 --- /dev/null +++ b/oxlint.config.ts @@ -0,0 +1,47 @@ +import { defineConfig } from 'oxlint' + +export default defineConfig({ + plugins: ['import', 'typescript', 'unicorn', 'vitest'], + options: { + typeAware: true, + typeCheck: true, + }, + env: { + browser: true, + }, + ignorePatterns: ['**/*.js', '**/*.map', '**/*.d.ts', 'coverage'], + categories: { + correctness: 'error', + suspicious: 'error', + }, + rules: { + 'eslint/eqeqeq': 'error', + 'eslint/no-shadow': 'off', // Too picky + 'eslint/no-unused-vars': 'off', // Rely on TypeScript compiler instead + + 'import/no-named-as-default': 'off', // Too picky + 'import/no-unassigned-import': 'off', // Does not recognize CSS imports + + 'typescript/no-base-to-string': 'off', // Too picky + 'typescript/no-floating-promises': 'warn', // Too many errors + 'typescript/no-explicit-any': 'warn', // Too many errors + 'typescript/no-unnecessary-type-assertion': 'warn', // Too many errors + 'typescript/no-unsafe-type-assertion': 'warn', // Too many errors + 'typescript/unbound-method': 'off', // Too picky + + 'unicorn/explicit-length-check': 'warn', + 'unicorn/no-array-sort': 'off', // Risk of backward-compatibility break + + 'vitest/consistent-test-it': ['error', { fn: 'it' }], + 'vitest/expect-expect': 'off', // Does not work with our `assertVisual` utility function + 'vitest/no-alias-methods': 'error', + 'vitest/no-conditional-in-test': 'warn', + 'vitest/no-identical-title': 'error', + 'vitest/prefer-describe-function-title': 'warn', + 'vitest/prefer-equality-matcher': 'error', + 'vitest/prefer-hooks-in-order': 'error', + 'vitest/prefer-to-contain': 'error', + 'vitest/prefer-to-have-length': 'error', + 'vitest/valid-title': 'off', // Rely on https://oxc.rs/docs/guide/usage/linter/rules/vitest/prefer-describe-function-title + }, +}) diff --git a/package.json b/package.json index 4f9ce79..e5ecc0c 100644 --- a/package.json +++ b/package.json @@ -19,8 +19,8 @@ "main": "index.js", "scripts": { "build": "tsc", - "lint": "oxlint --quiet --type-aware", - "test": "pnpm run build --noEmit && vitest --no-watch --coverage", + "lint": "oxlint", + "test": "pnpm run build --noEmit && vitest --coverage", "version": "pnpm run build", "postversion": "pnpm publish" }, From e44bf10c705c804585d8d3bad86d034b0166db4a Mon Sep 17 00:00:00 2001 From: Manta Anantachai Saothong Date: Thu, 25 Jun 2026 13:56:26 +0700 Subject: [PATCH 4/4] chore: continuous integration --- .github/workflows/pr-updated.yml | 18 ++++++++++++++++++ lefthook.yml | 2 -- 2 files changed, 18 insertions(+), 2 deletions(-) create mode 100644 .github/workflows/pr-updated.yml diff --git a/.github/workflows/pr-updated.yml b/.github/workflows/pr-updated.yml new file mode 100644 index 0000000..be1871f --- /dev/null +++ b/.github/workflows/pr-updated.yml @@ -0,0 +1,18 @@ +on: + pull_request: + +jobs: + code-check: + if: ${{ !github.event.pull_request.draft }} + concurrency: + group: code-check--${{ github.ref }} + cancel-in-progress: true + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v7 + + - uses: pnpm/action-setup@v6 + + - run: pnpm run lint + + - run: pnpm run test diff --git a/lefthook.yml b/lefthook.yml index 59174cc..4eb3430 100644 --- a/lefthook.yml +++ b/lefthook.yml @@ -11,5 +11,3 @@ pre-commit: format: run: pnpm exec oxfmt --no-error-on-unmatched-pattern {staged_files} stage_fixed: true - test: - run: pnpm run test --silent --reporter dot