Hacktoberfest 2026:メンテナが10月に向けて印を付けた、オープンで初心者向けの issue。 Hacktoberfest の issue を見る

import YAML file, RollupError: 'Legacy octal escape is not permitted in strict mode'

オープン
#1,992 コメント 0 件 リアクション 0 件 担当者 0 名 GitHub で見る

まだ誰も着手していません。

評価

難易度
3/5
見積もり時間
1〜2日
初心者へのやさしさ
48/100
issue の種類
バグ
明瞭さ
おおむね明確
活発さ
静か
技術スタック
javascript, yaml
領域
build-system

調査の方向性

Start with the StackBlitz reproduction and inspect /tosource/src/tosource.ts, especially legalKey, to determine how the quoted YAML key becomes the generated object key. Confirm the generated JavaScript is accepted by Rollup in strict mode and that the imported key remains "01" without the legacy-octal error.

索引モデルが issue の本文から書いたものです。

説明

Expected Behavior

No errors occur.

Actual Behavior
[!] RollupError: src/data.yaml (1:13): Legacy octal escape is not permitted in strict mode (Note that you need plugins to import files that are not JavaScript)
src/data.yaml (1:13)
1: var data = { 01:"any value" };
                ^
2: 
3: export default data;
Additional Information

I enclose key in quotes to indicate string.

On JS-YAML online demo, converted correctly.

input

# Enclose key in quotes to indicate string

'01': any value

output

{ '01': 'any value' }

Is this problem with tosource, not @rollup/plugin-yaml?

Is this problem in this code?

/tosource/src/tosource.ts

function legalKey(key: string) {
  return (
-    /^([a-z_$][0-9a-z_$]*|[0-9]+)$/gi.test(key) && !KEYWORD_REGEXP.test(key)
+    /^([a-z_$][0-9a-z_$]*|0|[1-9][0-9]*)$/gi.test(key) && !KEYWORD_REGEXP.test(key) // Like this?
  );
}
主要言語
JavaScript
スター
3.8k
フォーク
636
PR マージ指標
30日以内にマージされた PR はありません

環境構築

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

rollup/plugins のほかの issue

rollup/plugins の issue をすべて見る

似ている issue

JavaScript の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。