Skip to content

chore(auth): Apply eslint to all auth-server test files#20792

Open
nshirley wants to merge 1 commit into
mainfrom
nshirley/fxa-13283
Open

chore(auth): Apply eslint to all auth-server test files#20792
nshirley wants to merge 1 commit into
mainfrom
nshirley/fxa-13283

Conversation

@nshirley

Copy link
Copy Markdown
Contributor

Because:

  • An unanchored "fxa-*" ignorePattern matched by basename at any depth, silently excluding real source and test files from ESLint.

This commit:

  • Anchors the pattern to "/fxa-*" so it only ignores top-level vendored dirs.
  • Fixes the latent lint errors the un-ignore surfaces.
  • Documents the spec-only async-crypto-random relaxation.

Closes: #FXA-13283

Checklist

Put an x in the boxes that apply

  • My commit is GPG signed.
  • If applicable, I have modified or added tests which pass locally.
  • I have added necessary documentation (if appropriate).
  • I have verified that my changes render correctly in RTL (if appropriate).
  • I have manually reviewed all AI generated code.

How to review (Optional)

  • Key files/areas to focus on:
  • Suggested review order:
  • Risky or complex parts:

Screenshots (Optional)

Please attach the screenshots of the changes made in case of change in user interface.

Other information (Optional)

Any other information that is important to this pull request.

Because:

* An unanchored "fxa-*" ignorePattern matched by basename at any depth,
  silently excluding real source and test files from ESLint.

This commit:

* Anchors the pattern to "/fxa-*" so it only ignores top-level vendored dirs.
* Fixes the latent lint errors the un-ignore surfaces.
* Documents the spec-only async-crypto-random relaxation.

Fixes #FXA-13283
@nshirley nshirley requested a review from a team as a code owner June 26, 2026 16:35
Copilot AI review requested due to automatic review settings June 26, 2026 16:35
@nshirley nshirley changed the title chore(auth): Lint fxa-* files excluded by over-broad ignore pattern chore(auth): Apply eslint to all auth-server test files Jun 26, 2026
* argument shapes of each `fxaMailer.send*` invocation. Their being unused is by design,
* so `no-unused-vars` is disabled for the whole file.
*/
/* eslint-disable @typescript-eslint/no-unused-vars */

@nshirley nshirley Jun 26, 2026

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Honestly, we could probably remove this file altogether. It was useful when rolling out the fxa-mailer and libs/email/ integration since not all call sites are TS. But, it doesn't serve any other purpose now

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR tightens packages/fxa-auth-server’s ESLint ignore pattern so it only ignores top-level vendored fxa-* directories, ensuring real source/tests (e.g., lib/senders/fxa-mailer*.ts) are linted, and fixes the lint issues that were previously being silently skipped.

Changes:

  • Anchor the ignore pattern from fxa-* to /fxa-* and document why, plus document the spec-only async-crypto-random relaxation.
  • Adjust a mailer spec to avoid an unused-destructuring pattern while keeping the “no event recorded without uid” behavior.
  • Minor lint-driven cleanup (e.g., letconst) and add an explicit file-level no-unused-vars disable for the type-check-only sanity file.

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 1 comment.

File Description
packages/fxa-auth-server/lib/senders/fxa-mailer.spec.ts Updates a test setup to avoid linting issues while still exercising the “no uid → no event” path.
packages/fxa-auth-server/lib/senders/fxa-mailer-sanity-check.ts Clarifies intent of the type-check-only “sanity” driver and disables no-unused-vars for the file.
packages/fxa-auth-server/lib/senders/fxa-mailer-format.ts Replaces a non-reassigned let with const to satisfy linting.
packages/fxa-auth-server/.eslintrc.json Anchors the ignore pattern and adds explanatory comments for the ignore/override behavior.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines 16 to 18
* This is jsut a strong typed driver that allows us to validate the params we pass into FxaMailer
* functions are type safe. Since there's still a lot of code in auth-server that isn't type safe
* this gives us some level of sanity that we are invoking the mailer methods correctly.
};
}) {
let metricsContext = await request.app.metricsContext;
const metricsContext = await request.app.metricsContext;

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Caught by enabling the linting on correct file paths. Prior unanchored fxa-* would catch any file named as such, ignoring this and the fxa-mailer files

"ignorePatterns": [
"dist",
"fxa-*",
// Anchored to the package root so it only ignores top-level vendored fxa-*

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Probably don't need the comments, but they did feel relevant. I'm indifferent if they stay or go!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants