Skip to content

chore(packages): extract @nswds/prettier-config to its own repo#39

Merged
laurenhitchon merged 8 commits into
mainfrom
chore/extract-prettier-config
Jul 27, 2026
Merged

chore(packages): extract @nswds/prettier-config to its own repo#39
laurenhitchon merged 8 commits into
mainfrom
chore/extract-prettier-config

Conversation

@laurenhitchon

@laurenhitchon laurenhitchon commented Jul 27, 2026

Copy link
Copy Markdown
Contributor

⚠️ Stacked on #38 — base is chore/extract-eslint-config, not main. Both edit the same doc section, so stacking avoids a conflict. GitHub retargets to main once #38 merges. Merge #38 first.

Removes packages/prettier-config. It now lives at digitalnsw/nswds-prettier-config (public). With this, packages/ is empty and gone.

Why

Identical to #38: this repo is "private": true at the root and comments out @semantic-release/npm, so it can never publish. The package sat at 0.0.0 with no adopters while repos kept copy-pasting a .prettierrc.

publishConfig moves restrictedpublic, matching @nswds/tokens and @nswds/eslint-config. Restricted needs a paid npm org plan plus registry auth in every consumer's CI — which none of them have.

The new repo

Mirrors nswds-eslint-config: semantic-release + @semantic-release/npm + OIDC trusted publishing, no NPM_TOKEN.

It ships a real test suite (4 tests, all passing) — the important one:

// Prettier silently ignores unknown keys, so a typo in index.json would ship
// unnoticed and quietly stop being applied.
const supported = new Set((await prettier.getSupportInfo()).options.flatMap(...))
assert.deepEqual(Object.keys(config).filter((k) => !supported.has(k)), [])

That is the failure mode a shared formatting config can least afford — silent, invisible, and it drifts every consumer apart. The others assert singleQuote, semi: false and jsxSingleQuote actually format as intended.

Docs

docs/config-single-source-of-truth.md:

  • Records both new homes; collapses the two now-identical explanations into one
  • Rewrites Phase 3 to describe the actual remaining work — one-time manual first publish, then trusted-publisher config, then per-repo migration
  • Resolves the stale "decide a licence before publishing" item

Licence

Both new repos are MPL-2.0, matching @nswds/tokens, so the whole @nswds/* scope is consistent. They initially carried ISC — inherited from this repo's root rather than chosen for a published package — and were relicensed before either was published, so there is no prior distribution under ISC to reconcile. The doc records the settled outcome.

(This paragraph previously said the repos ship ISC and that the licence was still an open decision. That was written before the relicense commit and is corrected here — the doc was already accurate.)

Still needed for either package to be usable

Neither is on npm yet. Each needs a one-time npm publish --access public, then trusted-publisher config on npmjs.com. Nothing is blocked by these PRs — the 12 repos keep their local configs until they migrate.

Remove packages/eslint-config. It now lives at
digitalnsw/nswds-eslint-config.

The package could never be published from here: this repo is
`"private": true` at the root and deliberately comments out
@semantic-release/npm, so it releases a changelog and a GitHub release
but never touches npm. That is why it sat at 0.0.0 with zero adopters
while all 12 Next.js repos kept hand-maintaining their own
eslint.config.mjs — the "single source of truth" had no way to reach a
consumer.

The new repo mirrors the nswds-tokens release setup: semantic-release
with @semantic-release/npm, publishing via OIDC trusted publishing rather
than a long-lived NPM_TOKEN, and a CI smoke test that lints a JSX file
through the real ESLint API so the ESLint 10 getFilename regression
cannot come back silently.

Keeping the copy here would have let the two drift, and the stale one is
the one people would find first via the docs.

Update docs/config-single-source-of-truth.md: record the new home, note
that adopting repos drop both their local config body and their
@eslint/compat fixupConfigRules wrapper (the shim lives in the package
now), and flag that @nswds/prettier-config is still here and still
unpublishable for exactly the same reason.
Remove packages/prettier-config. It now lives at
digitalnsw/nswds-prettier-config. With this, packages/ is empty and gone.

Same reason as @nswds/eslint-config in the previous commit: this repo is
`"private": true` at the root and comments out @semantic-release/npm, so
it can never publish. The package sat at 0.0.0 with no adopters while
repos kept copy-pasting a .prettierrc.

publishConfig moves from restricted to public, matching @nswds/tokens and
@nswds/eslint-config — restricted needs a paid npm org plan plus registry
auth in every consumer's CI, which none of them have.

Update docs/config-single-source-of-truth.md: record both new homes,
collapse the two now-identical explanations into one, rewrite Phase 3 to
describe the actual remaining work (one-time manual first publish, then
trusted-publisher config, then per-repo migration), and resolve the stale
"decide a licence before publishing" item — both repos ship ISC, matching
what the packages already declared, though that differs from
@nswds/tokens (MPL-2.0) and is worth a deliberate call.
Copilot AI review requested due to automatic review settings July 27, 2026 04:03

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

Removes the in-repo @nswds/prettier-config package now that it has been extracted to its own public repository, and updates the “single source of truth” documentation to point consumers at the new homes for both shared config packages.

Changes:

  • Deleted packages/prettier-config (README, package.json, and index.json) now that it lives in digitalnsw/nswds-prettier-config.
  • Updated docs/config-single-source-of-truth.md to reference the new repo locations and to revise Phase 3 rollout steps accordingly.

Reviewed changes

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

File Description
packages/prettier-config/README.md Removed now that the package has been extracted to its own repository.
packages/prettier-config/package.json Removed package manifest as part of extracting/deleting the in-repo package.
packages/prettier-config/index.json Removed shared Prettier option JSON from this repo (now hosted externally).
docs/config-single-source-of-truth.md Updated docs to reflect the new repo locations and revised migration steps.

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

Comment thread docs/config-single-source-of-truth.md Outdated
Both extracted packages are now MPL-2.0, matching @nswds/tokens, so the
whole @nswds/* scope is consistent. Replaces the note flagging the ISC
mismatch as an open decision — it has been made and applied in both repos
ahead of first publish, so no prior distribution under ISC needs
reconciling.
Copilot AI review requested due to automatic review settings July 27, 2026 04:08

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

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

Comment thread docs/config-single-source-of-truth.md
Removing the "Enabling it needs: 1... 2..." block left item 3 behind. It
does not render as a list at all: CommonMark only lets an ordered list
interrupt a paragraph when it starts at 1, so with no blank line before
it the `3.` was swallowed into the preceding paragraph as lazy
continuation and rendered as a stray literal "3." mid-sentence
(confirmed against GitHub's own markdown renderer).

Its content was also stale — it asked for a licence decision and a
LICENSE file, both of which now exist: the extracted repos are MPL-2.0
with the same LICENSE as nswds-tokens. So it is deleted rather than
reformatted into a list.

The trailing "Until then the packages are the reviewed source of truth
but not installable" went with it. "Until then" pointed at that removed
list, so it no longer had an antecedent, and the claim is false now that
the packages live in their own repos.
Picks up the orphaned-fragment cleanup from the base branch and resolves
the overlap in the Mechanism B section.

Conflict resolution keeps this branch's text — both packages have moved
out, so the base branch's "@nswds/prettier-config still lives in
packages/" sentence is superseded — and drops the trailing "Until then
the packages are the reviewed source of truth but not installable", which
lost its antecedent when the enabling-requirements list was removed and
is false now that neither package lives here.

Also inserts the blank line before the MPL-2.0 paragraph. Without it that
paragraph was lazily continued onto the preceding CI-test paragraph and
the two rendered as one run-on block. The section now renders as four
discrete paragraphs (verified against GitHub's markdown renderer).
Copilot AI review requested due to automatic review settings July 27, 2026 04:33

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 4 out of 4 changed files in this pull request and generated no new comments.

`globalIgnores([...repo-specific])` parses, but the hyphen makes it a
subtraction: it evaluates to `[...(repo - specific)]` and throws
`TypeError: (repo - specific) is not iterable`. The leading `...` was
doing double duty as both a spread and an "and your stuff here" ellipsis,
and only the second reading works.

Use `globalIgnores(['repo-specific/**'])` instead. It evaluates, and it
shows the shape the API actually takes — an array of glob strings, as in
the package README's `globalIgnores(['src/lib/blocks/generated.ts'])` —
rather than a placeholder that reads like an identifier.

The snippet predates this branch; only the Home column was added to that
row here. Fixing it while the row is already being touched.
Picks up the usage-snippet fix from the base branch. Conflict was the two
Mechanism B table rows: takes the corrected eslint-config snippet from
the base, and keeps this branch's prettier-config row, whose Home column
points at the new repo rather than `packages/` here.
Copilot AI review requested due to automatic review settings July 27, 2026 04:42

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 4 out of 4 changed files in this pull request and generated no new comments.

Base automatically changed from chore/extract-eslint-config to main July 27, 2026 04:45
#38 was squash-merged, so main gained a single commit that does not match
the individual commits this branch already merged from that branch. Git
could not reconcile the two histories and flagged the doc as conflicting
once GitHub retargeted this PR from chore/extract-eslint-config to main.

Both conflict hunks are the same shape: this branch holds the later state
(both packages extracted, packages/ gone) and main holds #38's earlier
snapshot (eslint extracted, prettier still in packages/). Resolved in
favour of this branch throughout — it is a superset, since #38's content
was merged here before the squash.

Verified nothing from main was dropped: every line unique to main's copy
is superseded eslint-only phrasing that this branch rewrites to cover
both packages. Also re-checked that the earlier review fixes survived —
the valid usage snippet, no orphaned list item, no dangling "Until then"
sentence, both Home links, and four discrete paragraphs in Mechanism B.
@laurenhitchon
laurenhitchon merged commit c8f5d12 into main Jul 27, 2026
4 checks passed
@laurenhitchon
laurenhitchon deleted the chore/extract-prettier-config branch July 27, 2026 04:49
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