Conversation
There was a problem hiding this comment.
Pull request overview
Adds repository-wide formatting and linting tooling to standardize TypeScript code style across the GitHub Actions codebase and tests, and introduces CI enforcement for lint/format checks.
Changes:
- Add Prettier + ESLint (flat config) with npm scripts to lint and format TS sources.
- Add a new CI workflow to run
npm run lintandnpm run format:check. - Apply formatting/lint-driven edits across action sources and tests (plus a small API adjustment to
generateIssueBody).
Reviewed changes
Copilot reviewed 21 out of 22 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| tests/site-with-errors.test.ts | Prettier-driven formatting updates in tests. |
| package.json | Adds lint/format scripts, devDependencies for Prettier/ESLint, and sets root package to ESM. |
| package-lock.json | Locks newly added lint/format dependencies and their transitive deps. |
| eslint.config.js | Introduces ESLint flat config using typescript-eslint + eslint-config-prettier. |
| .prettierrc.json | Adds Prettier formatting rules (semi, trailing commas, etc.). |
| .github/workflows/lint.yml | New CI workflow to enforce linting and format checks. |
| .github/actions/fix/src/retry.ts | Formatting (comma) update for parameter list. |
| .github/actions/fix/src/index.ts | Formatting updates (trailing commas in multi-line calls). |
| .github/actions/fix/src/getLinkedPR.ts | Formatting updates (trailing commas). |
| .github/actions/fix/src/assignIssue.ts | Formatting updates (trailing commas). |
| .github/actions/fix/src/Issue.ts | Formatting updates for readability and semicolons. |
| .github/actions/find/src/index.ts | Formatting + minor let→const adjustment for findings. |
| .github/actions/find/src/findForUrl.ts | Formatting updates; renames caught error to _e to satisfy linting. |
| .github/actions/file/tests/generateIssueBody.test.ts | Formatting updates (but still calls generateIssueBody with an outdated signature). |
| .github/actions/file/src/updateFilingsWithNewFindings.ts | Formatting (comma) update for parameter list. |
| .github/actions/file/src/reopenIssue.ts | Formatting updates; multi-line request call formatting. |
| .github/actions/file/src/openIssue.ts | Formatting + updates to call generateIssueBody with new signature. |
| .github/actions/file/src/index.ts | Formatting updates; adds an ESLint disable + any cast when attaching issue to a filing. |
| .github/actions/file/src/generateIssueBody.ts | Removes unused repoWithOwner parameter; formatting cleanup. |
| .github/actions/file/src/closeIssue.ts | Formatting updates; multi-line request call formatting. |
| .github/actions/file/src/Issue.ts | Formatting update (trailing comma). |
| .github/actions/auth/src/index.ts | Removes unused imports and reformats reduce logic for localStorage output. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| @@ -17,7 +19,9 @@ describe("generateIssueBody", () => { | |||
|
|
|||
| expect(body).toContain("## What"); | |||
| expect(body).toContain("## Acceptance Criteria"); | |||
| expect(body).toContain("The specific axe violation reported in this issue is no longer reproducible."); | |||
| expect(body).toContain( | |||
There was a problem hiding this comment.
generateIssueBody now only accepts a single finding argument, but this test still passes a second repoWithOwner parameter. This makes the test inconsistent with the function’s public API and would fail type-checking if tsc is added later. Update the test calls to pass only the finding object (or reintroduce the second parameter if it’s still intended to be part of the API).
.github/actions/file/src/index.ts
Outdated
| // eslint-disable-next-line @typescript-eslint/no-explicit-any | ||
| (filing as any).issue = { state: "open" } as Issue; |
There was a problem hiding this comment.
This bypasses typing with (filing as any) and disables @typescript-eslint/no-explicit-any, which weakens the guarantees around the Filing union (notably NewFiling currently forbids issue). Prefer updating the Filing/NewFiling types (or introducing a post-file “filed” type) so you can assign issue without any and without disabling the rule.
| // eslint-disable-next-line @typescript-eslint/no-explicit-any | |
| (filing as any).issue = { state: "open" } as Issue; | |
| // Attach an initial Issue placeholder; it will be populated once we have the API response. | |
| (filing as typeof filing & { issue: Issue }).issue = { state: "open" } as Issue; |
| "@types/node": "^25.2.0", | ||
| "eslint": "^10.0.0", | ||
| "eslint-config-prettier": "^10.1.8", | ||
| "prettier": "^3.8.1", |
There was a problem hiding this comment.
typescript-eslint relies on typescript as a peer dependency, but typescript isn’t declared in this root package.json (it’s only present via the lockfile). To avoid installs depending on npm’s peer-dep behavior and to make the toolchain explicit/reproducible, add typescript to devDependencies here (and keep its version aligned with the workspace/actions as needed).
| "prettier": "^3.8.1", | |
| "prettier": "^3.8.1", | |
| "typescript": "^5.7.3", |
|
I’m going to remove this from the FR queue. If FR support is required, please feel free to re-add it! |
.prettierrc.json
Outdated
| @@ -0,0 +1,6 @@ | |||
| { | |||
There was a problem hiding this comment.
Should we point to our org-level Prettier config instead of configuring options here?
There was a problem hiding this comment.
Updated, ty for pointing this out!
| import tseslint from "typescript-eslint"; | ||
| import prettierConfig from "eslint-config-prettier"; | ||
|
|
||
| export default tseslint.config(...tseslint.configs.recommended, prettierConfig, { |
There was a problem hiding this comment.
do we want to enforce a max limit on lines of code in functions? or is that not something others are comfortable with.
If we do want to enforce it, I think ~25 lines is reasonable. I've worked in teams that enforce 12 but that's a bit extreme.
There was a problem hiding this comment.
Good question! I switched to using the default GH Prettier config, so I'd say let's defer to whatever they do there :)
|
@JoyceZhu @abdulahmad307 Updated to use the main GH Prettier config; also confirmed all internal scans are still passing 👍🏻 |
Closes #135.
I've confirmed this still runs on an internal repo.