@mnci/cli 2.0.0 → 3.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -78,14 +78,12 @@ ever needed is noise that trains people to ignore the output.
78
78
  | Check | The failure it catches |
79
79
  | ------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------- |
80
80
  | Exactly one root ESLint config, and no per-project ones | The config fragmenting — every `@nx/*` generator writes one, so each project ends up linting against whichever config sits nearest |
81
- | No stray `.prettierrc` | It outranks `.prettierrc.mjs`, so the whole formatting opinion is silently discarded while both files look fine |
82
81
  | `@nx/eslint/plugin` registered in `nx.json` | Without it `npm run lint` exits 0 while linting nothing |
83
82
  | The **resolved** `eslint` major | A declared range and an installed version are different things — manifests once said `^10` while the pin said 9 |
84
83
  | `.npmrc` matches the recorded registry | The two registry kinds get different files; an Azure workspace also needs its scope routed |
85
84
  | `versionActions` on publishable Dart/Python packages | Its absence aborts `nx release` for the **whole** workspace, not just that project |
86
85
  | `nx sync:check` | A stale TypeScript project reference that was never committed |
87
- | Only the chosen linter's config files present | Two formatter configs is not a visible error — each is valid, the CLI picks one, the editor may pick the other, and the two gates disagree silently |
88
- | no retired formatter is still configured | a leftover `.prettierrc.mjs` or `.oxfmtrc.json` runs from no command line, but a globally installed editor extension still resolves it and reformats on save, silently undoing Standard |
86
+ | No retired formatter is still configured | A leftover `.prettierrc*`, `.oxfmtrc.json` or `oxlint.config.ts`, or a `prettier`/`oxlint`/`oxfmt` devDependency, runs from no command line — which is what makes it dangerous, since an editor extension still resolves it and reformats on save, undoing Standard after every gate has passed |
89
87
 
90
88
  Everything else is plain Nx, surfaced as a small curated set of root scripts —
91
89
  each a single cross-platform command:
@@ -156,15 +154,14 @@ that would just fail felt worse than being upfront that it doesn't exist yet.
156
154
  nothing at all while reporting green.
157
155
  3. Writes `eslint.config.mjs` (one import from `@mnci/eslint-config` — the whole
158
156
  linting opinion, in one root config — plus a commented inventory naming every
159
- config block and how to override it), `.prettierrc.mjs` (which re-exports
160
- `@mnci/eslint-config/prettier`, so lint and format ship as one package and
161
- upgrade together) + `.prettierignore`, `.npmrc` (publish auth — see **Publish auth** below),
157
+ config block and how to override it — there is no formatter config, because
158
+ ESLint is the formatter), `.npmrc` (publish auth — see **Publish auth** below),
162
159
  `commitlint.config.mjs`, a husky `commit-msg` hook, the chosen CI provider's
163
160
  pipeline file(s)
164
161
  (`azure-pipelines.yml` and/or `.github/workflows/ci.yml`, `--ci`, default
165
162
  `azure`; `github`/`both` also gets `.github/dependabot.yml` — weekly
166
163
  dependency-update PRs), a `<workspace-name>.code-workspace` file (VS Code
167
- workspace configuration with folder structure, ESLint/Prettier settings,
164
+ workspace configuration with folder structure, ESLint settings,
168
165
  recommended extensions, and an empty `tasks` array that `mnci add` fills in
169
166
  per project — see below — open it in VS Code via `File > Open Workspace
170
167
  from File`), and the curated root scripts.
@@ -181,12 +178,12 @@ same options `new` would have and calls the exact same `applyOverlay` `new`
181
178
  itself calls — the one function that does every bit of `mnci`-owned file
182
179
  writing (`nx.json`'s `release`/`sync`/`generators`/`namedInputs.sharedGlobals`/
183
180
  `mnci` blocks, `.npmrc`,
184
- `eslint.config.mjs`, `.prettierrc.mjs`, `commitlint.config.mjs`,
181
+ `eslint.config.mjs`, `commitlint.config.mjs`,
185
182
  `.husky/commit-msg`, the CI pipeline file(s), `.devcontainer/devcontainer.json`, the
186
183
  `<workspace-name>.code-workspace` file, and the curated root `package.json`
187
184
  scripts). Nothing else in the workspace — app/lib source, `project.json` targets
188
- from `mnci add` — is ever touched, and it finishes by running Prettier over the
189
- result, the same way `new` and every `add` do.
185
+ from `mnci add` — is ever touched, and it finishes by running `eslint --fix`
186
+ over the result, the same way `new` and every `add` do.
190
187
 
191
188
  The `.code-workspace` file is the one partial case, and deliberately so: its
192
189
  folders, settings and extensions are regenerated, but the **`tasks` array is read
@@ -198,10 +195,14 @@ project's build/qa/start entry on upgrade.
198
195
  has always done — one more reason to run `git diff` first, as the command's own
199
196
  output tells you to:
200
197
 
201
- - `create-nx-workspace`'s `.prettierrc` and `.vscode/`, plus mnci's own former
202
- `.prettierrc.json`. The two Prettier files are deleted for the same reason:
203
- both outrank `.prettierrc.mjs`, which Prettier would otherwise never reach.
204
- `.vscode/` is superseded by the `.code-workspace` file.
198
+ - `create-nx-workspace`'s `.prettierrc` and `.vscode/`, plus every formatter
199
+ config a past mnci version wrote — `.prettierrc.json`, `.prettierrc.mjs`,
200
+ `.prettierignore`, `.oxfmtrc.json`, `oxlint.config.ts`. None of them runs from
201
+ a command line any more, and that is exactly what makes them dangerous: a
202
+ globally installed `esbenp.prettier-vscode` or `oxc.oxc-vscode` still resolves
203
+ one and still reformats on save, undoing Standard while `lint` stays green
204
+ because the damage lands after the check. `.vscode/` is superseded by the
205
+ `.code-workspace` file.
205
206
  - **every per-project `eslint.config.*` under `apps/`, `libs/` and
206
207
  `packages/`.** This is the migration path for a workspace generated before
207
208
  mnci owned linting: without it an upgrade would install the root config while
@@ -254,15 +255,10 @@ a `lint` target" and "the root config genuinely reports violations in a project
254
255
  with no config of its own", because a future Nx change there would silently
255
256
  switch linting off workspace-wide.)
256
257
 
257
- ESLint handles code quality only; **Prettier owns all formatting**, configured
258
- for JavaScript Standard Style (no semicolons, single quotes, 2-space indents, no
259
- trailing commas). Both opinions come from the same package: `.prettierrc.mjs`
260
- re-exports `@mnci/eslint-config/prettier`, so a formatting fix arrives through
261
- `npm update` exactly as a rule fix does, and the two cannot drift into
262
- contradicting each other. `mnci` runs Prettier itself at the end of `new` and every
263
- `add`, so a generated workspace passes its own `format:check` immediately — Nx's
264
- generators emit semicolons and double quotes, and without that pass the first
265
- commit buries every real change under generator noise.
258
+ `mnci` runs `eslint --fix` itself at the end of `new` and every `add`, so a
259
+ generated workspace passes its own `lint` immediately — Nx's generators emit
260
+ semicolons and double quotes, and without that pass the first commit buries every
261
+ real change under generator noise.
266
262
 
267
263
  **One linter, which is also the formatter.** There is no `--linter` flag and no
268
264
  choice to make: `@mnci/eslint-config` carries code quality, type-aware rules and
@@ -412,8 +408,8 @@ vulnerable transitive package) is exactly what this monorepo's own
412
408
  attempts automatically.
413
409
 
414
410
  Then `nx sync:check` (fails fast and clearly if the workspace wasn't
415
- synced+committed locally — see above), then `npm run format:check`, then **one
416
- verify step** running `lint,typecheck,test,build`. `typecheck` is in that list
411
+ synced+committed locally — see above), then **one verify step** running
412
+ `lint,typecheck,test,build`. `typecheck` is in that list
417
413
  because a bundler-built project strips types without reading them, so `build`
418
414
  passing proves nothing about type correctness.
419
415
 
@@ -422,9 +418,10 @@ project on anything else — including a push to `main`, so a release is always
422
418
  verified in full. There is deliberately no separate `npm run lint` step: that is
423
419
  `nx run-many -t lint`, a strict subset of the list above, and on an
424
420
  affected-scoped PR it would re-lint every project and throw the benefit away.
425
- `format:check` does stay workspace-wide, because `prettier --check .` is one
426
- invocation over the whole tree rather than a per-project target, so there is
427
- nothing to narrow.
421
+
422
+ There is no `format:check` step either, and its removal is not a saving but a
423
+ consequence: `lint` reports formatting itself now, so a second step would run
424
+ the same binary twice over the same tree.
428
425
 
429
426
  Every fallback in that step verifies **everything**: no PR target branch, an
430
427
  unresolvable merge-base (shallow clone, absent remote branch), any non-PR run.
package/dist/cli.js CHANGED
@@ -1510,15 +1510,21 @@ ${ESLINT_BLOCK_INVENTORY}//
1510
1510
  // a dependency, so \`npm update\` brings rule fixes in the way it brings any
1511
1511
  // other. An override here survives that; an edit to the package does not.
1512
1512
  //
1513
- // One override cannot work, and it is the one people reach for first:
1514
- // \`space-before-function-paren\`. Prettier rewrites \`f (a)\` to \`f(a)\` on every
1515
- // run, so switching that rule on makes \`npm run lint\` and \`npm run format:check\`
1516
- // impossible to satisfy at the same time. Formatting lives in .prettierrc.mjs.
1513
+ // FORMATTING IS LINTING HERE. There is no Prettier, no oxfmt and no
1514
+ // \`format:check\` \u2014 \`npm run lint\` reports indentation, quotes and spacing as
1515
+ // ordinary errors, and \`npm run format\` is \`eslint . --fix\`. So do not add a
1516
+ // formatter: whichever one you pick will disagree with the \`mnci/standard\`
1517
+ // block above, and because a formatter runs on save it wins silently, leaving
1518
+ // \`lint\` to fail on files you never edited by hand.
1519
+ //
1520
+ // That also applies to the editor. Installing a Prettier or oxfmt extension is
1521
+ // enough on its own \u2014 neither needs a config file, and with none present they
1522
+ // format against their own defaults (semicolons, double quotes), which is the
1523
+ // inverse of Standard.
1517
1524
  export default mnci({ workspaceRoot: import.meta.dirname })
1518
1525
  `;
1519
1526
  var VSCODE_RECOMMENDED_EXTENSIONS = [
1520
1527
  "dbaeumer.vscode-eslint",
1521
- "esbenp.prettier-vscode",
1522
1528
  "nrwl.angular-console",
1523
1529
  "firsttris.vscode-jest-runner"
1524
1530
  ];
@@ -1551,9 +1557,9 @@ function vscodeSettings() {
1551
1557
  // does that comparison BEFORE scope. So a `[typescript]` block in someone's
1552
1558
  // USER settings — left over from any other project — outranks this file's
1553
1559
  // workspace-level `editor.defaultFormatter`, and format-on-save quietly uses
1554
- // that other formatter instead. Nothing reports it: Prettier is installed,
1555
- // the config resolves, `npm run format:check` still finds the 68 unformatted
1556
- // files, and the editor simply never applies it.
1560
+ // that other formatter instead — and nothing reports it, because the gate
1561
+ // and the editor are looking at different tools. That is how it was found:
1562
+ // reported from a real workspace, not deduced from the docs.
1557
1563
  //
1558
1564
  // Reported from a real workspace where `.ts` files were not being formatted
1559
1565
  // while `.json`/`.jsonc`/`.yaml` were — exactly the three that had explicit