From 7d181c31ed7aa19f643b7203d2fda4b37405b5c9 Mon Sep 17 00:00:00 2001 From: nehemiyawicks Date: Tue, 5 May 2026 20:12:49 +0530 Subject: [PATCH] docs(v8-migration): note 0-based codeFrameColumns column Add @babel/code-frame entry under v8-migration-api.md for the 0-based column change in babel/babel#17849. --- docs/v8-migration-api.md | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/docs/v8-migration-api.md b/docs/v8-migration-api.md index 56080e87e9..68d8de843f 100644 --- a/docs/v8-migration-api.md +++ b/docs/v8-migration-api.md @@ -1445,6 +1445,19 @@ Other than the changes listed below, `@babel/parser` is affected by all the [AST ### `@babel/code-frame` +![medium](https://img.shields.io/badge/risk%20of%20breakage%3F-medium-yellow.svg) + +- Use 0-based `column` in `codeFrameColumns` ([#17849](https://github.com/babel/babel/pull/17849)) + + Babel 7 interpreted `column` as 1-based. Babel 8 treats it as 0-based, matching `@babel/parser` AST locations. + + __Migration__: If you were adding `+ 1` to an AST `loc.column` before passing it to `codeFrameColumns`, drop that. If you were passing a 1-based column directly, subtract 1 before calling `codeFrameColumns`. + + ```diff title="my-babel-plugin.js" + - codeFrameColumns(code, { start: { line: loc.line, column: loc.column + 1 } }); + + codeFrameColumns(code, { start: { line: loc.line, column: loc.column } }); + ``` + ![low](https://img.shields.io/badge/risk%20of%20breakage%3F-low-yellowgreen.svg) - Remove default export ([#17772](https://github.com/babel/babel/pull/17772))