Commit b64f732
authored
chore(bb.js): fix linting (#24902)
## Summary
- make the ESLint 9 flat config executable and apply the full
`yarn-project/foundation` lint contract to bb.js
- enable all 36 canonical explicit rules, including `import-x/no-cycle`,
core `require-await`, `no-console`, camelcase, no-only-tests, and the
three Aztec custom rules
- use the same canonical ESLint plugins, type-checked/import-x base
configs, and byte-identical Prettier import-order configuration
- fix all resulting bb.js lint and formatting violations, including
refactoring the backend factories to remove four dependency cycles
- run `yarn formatting` during every bb.js build before cache lookup and
from the default `ci-barretenberg` path
- make `formatting:fix` run both ESLint fixes and Prettier
## Canonical alignment
A machine comparison of bb.js and `yarn-project/foundation` reports:
- 36 explicit rules in each config
- identical values for 35 rules
- the same plugin set: import-x, jsdoc, tsdoc, no-only-tests, and
aztec-custom
- byte-identical implementations for all three Aztec custom rules
- byte-identical Prettier configuration, including import ordering
The sole rule-option difference is the project-specific ignore list for
`import-x/no-unresolved`. bb.js ignores `src/cbind/generated` and the
checked-in wasm symlinks because those targets are created later in
bootstrap; yarn-project has its own four generated/conditional-export
resolver exceptions. This is module-resolution plumbing, not a style
relaxation: the rule remains enabled at `error` everywhere.
## CI coverage
`merge-train/barretenberg` PRs select `ci-barretenberg`. That mode runs
`barretenberg/ts/bb.js/bootstrap.sh formatting` before the CRS/C++ work.
Normal bb.js builds also run the same check before a build-cache hit can
return early.
A temporary `src/lint_probe.ts` containing a disallowed `console.log`
made the exact bootstrap formatting command exit 1 with `no-console`;
removing it made the command exit 0. The lint command also passes in a
fresh worktree where the wasm symlinks are unresolved and
`src/cbind/generated` is absent.
## Testing
- machine comparison of canonical/bb.js explicit rule maps and plugin
sets
- byte comparison of canonical/bb.js Prettier configs and custom rule
implementations
- `yarn formatting`
- `yarn install --immutable`
- focused strict TypeScript compile of the refactored backend factories
and implementations
- `CI=1 AVM=0 AVM_TRANSPILER=0 barretenberg/ts/bb.js/bootstrap.sh
formatting`
- the same bootstrap command in a fresh worktree with unresolved
generated artifacts
- red/green lint probe through the bootstrap command
- exact-head `ci-barretenberg` passed
- exact-head `ci-barretenberg-full` passed bb.js formatting, binding
generation, and ESM/CommonJS/browser builds; that wider job later
stopped in the separate bb-avm-sim build because `@aztec/ipc-runtime`
was unavailable55 files changed
Lines changed: 2087 additions & 284 deletions
File tree
- barretenberg/ts
- bb.js
- eslint-rules
- src
- barretenberg_wasm
- barretenberg_wasm_base
- barretenberg_wasm_main
- factory
- browser
- node
- barretenberg_wasm_thread
- factory
- browser
- node
- fetch_code
- browser
- node
- helpers
- browser
- node
- barretenberg
- testing
- bb_backends
- browser
- node
- bbapi
- benchmark
- bin
- cbind
- crs
- browser
- node
- random/browser
Some content is hidden
Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2 | 2 | | |
3 | 3 | | |
4 | 4 | | |
5 | | - | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
6 | 11 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
12 | 12 | | |
13 | 13 | | |
14 | 14 | | |
15 | | - | |
16 | | - | |
| 15 | + | |
17 | 16 | | |
18 | 17 | | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
19 | 30 | | |
20 | 31 | | |
21 | 32 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
0 commit comments