Files
oxc-project__oxc/apps/oxlint/test/fixtures/fixes/options.json
overlookmotel 34851a75e3 fix(linter/plugins): error not panic if invalid fix range (#19058)
Previously when a rule provided a single fix or suggestion, the range of the fix was not checked to ensure it is valid.

If the fix had an invalid range (`start <= end`, `end` not out of bounds of source text) this would cause a panic when attempting to slice the source text with the invalid range.

Catch these cases earlier and produce a `MergeFixesError`, so the invalid fix is not applied, avoiding the panic.

Notes:

* The error messages for negative offsets or offsets > `u32::MAX` are not great, but I don't think it really matters. These shouldn't happen in practice, so IMO it'd be wasteful to introduce extra code paths to handle these cases. The important thing is that they don't cause panics.

* No additional validation is required when rule produces multiple fixes, as these same checks are already performed in `CompositeFix::merge_fixes_fallible`, which handles combining multiple fixes.
2026-02-06 13:08:28 +00:00

5 lines
42 B
JSON

{
"fix": true,
"singleThread": true
}