Repository navigation
chore: code scanning(scoria)の指摘をまとめて直す - #185
Conversation
toSorted/toReversed for sort/reverse (lib ES2023), no shadowed names, helpers that capture nothing moved to module scope, unused exports dropped, no await in a loop, no spread in map or reduce accumulators, and the TODO marker replaced by what the field is. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
| "useDefineForClassFields": true, | ||
| "module": "ESNext", | ||
| "lib": ["ES2022", "DOM", "DOM.Iterable"], | ||
| "lib": ["ES2023", "DOM", "DOM.Iterable"], |
There was a problem hiding this comment.
P2 — should fix: ES2023 array methods are now required at runtime by the published browser bundle.
lib: ["ES2023", ...] only changes type checking; target remains ES2020 and Vite does not polyfill Array.prototype.toSorted/toReversed (or the typed-array variants), so these calls are emitted as-is. The package is a Vue/browser plugin, and this can make calculation fail with TypeError: values.toSorted is not a function in consumers whose browser runtime predates ES2023, even though the previous code worked.
Every source occurrence introduced by this change is: src/core/functionList.ts:9; src/engine/evaluator.ts:198; src/engine/functions/analysis-math.ts:84,103,110; src/engine/functions/array-functions-math.ts:43; src/engine/functions/descriptive-math.ts:18; src/engine/functions/forecast-ets-math.ts:28,65,220; src/engine/functions/group-by-math.ts:54; src/engine/functions/hypothesis-tests-math.ts:90,195,196,248,331; src/engine/functions/linest-math.ts:158,173; src/engine/functions/matrix-math.ts:114,116; src/engine/functions/shape-math.ts:71; src/engine/functions/statistical-math.ts:32; src/engine/nameBinding.ts:159; src/engine/textArithmetic.ts:28; and src/engine/textDateFormat.ts:78.
Smallest fix: keep the non-mutating behavior with the existing ES2020-compatible forms (for example, [...values].sort(...), [...items].reverse(), and Array.from(typedArray).sort()) in library source, or explicitly add/document a supported-runtime/polyfill contract for every published entry point.
What would change my mind: a verified browser support policy that already requires ES2023 built-ins, together with a build/polyfill guarantee for the published bundles; Node >=22 alone does not establish that for the Vue package.
|
CODEX VERDICT: CHANGES REQUESTED
Checks: FINDINGS COMPLETE: I read every hunk of the diff and this is every finding I have. |
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Codex round 1 raised one P2: the package now needs an ES2023 runtime. The user decided to require it. README's Installation section now says so (3851fcc; no polyfill). Nothing else was raised. |
|
CODEX VERDICT: LGTM Read SHA: 3851fcc
FINDINGS COMPLETE: I read every hunk of the diff and this is every finding I have. |
Summary
Clears the code scanning (scoria) findings that can be fixed as written, all in one go. Behaviour does not change.
sort()/reverse()→toSorted()/toReversed(). Every site insrcandtests, not only the ones flagged. Every site already sorted a copy, so where a copy was written out ([...x].sort()) it is dropped.tsconfig.json'slibmoves from ES2022 to ES2023, so the types are known._becomes_cell/_value/_column.calculator.ts, thesheetthat shadowed the argument becomesnamed/owner.test_forecastEts.tshad the same nameformula, so they becametenPointForecastandfourPointForecast.export.collectNumericValueswas used nowhere and is deleted.calculator.ts(dependencies: []) becomes a sentence saying what the field is.map:concat, ingroup-by-math.tsand three tests;reduceaccumulator (LET's bindings):push, on the accumulator the reduce created itself.awaitin a loop: the polling and the read-in-turn loop become recursion.__names put onglobalThisbecomespreadsheetIfsProbeand the like;5.14159;pickis removed.Items to Confirm
toSortedandtoReversedreach the build unchanged. Codex raised this and you decided to require it. README's Installation section says so: Node 22 or later, Chrome 110, Safari 16, Firefox 115 or later.origin/main) and new were run side by side and every result compared.corpusdiff.mts), all identical.yarn lint,yarn typecheck,yarn build,yarn test,yarn test:engineandrun-all-fixtures.tspass. oxlint, run with scoria's settings, reports nothing.jscpd(repeated code; mostly the small helpers each test has): to be handled separately.god-file(calculator.ts,evaluator.tsandView.vueover their size limits): splitting them is a large refactor, out of scope here.style-blockinView.vue: replacing it with Tailwind needs a check on screen, so it goes in its own PR.User Prompt
🤖 Generated with Claude Code
work in GUIChatPluginSpreadsheet