intlify / intlify/cli

annotate: Not sure where the SFC parse error occurred

Open
#36 0 comments 0 reactions 0 assignees View on GitHub
Status: PR Welcome Status: Proposal Type: Improvement
Dominant language
TypeScript
Stars
9
Forks
2
PR merge metrics
No merged PRs in 30d

Description

### Clear and concise description of the problem

Currently, when an error occurs in SFC parse, an error with the following stack trace is output:

```
SyntaxError: SFC parse error
at Object.annotate (/path/to/ode_modules/@intlify/cli/lib/chunks/annotate.cjs:202:19)
at Object.handler (/path/to/ode_modules/@intlify/cli/lib/cli.cjs:195:30) {
erorrs: [
SyntaxError: Element is missing end tag.
at createCompilerError (/path/to/ode_modules/@vue/compiler-core/dist/compiler-core.cjs.js:19:19)
at emitError (/path/to/ode_modules/@vue/compiler-core/dist/compiler-core.cjs.js:1599:29)
at parseElement (/path/to/ode_modules/@vue/compiler-core/dist/compiler-core.cjs.js:1152:9)
at parseChildren (/path/to/ode_modules/@vue/compiler-core/dist/compiler-core.cjs.js:943:28)
at parseElement (/path/to/ode_modules/@vue/compiler-core/dist/compiler-core.cjs.js:1131:22)
at parseChildren (/path/to/ode_modules/@vue/compiler-core/dist/compiler-core.cjs.js:943:28)
at parseElement (/path/to/ode_modules/@vue/compiler-core/dist/compiler-core.cjs.js:1131:22)
at parseChildren (/path/to/ode_modules/@vue/compiler-core/dist/compiler-core.cjs.js:943:28)
at parseElement (/path/to/ode_modules/@vue/compiler-core/dist/compiler-core.cjs.js:1131:22)
at parseChildren (/path/to/ode_modules/@vue/compiler-core/dist/compiler-core.cjs.js:943:28) {
code: 24,
loc: [Object]
}
],
filepath: '/path/to/src/apps/custom_tag/CustomTagView.vue'
}
```

We don’t know the location that is occured `.vue` file.

### Suggested solution

We should output the location as well, as shown below:

```
SyntaxError: SFC parse error
at Object.annotate (/path/to/ode_modules/@intlify/cli/lib/chunks/annotate.cjs:202:19)
at Object.handler (/path/to/ode_modules/@intlify/cli/lib/cli.cjs:195:30) {
erorrs: [
SyntaxError: Element is missing end tag.
code: 24,
loc: {
line: 1,
column: 1
}
}
],
filepath: '/path/to/src/apps/custom_tag/CustomTagView.vue'
}
```

### Alternative

_No response_

### Additional context

_No response_

### Validations

- [X] Read the [Contributing Guidelines](https://github.com/intlify/cli/blob/main/.github/CONTRIBUTING.md)
- [X] Read the [Documentation](https://github.com/intlify/cli/blob/main/README.md)
- [X] Check that there isn't already an issue that reports the same bug to avoid creating a duplicate.

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.