From 8e75b7f7ad74a657d4c4b3b3ba5c9558d670f78b Mon Sep 17 00:00:00 2001 From: Hiroshi Ogawa Date: Tue, 28 Apr 2026 14:01:14 +0900 Subject: [PATCH 1/4] chore: setup vp lint --- .github/workflows/ci.yml | 3 +-- package.json | 5 ++--- src/aria/folk/isomorphic/yaml.ts | 4 ++-- src/selectorGenerator.ts | 2 +- vite.config.ts | 12 +++++++++++- 5 files changed, 17 insertions(+), 9 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index d5c664f..1367aa9 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -23,9 +23,8 @@ jobs: - uses: actions/checkout@v6 - uses: voidzero-dev/setup-vp@v1 - run: vp i - - run: vp check --no-lint + - run: vp run lint - run: vp run build - - run: vp run typecheck test: strategy: diff --git a/package.json b/package.json index 6284f66..161b63f 100644 --- a/package.json +++ b/package.json @@ -32,9 +32,8 @@ "prepare": "vp config", "dev": "vp pack --watch --sourcemap", "build": "vp pack", - "lint": "vp check --no-lint", - "lint-fix": "vp check --no-lint --fix", - "typecheck": "tsc -b", + "lint": "vp check", + "lint-fix": "vp check --fix", "test-chrome": "vitest --project='*chromium*'", "test-unit": "vitest --project=unit", "test": "vitest" diff --git a/src/aria/folk/isomorphic/yaml.ts b/src/aria/folk/isomorphic/yaml.ts index f7cc0fa..8bdf13f 100644 --- a/src/aria/folk/isomorphic/yaml.ts +++ b/src/aria/folk/isomorphic/yaml.ts @@ -53,13 +53,13 @@ function yamlStringNeedsQuotes(str: string): boolean { if (str.length === 0) return true if (/^\s|\s$/.test(str)) return true if (/[\x00-\x08\x0b\x0c\x0e-\x1f\x7f-\x9f]/.test(str)) return true - if (/^-/.test(str)) return true + if (str.startsWith('-')) return true if (/[\n:](\s|$)/.test(str)) return true if (/\s#/.test(str)) return true if (/[\n\r]/.test(str)) return true if (/^[&*\],?!>|@"'#%]/.test(str)) return true if (/[{}`]/.test(str)) return true - if (/^\[/.test(str)) return true + if (str.startsWith('[')) return true if ( !isNaN(Number(str)) || ['y', 'n', 'yes', 'no', 'true', 'false', 'on', 'off', 'null'].includes( diff --git a/src/selectorGenerator.ts b/src/selectorGenerator.ts index 2a51edb..d41e4b8 100644 --- a/src/selectorGenerator.ts +++ b/src/selectorGenerator.ts @@ -528,7 +528,7 @@ function buildTextCandidates( } function makeSelectorForId(id: string) { - return /^[a-z][\w\-]+$/i.test(id) ? `#${id}` : `[id="${cssEscape(id)}"]` + return /^[a-z][\w-]+$/i.test(id) ? `#${id}` : `[id="${cssEscape(id)}"]` } function cssFallback( diff --git a/vite.config.ts b/vite.config.ts index 03f33fd..d3d17c3 100644 --- a/vite.config.ts +++ b/vite.config.ts @@ -21,7 +21,17 @@ export default defineConfig({ printWidth: 85, ignorePatterns: [], }, + lint: { + rules: { + // covered by typecheck + 'no-unused-vars': 'off', + }, + options: { + typeAware: true, + typeCheck: true, + }, + }, staged: { - '*': 'vp check --no-lint --fix', + '*': 'vp check --fix', }, }) From c52879d48081cb4e5298d3121f527553b501f0f1 Mon Sep 17 00:00:00 2001 From: Hiroshi Ogawa Date: Tue, 28 Apr 2026 14:07:34 +0900 Subject: [PATCH 2/4] disable lint --- vite.config.ts | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/vite.config.ts b/vite.config.ts index d3d17c3..63a6dba 100644 --- a/vite.config.ts +++ b/vite.config.ts @@ -22,9 +22,8 @@ export default defineConfig({ ignorePatterns: [], }, lint: { - rules: { - // covered by typecheck - 'no-unused-vars': 'off', + categories: { + correctness: 'off', }, options: { typeAware: true, From b2d042f68c440a0328b702135ed6ea1b55e31625 Mon Sep 17 00:00:00 2001 From: Hiroshi Ogawa Date: Tue, 28 Apr 2026 14:09:08 +0900 Subject: [PATCH 3/4] chore: readme --- README.md | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/README.md b/README.md index 8467944..a034ba6 100644 --- a/README.md +++ b/README.md @@ -70,6 +70,15 @@ vp run build vp run test ``` +Equivalently, you can also use `pnpm` directly: + +```sh +pnpm install +pnpm dev +pnpm build +pnpm test +``` + ## See more - [Locators guide in Playwright's documentation](https://playwright.dev/docs/locators#locator-operators) From 6314b1ea8a3da20e9f83bc883b30ac206b18a257 Mon Sep 17 00:00:00 2001 From: Hiroshi Ogawa Date: Tue, 28 Apr 2026 14:10:28 +0900 Subject: [PATCH 4/4] chore: revert src --- src/aria/folk/isomorphic/yaml.ts | 4 ++-- src/selectorGenerator.ts | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/aria/folk/isomorphic/yaml.ts b/src/aria/folk/isomorphic/yaml.ts index 8bdf13f..f7cc0fa 100644 --- a/src/aria/folk/isomorphic/yaml.ts +++ b/src/aria/folk/isomorphic/yaml.ts @@ -53,13 +53,13 @@ function yamlStringNeedsQuotes(str: string): boolean { if (str.length === 0) return true if (/^\s|\s$/.test(str)) return true if (/[\x00-\x08\x0b\x0c\x0e-\x1f\x7f-\x9f]/.test(str)) return true - if (str.startsWith('-')) return true + if (/^-/.test(str)) return true if (/[\n:](\s|$)/.test(str)) return true if (/\s#/.test(str)) return true if (/[\n\r]/.test(str)) return true if (/^[&*\],?!>|@"'#%]/.test(str)) return true if (/[{}`]/.test(str)) return true - if (str.startsWith('[')) return true + if (/^\[/.test(str)) return true if ( !isNaN(Number(str)) || ['y', 'n', 'yes', 'no', 'true', 'false', 'on', 'off', 'null'].includes( diff --git a/src/selectorGenerator.ts b/src/selectorGenerator.ts index d41e4b8..2a51edb 100644 --- a/src/selectorGenerator.ts +++ b/src/selectorGenerator.ts @@ -528,7 +528,7 @@ function buildTextCandidates( } function makeSelectorForId(id: string) { - return /^[a-z][\w-]+$/i.test(id) ? `#${id}` : `[id="${cssEscape(id)}"]` + return /^[a-z][\w\-]+$/i.test(id) ? `#${id}` : `[id="${cssEscape(id)}"]` } function cssFallback(