28 Commits

Author SHA1 Message Date
Matt Godbolt
8734c3e492 Update biome (#7956)
- latest biome, and fix its configuration
- fixes "static" content to be globally configured too (instead of
per-line)
- fixes issues:
  - imports fixed up
  - `Date.now()` vs `+new Date()`
  - some unused things `_` prefixed
 
After discussion with the team, turned off the unused parameter warning.
2025-07-28 10:34:46 -05:00
Matt Godbolt
dcc2922287 Fix unhandled promise rejections causing Sentry noise (#7832)
## Summary
- Fixes unhandled promise rejections being logged as "Non-Error capture"
in Sentry issue COMPILER-EXPLORER-BT9
- Converts all promise rejections to use proper Error objects instead of
plain objects/strings/undefined
- Adds defensive handling in Sentry's unhandled rejection listener

## Root Cause
The Sentry issue was caused by services rejecting promises with
non-Error objects:
- `CompilerService.handleRequestError()` rejected with `{request,
error}` plain objects
- Various other services rejected with strings or undefined values
- These triggered the global unhandled rejection handler, which logged
them as "Non-Error capture"

## Changes Made
1. **CompilerService**: Modified `handleRequestError()` to reject with
Error objects while preserving request context
2. **Sentry**: Enhanced unhandled rejection handler to defensively
convert non-Error reasons to Error objects
3. **MultifileService**: Changed string rejections to Error objects
4. **SharingService**: Added descriptive Error objects for link failures
5. **TreePane**: Used Error objects for user cancellation scenarios
6. **CfgView**: Used Error objects for canvas blob creation failures

## Test Plan
- [x] TypeScript compilation passes
- [x] All tests pass (npm run test-min)
- [x] Linter passes
- [x] Pre-commit hooks validated

## Impact
- Reduces Sentry noise from "Non-Error capture" events
- Provides better stack traces for debugging
- Maintains backwards compatibility (consuming code handles both Error
objects and other types)
- More robust error handling throughout the application

🤖 Generated with [Claude Code](https://claude.ai/code)

---------

Co-authored-by: Claude <noreply@anthropic.com>
2025-06-18 19:24:15 -05:00
Ofek
e01aa3e691 Various type improvements 2025-02-26 02:07:09 +02:00
Mats Jun Larsen
5eea63328f Migrate to Biome for linting and formatting (#7033) 2025-02-02 17:54:31 +00:00
Ofek
c1985d64a1 Tsification binge #7 (#6974) 2024-10-25 12:19:04 +03:00
Ofek
bcb397f56b Add noUnusedLocals to tsconfig + fix the new alerts (#6396)
<!-- THIS COMMENT IS INVISIBLE IN THE FINAL PR, BUT FEEL FREE TO REMOVE
IT
Thanks for taking the time to improve CE. We really appreciate it.
Before opening the PR, please make sure that the tests & linter pass
their checks,
  by running `make check`.
In the best case scenario, you are also adding tests to back up your
changes,
  but don't sweat it if you don't. We can discuss them at a later date.
Feel free to append your name to the CONTRIBUTORS.md file
Thanks again, we really appreciate this!
-->
2024-05-14 18:46:22 +03:00
Jeremy Rifkin
a049dab662 Fix issue with compiler picker group sorting (#6030)
This restores the sorting behavior for the compiler picker to about two
years ago before the ts conversion. I'm not sure what the effect of
`.localeCompare() === 0` on .sort is, since that's only giving equality
information. The `@types` for underscorejs says `_._Chain.sort`'s
compare function should return a boolean but I can't actually find the
definition of any `sort` function in underscorejs nor are there docs
about what its compare function should return, but I think it's really
calling `Array.prototype.sort` which expects a negative/0/positive.
2024-02-05 20:45:37 -06:00
Jeremy
ab937c5d15 Revert "Fix issue with compiler picker group sorting"
This reverts commit 3441e45beb.
2024-01-20 21:19:05 -06:00
Jeremy
3441e45beb Fix issue with compiler picker group sorting 2024-01-20 21:18:32 -06:00
The Phantom Derpstorm
c6d3fa61ef Allow #embed file replacement and preserve eol-tokens (#5600) 2023-10-21 19:27:15 +02:00
Jeremy Rifkin
60ce06b02f Improve cache handling on the frontend, cache executions on the backend, and improve controls on the exec pane (#5111) 2023-06-11 19:10:30 -04:00
Jeremy
653e9a6899 Lint fixes 2023-06-11 17:38:38 -04:00
Jeremy Rifkin
acdd5ad45c Capture errors in sentry better (#5128)
Fixes #5127 and similar issues.

Rationale: Whenever something that is not an Error object is passed to
Sentry.captureException we get pretty much no useful information in
sentry

![image](https://github.com/compiler-explorer/compiler-explorer/assets/51220084/c7345449-f7a0-46cb-a198-abe0bd80a8b1)
(usually not even a stacktrace)
2023-06-11 17:31:51 -04:00
Matt Godbolt
3b75a229c8 Bump to latest LRUCache; use the correct import now the old way is deprecated (#5116) 2023-06-06 21:32:03 -05:00
Jeremy Rifkin
edcacc0272 Better compiler argument warnings handling (#5076)
The goal of this PR is to display any warnings about compiler arguments,
e.g. the warning about -march=native, somewhere else instead of a toast
notification every time. Feature requested on discord.


![image](https://github.com/compiler-explorer/compiler-explorer/assets/51220084/40a0c670-b2bb-4fae-b98d-937dbeb7d2e6)

![Animation](https://github.com/compiler-explorer/compiler-explorer/assets/51220084/43575608-daa6-487d-9ef9-ca04bdd38a38)

![image](https://github.com/compiler-explorer/compiler-explorer/assets/51220084/551e26e5-1e4f-4802-a68a-fb63e0e5e415)

---------

Co-authored-by: Matt Godbolt <matt@godbolt.org>
2023-05-30 21:18:09 -05:00
Jeremy Rifkin
22fa0511e4 Fix warning detection for wine msvc (#5068)
Fixes #4809
2023-05-22 12:19:38 -04:00
Matt Godbolt
3f7def7e38 Upgrade LRU-Cache (#4833)
- rephrase a few LRUs in terms of the new API
- add `okToCache` to the `CompilationResult` to make typing more correct
(I _think_)
2023-03-08 10:58:56 -06:00
Mats Jun Larsen
633eb82d18 Transition to ECMAScript Modules (#4780)
Makes the Compiler Explorer app, and all the tooling ESM compatible.
Things that have been done:

1. The package.json has `type: module` now
2. All relative imports have a .js ending
3. All directory imports are now directory/index.js to comply with ESM
standards
4. Dependency node-graceful is now imported into tree, because the
package is broken under esm
5. Dependency p-queue has been bumped to 7.x with ESM support
6. Dependency profanities has been bumped to 3.x with ESM support
7. Webpack config is now both ESM and CommonJS compatible
8. Non-ESM compatible imports have been rewritten
9. ESLint configuration has been tweaked to not fail on .js imports
10. Mocha is now hacked together and ran with ts-node-esm
11. Webpack is now hacked together and ran with ts-node-esm
12. Webpack config is now ESM compatible, so that it can be used in the
dev server
13. Cypress code still runs commonjs, and has been excluded from the
tsconfig
14. All sinon mock tests have been commented out, because sinon module
mocks do not work with ESModules (because ESModules are immutable)

A lot of tests are now giving warnings/errors to stdout, yet still pass.
Docenizer codegenerator scripts have been updated, but I did not re-run
them, and instead just changed their code.

---------

Co-authored-by: Matt Godbolt <matt@godbolt.org>
2023-02-27 18:06:38 -06:00
Jeremy Rifkin
384c297906 Fix trailing comma issue (#4775)
Make trailing commas more consistent throughout the project, fixes
config conflict between eslint and prettier. Resolves an oversight in
#4766.
2023-02-26 12:21:35 -05:00
Patrick Quist
a15c725c4f Move url expansion to files (#4602) 2023-02-02 22:02:32 +01:00
Jeremy Rifkin
07f37abe76 The War of The Types (#4490) 2023-01-13 19:22:25 -05:00
Markus
bc34e905d9 Convert compiler.js to typescript (#4132) 2022-10-18 18:18:34 +02:00
Markus
5c238822a6 Convert conformance-view.js to typescript (#4109) 2022-10-12 17:07:24 +02:00
Rubén Rincón Blanco
b25e443bbb Improve event-map types (#4135) 2022-10-10 13:39:18 +02:00
Patrick Quist
8205573365 add compilationinfo and related types (#4051)
* add compilationinfo and related types

* fix mtime type

* Add rest of compiler keys

* Make it compile

* Rename Compiler type to CompilerInfo as per Partouf's suggestion

* Get ready for #4077

* Linter fixes

Co-authored-by: Rubén Rincón Blanco <ruben@rinconblanco.es>
2022-09-20 08:00:24 -05:00
Rubén Rincón Blanco
05a2aae407 Move sass files to static/styles (#3971)
Also hides the tab titles on text overflow
2022-08-19 09:13:11 +02:00
Mats Larsen
1f5fbe0e28 Replace provide-plugin jquery imports with import statements (#3943) 2022-08-07 11:58:16 +02:00
Rubén Rincón Blanco
c315d6a719 Move compiler-service.js to TS (#3672)
Co-authored-by: Mats Larsen <me@supergrecko.com>
Co-authored-by: partouf <partouf@gmail.com>
2022-06-21 23:31:18 +02:00