Diagnostics

LUM1003: Scanner ambiguity

The scanner read text in a way that may not be what you meant: a <style taken as a comparison, or blocks hidden by an unterminated string or comment.

Severity: warning · Category: file format (1xxx)

Reported by: the scanner (compiler, lumiose check, language server). A warning.

#What it means

The .stsx scanner tracks JS, JSX, strings, template literals, comments and regular expressions to find <style> blocks. Two situations are ambiguous, and the scanner reports which reading it took:

  • <style right after an expression (const a = b <style>) is read as a < comparison, not as a block.
  • An unterminated string, template literal or comment hides every <style> block after it.

#Example

stsx
const a = b <style>
  .x { color: red; }
</style>

On the same line as an expression, <style continues the expression b.

#How to fix it

Start a top-level block on its own line (a <style at the start of a line at top level is always a block), conventionally at the end of the file. For the second case, close the string, template literal or comment that the message points to.