6 Commits
Author SHA1 Message Date
Tim van der Meij b655985b1d Upgrade eslint-plugin-unicorn to version 76.0.0
This is a major version bump, but the changelog at
https://github.com/sindresorhus/eslint-plugin-unicorn/releases/tag/v75.0.0 and
https://github.com/sindresorhus/eslint-plugin-unicorn/releases/tag/v76.0.0
doesn't indicate any breaking changes that should impact us.

Note that it does require a number of code changes due to improvements
that were made for the `unicorn/prefer-logical-operator-over-ternary`
and `unicorn/prefer-ternary` rules to detect more cases.
2026-09-19 19:17:01 +02:00
Calixte Denizet 26341dcdbd Add JSDoc linting
Enable rules that validate existing JSDoc comments and fix the reported issues.
2026-08-31 11:57:30 +02:00
Jayesh Bhade a163deb6eb Fix the two MathClamp calls the prefer-math-clamp fixer mis-ordered
The rule rewrites `Math.max(C, Math.min(A, B))` to `MathClamp(A, C, B)`, always
taking the inner call's first operand as the value. `Math.min` is commutative,
so the value is just as often the second one, and then the fixer swaps it with
the upper bound: the result is `Math.min(C, v)`, which no longer applies the
lower bound at all. Both call sites the fixer rewrote hit that case, so the
max-outer patterns are now reported without a fix.

Reporting them still needs its own message. `Math.max(C, Math.min(A, B))` is
only `MathClamp(A, C, B)` when `C <= B`, and the rule can't know whether that
holds, so telling the reader to "use MathClamp" is wrong advice. The message
states the condition instead, and `useClamp` is left to the min-outer patterns,
which are exact.

In `PSStackBasedInterpreter.build` the outputs were therefore never clamped up
to the Range minimum. The interpreter runs whenever `PSStackToTree` can't turn
the program into a tree — a stack-shrinking `if`, or a `copy`/`index`/`roll`
whose operand isn't a constant — and it then let a Type 4 function return e.g.
-1.5 for a component declared as `/Range [0 1]`.

In `SplitView.#clampFirstSize` the first pane's size was never clamped up to
`#minSize`: dragging the resizer past it wrote a negative `flexGrow`.

The existing range-clamping test only checked the upper bound, which is the one
the wrong operand order preserves.
2026-08-08 00:21:33 +05:30
Jonas Jenwald fae980a72d A couple of internal-viewer fixes
- Bundle the `web/text_layer_builder.css` file correctly, to ensure that textLayer debugging works when the code is *built*.
   Note how loading https://mozilla.github.io/pdf.js/internal-viewer/web/debugger.html currently logs the following error: `GET https://mozilla.github.io/pdf.js/internal-viewer/text_layer_builder.css [HTTP/2 404  7ms]`.

 - Import the `MathClamp` helper function from the *built* library, rather than "manually", since that's more correct.
2026-04-26 19:10:05 +02:00
Calixte Denizet 1e3d688a32 Add an eslint plugin for using MathClamp when it's possible 2026-04-03 21:12:52 +02:00
calixteman 7bac644731 Split the new debugger into multiple files
Instead of having all the code for the new debugger in a single file,
split it into multiple files.
This makes it easier to navigate and maintain the codebase.
It'll be make hacking and fixing bugs in the debugger easier.
2026-03-15 13:21:26 +01:00