Skip to content

Clear the two Biome warnings in scripts/ - #64

Merged
Stwissel merged 1 commit into
beyonddemise:mainfrom
dchaudhari7177:chore/60-clear-biome-warnings
Aug 24, 2026
Merged

Clear the two Biome warnings in scripts/#64
Stwissel merged 1 commit into
beyonddemise:mainfrom
dchaudhari7177:chore/60-clear-biome-warnings

Conversation

@dchaudhari7177

Copy link
Copy Markdown
Contributor

Closes #60. npx biome check . reports zero warnings and zero errors.

1. check-dependencies.mjs — optional chain

-      } else if (!policy.allowed[dep] && !(policy.allowedDev ?? {})[dep]) {
+      } else if (!policy.allowed[dep] && !policy.allowedDev?.[dep]) {

Your equivalence argument holds, and I checked it rather than took it on trust: ?? substitutes only for null/undefined, ?. short-circuits on exactly those two, and for any other type the index lookup yields undefined either way. allowedDev is read from dependency-policy.json, so it is an object or absent. The unsafe flag is Biome not knowing that in general — it is not a doubt about this call site.

2. check-npmrc.mjs — dead suppression

Directive gone, prose kept. I also folded your finding into the comment:

/** The only accepted form: an environment reference, optionally surrounded by whitespace. */
// The ${...} here is literal .npmrc syntax, not a JS template placeholder.
// (No biome-ignore needed: noTemplateCurlyInString does not inspect regex
// literals, so the directive that used to sit here suppressed nothing. It
// would be needed again if this were ever rewritten as a string.)
const ENV_REFERENCE = /^\$\{[A-Za-z_][A-Za-z0-9_]*\}$/

Without that second half, the next reader sees a comment about .npmrc syntax and no reason the suppression is absent — and your caveat about the string rewrite is exactly the thing that would otherwise have to be rediscovered.

Done when

  • npx biome check . reports zero warnings and zero errors
  • scripts/check-dependencies.mjs uses the optional-chain form, and still passes on the current tree
  • The dead biome-ignore is gone and the prose explanation is retained
  • node scripts/check-npmrc.mjs still fails on a literal token
  • npm run verify exits 0

The guard demonstrated failing rather than presumed to, per L8:

$ printf '//registry.npmjs.org/:_authToken=npm_literalSecretToken...\n' > .npmrc
$ node scripts/check-npmrc.mjs; echo "exit=$?"
.npmrc contains a credential that is not an environment reference:

  line 1: value must be exactly ${VARIABLE}
    //registry.npmjs.org/:_authToken=<redacted>

Use ${WEBAWESOME_NPM_TOKEN}. See CONTRIBUTING.md.
exit=1

and the accepting case, so the exit 1 above is not a gate that rejects everything:

$ printf '//registry.npmjs.org/:_authToken=${WEBAWESOME_NPM_TOKEN}\n' > .npmrc
$ node scripts/check-npmrc.mjs; echo "exit=$?"
.npmrc: ok (credentials reference the environment only)
exit=0

The repository's own .npmrc was restored afterwards, byte for byte.

npm run verify: exit 0 — deps ok (6 manifests), npmrc ok, biome clean, tsc --build clean, 127 tests passing.

One note for anyone reproducing on Windows

Without core.autocrlf=false, Biome reports every file in scripts/ as a formatting error before any change is made — the working copy is CRLF and the index is LF. It is a local checkout artefact, not a repo state, but it buries the two real warnings completely. Both blobs in this PR are committed LF (git ls-files --eol confirms i/lf w/lf).

The remaining biome migrate info is pre-existing and untouched — the issue asks for zero warnings and zero errors, and I read that as leaving the info alone rather than pulling a config migration into this PR. Say the word if you want it here instead.

npx biome check . now reports zero warnings and zero errors.

check-dependencies.mjs takes the optional-chain form. Your equivalence argument
holds and I checked it rather than took it: `??` substitutes only for null and
undefined, `?.` short-circuits on exactly those two, and for any other type the
index lookup yields undefined either way. allowedDev comes from
dependency-policy.json, so it is an object or absent. The unsafe flag is about
the rule not knowing that in general, not about this call site.

check-npmrc.mjs loses the directive and keeps the prose, as asked. I moved your
finding into the comment as well -- that noTemplateCurlyInString does not
inspect regex literals, which is why the suppression never fired -- together
with the caveat that it becomes necessary again if ENV_REFERENCE is ever
rewritten as a string. Without that, the next reader sees a bare comment about
npmrc syntax and no reason the suppression is absent.

Verified:

  npx biome check .                 zero warnings, zero errors
  node scripts/check-dependencies.mjs   ok (6 manifests), exit 0
  node scripts/check-npmrc.mjs      exit 1 on a literal token, exit 0 on ${VAR}
  npm run verify                    exit 0 (127 tests, typecheck clean)

The npmrc guard was demonstrated failing rather than presumed to fail, per L8:

  .npmrc contains a credential that is not an environment reference:
    line 1: value must be exactly ${VARIABLE}
      //registry.npmjs.org/:_authToken=<redacted>

One note for anyone reproducing on Windows: without core.autocrlf=false, Biome
reports every file in scripts/ as a formatting error, because the working copy
is CRLF and the index is LF. That is a local checkout artefact, not a repo
state -- both blobs here are committed LF.

The remaining `biome migrate` info is pre-existing and untouched.

Closes beyonddemise#60
@coderabbitai

coderabbitai Bot commented Aug 20, 2026

Copy link
Copy Markdown
Contributor

Important

  • 🔍 Trigger review

This repository does not receive automatic reviews because it has fewer than 10 stars.

⚙️ Run configuration

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Pro Plus

Run ID: 88b33b96-47cb-4a8f-b999-8102257c24a1


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@Stwissel
Stwissel merged commit 785136b into beyonddemise:main Aug 24, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

2 participants