intlify / intlify/bundle-tools

Using HTML in SFC results in parsing issue `Unexpected scalar at node end`

Open
#351 2 comments 1 reaction 0 assignees View on GitHub
status: review needed
Dominant language
TypeScript
Stars
270
Forks
46
PR merge metrics
No merged PRs in 30d

Description

### Reporting a bug?

I'm trying to use short bits of html for text formatting in Nuxt. However, the `yaml-eslint-parser` package that is used does not seem to allow that. It throws an error saying "Unexpected scalar token". I tried changing the formatting from yaml to json, but that does not seem to have any effect, since the `yaml-eslint-parser` seems to be used for both cases.

### Expected behavior

Parsing the translation values regardless of its HTML content, when `strictMessage` is disabled.

### Reproduction

[https://github.com/casperboone/nuxt-i18n-sfc-html-bug-reproduction](https://github.com/casperboone/nuxt-i18n-sfc-html-bug-reproduction/)

### Issue Package

vite-plugin-vue-i18n

### System Info

```shell
System:
OS: macOS 14.2.1
CPU: (10) arm64 Apple M1 Max
Memory: 694.39 MB / 32.00 GB
Shell: 5.9 - /bin/zsh
Binaries:
Node: 21.7.1 - ~/.nvm/versions/node/v21.7.1/bin/node
Yarn: 1.22.19 - /opt/homebrew/bin/yarn
npm: 10.5.0 - ~/.nvm/versions/node/v21.7.1/bin/npm
Browsers:
Brave Browser: 120.1.61.109
Chrome: 116.0.5845.140
Safari: 17.2.1
npmPackages:
vue: ^3.4.21 => 3.4.21
```

### Screenshot

_No response_

### Additional context

```
Unexpected scalar token
at Context.throwError (/node_modules/yaml-eslint-parser/lib/context.js:80:15)
at processDoc (/node_modules/yaml-eslint-parser/lib/yaml-cst-parse.js:16:23)
at parseAllDocsToCST (/node_modules/yaml-eslint-parser/lib/yaml-cst-parse.js:31:9)
at parseForESLint (/node_modules/yaml-eslint-parser/lib/parser.js:13:57)
at parseYAML (/node_modules/yaml-eslint-parser/lib/index.js:46:40)
at generate$1 (file:///node_modules/@intlify/bundle-utils/lib/index.mjs:598:13)
at TransformContext.transform (file:///node_modules/@intlify/unplugin-vue-i18n/lib/index.mjs:527:48)
at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
at async file:///node_modules/vite-plugin-inspect/dist/index.mjs:377:17
at async file:///node_modules/vite-plugin-inspect/dist/index.mjs:377:17 (x2)
```

### Validations

- [X] Read the [Contributing Guidelines](https://github.com/intlify/bundle-tools/blob/main/.github/contributing.md).
- [X] Read the README
- [X] Check that there isn't already an issue that reports the same bug to avoid creating a duplicate.
- [X] Check that this is a concrete bug. For Q&A open a [GitHub Discussion](https://github.com/intlify/bundle-tools/discussions).

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.